Back to Creating Secure Tools

Secure Tool API Reference

Complete REST API contract for secure tool providers.

Authentication Model

Secure tools use a two-tier authentication model based on caller origin:

EndpointCallerAuth Method
/installORCX-Daisi-Auth shared secret header
/uninstallORCX-Daisi-Auth shared secret header
/configureManager UI (direct)Known installId (registered via /install)
/executeConsumer Host (direct)sessionId validated via ORC callback
/auth/statusManager UI (direct)Known installId (registered via /install)

The installId is an opaque, unguessable identifier generated by the ORC on purchase. It serves as a bearer token for consumer-originated calls. Reject requests with unknown installId values with HTTP 403.

POST /install

Called by the ORC when a user purchases the tool. Register the installation so subsequent configure/execute calls can be validated.

Request
POST {baseUrl}/install
Content-Type: application/json
X-Daisi-Auth: {sharedSecret}

{
  "installId": "inst-260215143022-abcdef",
  "toolId": "weather-lookup",
  "bundleInstallId": "binst-260215143022-shared"
}
Request Fields
FieldTypeDescription
installIdstringOpaque identifier for this installation. Store this to validate future requests.
toolIdstringThe tool ID as defined in the marketplace item.
bundleInstallIdstring?Optional. Present when the tool is part of a Plugin bundle. All tools in the bundle share this ID. Use it to key OAuth tokens so users only authenticate once per bundle.
Response
{ "success": true }

POST /uninstall

Called by the ORC when a purchase is deactivated (subscription expired, cancelled, etc.). Clean up stored data for this installation.

Request
POST {baseUrl}/uninstall
Content-Type: application/json
X-Daisi-Auth: {sharedSecret}

{
  "installId": "inst-260215143022-abcdef"
}
Response
{ "success": true }

POST /configure

Called directly by the Manager UI when a user saves their setup data (API keys, credentials). No ORC relay.

Request
POST {baseUrl}/configure
Content-Type: application/json

{
  "installId": "inst-260215143022-abcdef",
  "toolId": "weather-lookup",
  "setupValues": {
    "apiKey": "sk-...",
    "region": "US"
  }
}
Request Fields
FieldTypeDescription
installIdstringThe installation identifier (registered via /install). Validate that this is known.
toolIdstringThe tool ID as defined in the marketplace item.
setupValuesobjectKey-value pairs matching the setup parameters defined in the marketplace item.
Response
// Success
{ "success": true }

// Error
{ "success": false, "error": "Invalid API key format" }

POST /execute

Called directly by consumer hosts when the AI invokes the tool during inference. The request contains a sessionId instead of an installId. Your server must validate the session by calling the ORC validation endpoint before executing.

Request
POST {baseUrl}/execute
Content-Type: application/json

{
  "sessionId": "sess-260218120000-xyz789",
  "toolId": "weather-lookup",
  "parameters": [
    { "name": "city", "value": "San Francisco" },
    { "name": "units", "value": "fahrenheit" }
  ]
}
Request Fields
FieldTypeDescription
sessionIdstringEphemeral session identifier provided by the consumer host. Validate this by calling the ORC validation endpoint to resolve the installId.
toolIdstringThe tool ID as defined in the marketplace item.
parametersarrayName/value pairs provided by the AI, matching the call parameters defined in the marketplace item.
Response
// Success
{
  "success": true,
  "output": "72 F, Sunny with clear skies",
  "outputFormat": "plaintext",
  "outputMessage": "Current weather for San Francisco"
}

// Error
{
  "success": false,
  "errorMessage": "API rate limit exceeded. Please try again in 60 seconds."
}
Response Fields
FieldTypeDescription
successboolWhether the tool executed successfully.
outputstringThe tool's output, returned to the AI.
outputFormatstringFormat of the output: plaintext, json, markdown, html, or base64.
outputMessagestring?Optional message to accompany the output for additional context.
errorMessagestring?Error description when success is false.

POST /auth/status

Called by the Manager UI to check whether an OAuth connection is active for a given installation and service. Only relevant for setup parameters with type oauth.

Request
POST {baseUrl}/auth/status
Content-Type: application/json

{
  "installId": "inst-260215143022-abcdef",
  "service": "office365"
}
Request Fields
FieldTypeDescription
installIdstringThe installation identifier (registered via /install).
servicestringThe service name matching the OAuth setup parameter name.
Response
{
  "connected": true,
  "serviceName": "office365",
  "userLabel": "Connected"
}
Response Fields
FieldTypeDescription
connectedboolWhether the OAuth connection is active.
serviceNamestring?The service name echoed back.
userLabelstring?Optional display label (e.g. the connected user's email).

POST /api/secure-tools/validate ORC Endpoint

This is an ORC endpoint that your provider server calls to validate a session before executing a tool. It resolves the ephemeral sessionId to the permanent installId associated with the purchase.

Request
POST {OrcValidationUrl}/api/secure-tools/validate
Content-Type: application/json
X-Daisi-Auth: {sharedSecret}

{
  "sessionId": "sess-260218120000-xyz789",
  "toolId": "weather-lookup"
}
Request Fields
FieldTypeDescription
sessionIdstringThe session identifier received from the consumer host in the /execute request.
toolIdstringThe tool ID being executed. The ORC verifies that this tool is part of the session's entitled tools.
Request Headers
HeaderDescription
X-Daisi-AuthYour shared secret, the same one used by the ORC for /install and /uninstall calls. This authenticates your server to the ORC.
Response
// Valid session
{
  "valid": true,
  "installId": "inst-260215143022-abcdef",
  "bundleInstallId": "binst-260215143022-shared"
}

// Invalid session
{
  "valid": false,
  "error": "Session not found or expired"
}
Response Fields
FieldTypeDescription
validboolWhether the session is valid and the tool is entitled.
installIdstring?The permanent installation identifier. Only present when valid is true. Use this to look up stored configuration.
bundleInstallIdstring?The shared bundle installation identifier. Only present when the tool is part of a Plugin bundle.
errorstring?Error description when valid is false.
Important: Always validate the session before executing. Never trust a sessionId without ORC confirmation. If validation fails, return an error to the consumer host. Do not execute the tool.

ExecutionCreditCost on MarketplaceItemInfo

Marketplace items that charge per execution include an ExecutionCreditCost field in their item metadata. This value represents the number of credits deducted from the consumer each time the tool is invoked.

FieldTypeDescription
ExecutionCreditCostdecimal?Credits charged per execution. null or 0 means no per-execution cost. The cost is snapshotted at execution time so that subsequent price changes do not retroactively affect past records.

Consumers can check this field before invoking a tool to understand the cost. Hosts include this information when presenting available tools to the AI.

Error Handling

Providers should handle errors gracefully:

ScenarioRecommended Response
Missing or invalid X-Daisi-Auth (install/uninstall)HTTP 401 Unauthorized
Unknown installId (configure/execute)HTTP 403 Forbidden with descriptive error
Installation not configuredHTTP 200 with success: false and descriptive error message
Invalid parametersHTTP 200 with success: false and descriptive error message
External API failureHTTP 200 with success: false and error message. Do not return HTTP 500 for expected failures.
Unexpected server errorHTTP 500 (the host will return a generic "Provider returned HTTP 500" error)

Setup Parameter Types

When defining setup parameters in the marketplace item, choose the appropriate type for the Manager UI:

TypeUI RenderingUse Case
textStandard text inputRegion names, identifiers, non-sensitive strings
passwordPassword input (masked)Passwords, tokens
apikeyPassword input (masked)API keys, secret keys
urlURL text inputEndpoint URLs, webhook URLs
jsonMultiline textarea (monospace)JSON configuration objects
oauth"Connect to [ServiceLabel]" buttonOAuth connections (Office 365, Google, X). Triggers popup-based OAuth flow instead of manual input.

OAuth-Specific Fields

When using the oauth type, two additional fields are required on the setup parameter:

FieldTypeDescription
AuthUrlstringThe provider's OAuth initiation URL. The Manager opens this in a popup with installId, returnUrl, and service as query parameters.
ServiceLabelstringDisplay label for the service (e.g. "Office 365", "Google"). Shown on the Connect button and status badge.