{"openapi":"3.1.0","info":{"title":"Programmable Dev API","version":"1.0.0","description":"Safe tool access for AI agents. Your server calls this API with its app key; your agents call the MCP endpoint with a short-lived token your server mints. Docs: https://programmable.dev/docs"},"servers":[{"url":"https://programmable.dev"}],"security":[{"appKey":[]}],"tags":[{"name":"Tenants and actors","description":"A tenant is one of your customers; an actor is one of their agents. Both use your own ids, created on first use."},{"name":"Connections","description":"A tenant's accounts at other services. People connect through a hosted page; keys never pass through your app."},{"name":"Providers","description":"The services your users can connect, and the hosts the proxy may call."},{"name":"Proxy","description":"Your own server calls a provider's API through a connection. We add the credential; you never see it."},{"name":"Rate limits","description":"Optional calls-a-minute ceilings for your app and its tenants. A call over a ceiling is refused at once and is not charged."},{"name":"Token read","description":"Your server holds a connection's OAuth access token itself. Off until you turn it on."},{"name":"Grants and tools","description":"Which tools each agent may use, with daily caps and approvals; call them over REST or MCP."},{"name":"Approvals","description":"Calls waiting for a person to say yes."},{"name":"Usage","description":"Calls, outcomes and cost; spending limits per app, tenant and actor."},{"name":"Call history","description":"Each call a tenant's agents and your proxy made, one at a time."},{"name":"Webhooks","description":"Events sent to your server, signed with your secret."},{"name":"Your OAuth clients","description":"Register your own OAuth client so the consent screen names your app."},{"name":"MCP sign-in","description":"Let the person your app names connect a stock MCP client (Claude, n8n) to their agent by signing in, instead of pasting a token."},{"name":"Access requests","description":"Let an agent ask your server for a tool it doesn't have."},{"name":"MCP server catalogue","description":"Remote MCP servers your users can connect."}],"paths":{"/v1/tenants/{tenant}":{"post":{"operationId":"upsertTenant","tags":["Tenants and actors"],"summary":"Create or rename a tenant","description":"Creates your tenant on first use (201) or returns it (200); a given name renames it. A tenant is one of your customers. Another app's tenant with the same id is a different tenant. Ids starting with `dashboard-` are kept for the dashboard's test account (400 RESERVED_ID for a new one).","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"201":{"description":"Created (200 when it already existed, for the upsert operations).","content":{"application/json":{"schema":{"type":"object","properties":{"tenant":{"$ref":"#/components/schemas/Tenant"},"created":{"type":"boolean"}},"required":["tenant","created"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["BAD_ID","RESERVED_ID"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200}},"additionalProperties":false}}}}},"delete":{"operationId":"deleteTenant","tags":["Tenants and actors"],"summary":"Delete a tenant","description":"Revokes every connection at its provider (best effort) and deletes it, expires pending approvals, and deletes actors, grants, tokens and sessions. Call logs are kept anonymised. Safe to retry: 204 when the tenant is already gone.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"deleted":{"type":"object","properties":{"connections":{"type":"integer"},"revoked_remote":{"type":"integer"},"actors":{"type":"integer"},"approvals_expired":{"type":"integer"}},"required":["connections","revoked_remote","actors","approvals_expired"]}},"required":["ok","deleted"]}}}},"204":{"description":"No such tenant for this app (already deleted, or never was)."},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":[]}},"/v1/tenants/{tenant}/actors/{actor}":{"post":{"operationId":"upsertActor","tags":["Tenants and actors"],"summary":"Create or relabel an actor","description":"An actor is one agent inside a tenant. 201 when new, 200 when it existed.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"actor","in":"path","required":true,"description":"Your own actor (agent) id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"201":{"description":"Created (200 when it already existed, for the upsert operations).","content":{"application/json":{"schema":{"type":"object","properties":{"actor":{"$ref":"#/components/schemas/Actor"},"created":{"type":"boolean"}},"required":["actor","created"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","BAD_ID","RESERVED_ID"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":200}},"additionalProperties":false}}}}},"delete":{"operationId":"deleteActor","tags":["Tenants and actors"],"summary":"Delete an actor","description":"Deletes the actor's grants, tokens and MCP sessions at once (its live tokens stop working); its pending approvals expire. The same id can be created again and starts empty.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"actor","in":"path","required":true,"description":"Your own actor (agent) id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"deleted":{"type":"object","properties":{"grants":{"type":"integer"},"tokens":{"type":"integer"},"sessions":{"type":"integer"},"approvals_expired":{"type":"integer"}},"required":["grants","tokens","sessions","approvals_expired"]}},"required":["ok","deleted"]}}}},"204":{"description":"No such tenant or actor (already deleted, or never was)."},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":[]}},"/v1/tenants/{tenant}/actors/{actor}/tokens":{"post":{"operationId":"createActorToken","tags":["Tenants and actors"],"summary":"Mint an MCP token for an actor","description":"A short-lived bearer token (`pdt_…`) that opens the MCP endpoint for this actor only. 60-900 seconds, default 900. Returned once (Cache-Control: no-store). It carries no grants (they are read live) and dies when the key that minted it is revoked.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"actor","in":"path","required":true,"description":"Your own actor (agent) id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"201":{"description":"Created (200 when it already existed, for the upsert operations).","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","description":"pdt_…"},"expires_at":{"type":"string","format":"date-time"},"mcp_url":{"type":"string","description":"The MCP endpoint for this actor."}},"required":["token","expires_at","mcp_url"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_ACTOR"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"ttl_seconds":{"type":"integer","minimum":60,"maximum":900}},"additionalProperties":false}}}}}},"/v1/tenants/{tenant}/connect-sessions":{"post":{"operationId":"createConnectSession","tags":["Connections"],"summary":"Start a hosted connect session","description":"A link (`url`, a bearer for 10 minutes, or for `ttl_seconds`: 5 to 60 minutes) to send your user to. The redirect to `return_url` is a convenience for the person's browser: anyone can open that address with any parameters, so act on the `connection.connected` webhook or on getConnectSession / getConnection, never on the query string alone. They sign in with Programmable, then enter a key or consent on our page; keys never pass through your app. Then their browser returns to `return_url` with `result=connected|failed`, `connection=<id>` and, on failure, `error=<code>` (cancelled, expired, access_denied, provider_failed, bad_config, save_failed, connection_limit, record_changed, account_mismatch). `return_url`'s origin must be one of your app's return origins. Set `expected_email` so only that person can use the link. `source: record` connects a provider from GET /v1/providers; `catalog_entry_id` connects an MCP server from the catalogue.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"201":{"description":"Created (200 when it already existed, for the upsert operations).","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"The session's id, for GET / DELETE and the connect_session.* webhooks.","format":"uuid"},"url":{"type":"string"},"expires_at":{"type":"string","format":"date-time"}},"required":["id","url","expires_at"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_CONNECTION","BAD_CONFIG","BAD_RETURN_URL","BAD_SCOPES","SOURCE_MISMATCH","CONNECTION_LIMIT","NOT_CONNECTED","RECORD_NOT_LIVE","NO_CLIENT","OWN_CLIENT_REQUIRED","REDIRECT_MISMATCH","NO_CLIENT_KEY","CUSTOMER_HOST_TYPED","NOT_CANONICAL_HOST","COMPOSIO_OFF","PLATFORM_KEYS_LOCKED","NO_CATALOG_ENTRY","NOT_REMOTE","NOT_CONNECTABLE","UNSAFE_URL","NOT_SUPPORTED","COMMUNITY_NOT_ACCEPTED","METADATA_LIMIT"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string","enum":["mcp","builtin","composio","record"]},"provider":{"type":"string","minLength":1,"maxLength":120},"label":{"type":"string","minLength":1,"maxLength":120},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"return_url":{"type":"string","maxLength":2048},"connection_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"catalog_entry_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"accept_community":{"type":"boolean"},"expected_email":{"type":"string","maxLength":254,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"ttl_seconds":{"description":"How long the link works, in seconds. Left out: 600 (ten minutes). A longer link suits one sent by email or opened on a phone; pin it with expected_email.","type":"integer","minimum":300,"maximum":3600},"add_scopes":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string","minLength":1,"maxLength":300}},"metadata":{"description":"Your own key/value pairs, copied onto the connection when the session connects. With connection_id they are merged over its metadata (keys added or overwritten, none removed; without metadata it is left as it is); 400 METADATA_LIMIT when the merge would not fit. Never shown to the person, sent to the service or put in events. Not for secrets.","type":"object","propertyNames":{"type":"string","pattern":"^[A-Za-z0-9_.-]{1,64}$"},"additionalProperties":{"type":"string","maxLength":512}}},"required":["return_url"],"additionalProperties":false}}}}}},"/v1/tenants/{tenant}/connect-sessions/{session}":{"get":{"operationId":"getConnectSession","tags":["Connections"],"summary":"Get a connect session's status","description":"How a session stands, so you need not rely on the browser coming back: open, claimed, completed, failed, cancelled or expired, with a fixed `error_code` when it ended without connecting and the `connection_id` once connected (or from the start, for a re-authorisation). You also get connect_session.failed / .cancelled / .expired webhooks. Another tenant's or app's id is a 404, like an unknown one.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"session","in":"path","required":true,"description":"A connect session id (uuid): the `id` POST /v1/tenants/{tenant}/connect-sessions returned.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"connect_session":{"$ref":"#/components/schemas/ConnectSession"}},"required":["connect_session"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_CONNECT_SESSION"]},"delete":{"operationId":"cancelConnectSession","tags":["Connections"],"summary":"Cancel a connect session","description":"The link stops working at once and no sign-in already out at the provider can finish it; a connection it had started is removed (an existing one it re-authorised is left as it was). Sends connect_session.cancelled. Safe to retry: a cancelled session comes back as it is with `cancelled: false`. 409 SESSION_COMPLETED once it connected, failed or expired; 409 SESSION_FINISHING while the person's key is being saved (ask again in a moment). A sign-in that comes back after the cancel stores nothing, or, if it was a moment ahead, the connection it made is deleted again (revoked); a re-authorisation that was a moment ahead keeps its new tokens.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"session","in":"path","required":true,"description":"A connect session id (uuid): the `id` POST /v1/tenants/{tenant}/connect-sessions returned.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"connect_session":{"$ref":"#/components/schemas/ConnectSession"},"cancelled":{"type":"boolean","description":"This call cancelled it (false: it already was)."}},"required":["connect_session","cancelled"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_CONNECT_SESSION","SESSION_COMPLETED","SESSION_FINISHING"]}},"/v1/tenants/{tenant}/connections":{"get":{"operationId":"listConnections","tags":["Connections"],"summary":"List a tenant's connections","description":"Status, scopes, last error and your metadata of every connection. Never a secret. Filter by metadata with `metadata[key]=value` (exact match; up to 5, all must match): `?metadata[user_id]=u_42`. A malformed or repeated filter is 400 BAD_FILTER, never ignored.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"metadata","in":"query","required":false,"description":"Only connections whose metadata has every one of these pairs (sent as metadata[key]=value; up to 5).","style":"deepObject","explode":true,"schema":{"type":"object","additionalProperties":{"type":"string"}}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Connection"}}},"required":["items"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","BAD_FILTER"]},"post":{"operationId":"createConnection","tags":["Connections"],"summary":"Create a connection without a person","description":"Only the non-interactive kinds: a builtin with its key (web_search, web_reader, apify) or a static-token MCP server. The secret is write-only. Anything that needs someone to sign in goes through a connect session (400 NEEDS_SESSION). A tenant holds at most 100 connections. Sends `connection.connected` with kind `new`.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"201":{"description":"Created (200 when it already existed, for the upsert operations).","content":{"application/json":{"schema":{"type":"object","properties":{"connection":{"$ref":"#/components/schemas/Connection"}},"required":["connection"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"The workspace's own secret store could not be used; nothing was stored.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","BAD_CONFIG","SECRET_REQUIRED","NEEDS_SESSION","CONNECTION_LIMIT","CREDENTIAL_STORE_UNAVAILABLE"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string","enum":["mcp","builtin"]},"provider":{"type":"string","minLength":1,"maxLength":120},"label":{"type":"string","minLength":1,"maxLength":120},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"secret":{"type":"string","maxLength":4096},"metadata":{"description":"Your own key/value pairs for the connection (strings). Returned on every read and filterable with metadata[key]=value; never shown to the person, sent to the service or put in events. Not for secrets.","type":"object","propertyNames":{"type":"string","pattern":"^[A-Za-z0-9_.-]{1,64}$"},"additionalProperties":{"type":"string","maxLength":512}}},"required":["source"],"additionalProperties":false}}}}}},"/v1/connections":{"get":{"operationId":"searchConnections","tags":["Connections"],"summary":"Search your app's connections","description":"Your app's connections across all its tenants, newest first, each with its `tenant`. For questions like \"which customers must sign in to Slack again\": `?provider=slack&status=needs_reauth`. Every filter is an exact match and all of them must hold; a filter that is not listed here, or a value it cannot take, is 400 BAD_FILTER, never ignored. `next` is the cursor for the following page (null at the end). Never a secret. A key reads only its own mode's tenants (test or live); a tenant-scoped key only its own tenant's.","parameters":[{"name":"tenant","in":"query","required":false,"description":"Only this tenant's connections (your tenant id).","schema":{"type":"string"}},{"name":"provider","in":"query","required":false,"description":"Only this provider, as a connection shows it (`slack`, `github`, …).","schema":{"type":"string","minLength":1,"maxLength":120}},{"name":"source","in":"query","required":false,"description":"Only connections of this kind.","schema":{"type":"string","enum":["mcp","builtin","composio","record"]}},{"name":"status","in":"query","required":false,"description":"Only connections in this status.","schema":{"type":"string","enum":["pending","connected","needs_reauth","failed","disabled"]}},{"name":"account_fingerprint","in":"query","required":false,"description":"Only connections signed in as this provider account (a connection's `account_fingerprint`): the same account connected more than once.","schema":{"type":"string","pattern":"^[0-9a-f]{32}$"}},{"name":"metadata","in":"query","required":false,"description":"Only connections whose metadata has every one of these pairs (sent as metadata[key]=value; up to 5).","style":"deepObject","explode":true,"schema":{"type":"object","additionalProperties":{"type":"string"}}},{"name":"limit","in":"query","required":false,"description":"Default 50.","schema":{"type":"integer","minimum":1,"maximum":200}},{"name":"before","in":"query","required":false,"description":"The `next` cursor from the previous page.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Connection"}},"next":{"type":["string","null"],"description":"The cursor for the following page; null at the end."}},"required":["items","next"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","BAD_FILTER"]}},"/v1/tenants/{tenant}/connections/import":{"post":{"operationId":"importConnection","tags":["Connections"],"summary":"Import an existing OAuth grant","description":"Moves a grant the person already gave elsewhere into a record connection, without a new sign-in. For the platform's own apps only, and off unless switched on for this service. The refresh token is used at the provider before anything is stored, and is write-only: never logged or returned. Answers 201 with `imported: true`, or 200 with `imported: false` and the existing connection when the tenant already has a connected one for that provider. At most 60 imports a minute per app.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"201":{"description":"Created (200 when it already existed, for the upsert operations).","content":{"application/json":{"schema":{"type":"object","properties":{"connection":{"$ref":"#/components/schemas/Connection"},"imported":{"type":"boolean"}},"required":["connection","imported"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","IMPORT_DISABLED","IMPORT_NOT_ALLOWED","RECORD_NOT_LIVE","NO_CLIENT","OWN_CLIENT_REQUIRED","IMPORT_UNSUPPORTED","CONNECTION_LIMIT","IMPORT_REFRESH_REFUSED","IMPORT_TRANSIENT"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","pattern":"^[a-z0-9_]{1,64}$"},"refresh_token":{"type":"string","minLength":1,"maxLength":4096,"pattern":"^\\S+$"},"scope":{"type":"string","maxLength":2000},"label":{"type":"string","minLength":1,"maxLength":120},"imported_from":{"type":"string","minLength":1,"maxLength":40}},"required":["provider","refresh_token"],"additionalProperties":false}}}}}},"/v1/tenants/{tenant}/connections/{connection}":{"get":{"operationId":"getConnection","tags":["Connections"],"summary":"Get a connection","description":"One connection. Another tenant's or app's id is a 404, like an unknown one.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"connection","in":"path","required":true,"description":"A connection id (uuid).","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"connection":{"$ref":"#/components/schemas/Connection"}},"required":["connection"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_CONNECTION"]},"patch":{"operationId":"updateConnection","tags":["Connections"],"summary":"Rename a connection or change its metadata","description":"Send `label`, `metadata` or both. `label` (1-120 characters) changes only what people see: the connection's tool names stay as they are (a tool prefix is fixed when it is first claimed). `metadata` is your own key/value pairs: `metadata_mode: \"merge\"` (the default) sets the keys you send and deletes those sent as null; `\"replace\"` makes the metadata exactly what you send. The result must stay within 20 keys (1-64 of A-Z a-z 0-9 _ . -, not __proto__), values of at most 512 characters and 4096 bytes of JSON (400 METADATA_LIMIT). Never put a secret in metadata: it is returned on every read.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"connection","in":"path","required":true,"description":"A connection id (uuid).","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"connection":{"$ref":"#/components/schemas/Connection"}},"required":["connection"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_CONNECTION","BAD_CONFIG","METADATA_LIMIT"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"description":"A new label (what people see). The connection's tool names stay as they are.","type":"string","minLength":1,"maxLength":120},"metadata":{"description":"Keys to set (strings) or, in merge mode, delete (null).","type":"object","propertyNames":{"type":"string","pattern":"^[A-Za-z0-9_.-]{1,64}$"},"additionalProperties":{"anyOf":[{"type":"string","maxLength":512},{"type":"null"}]}},"metadata_mode":{"description":"merge (default) or replace.","type":"string","enum":["merge","replace"]}},"additionalProperties":false}}}}},"delete":{"operationId":"deleteConnection","tags":["Connections"],"summary":"Delete a connection","description":"Revokes it at the provider (best effort), then deletes it with its tokens. Sends connection.revoked.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"connection","in":"path","required":true,"description":"A connection id (uuid).","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"revoked_remote":{"type":"boolean","description":"The provider confirmed the revoke."}},"required":["ok","revoked_remote"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_CONNECTION"]}},"/v1/tenants/{tenant}/connections/{connection}/health":{"get":{"operationId":"getConnectionHealth","tags":["Connections"],"summary":"How a connection is doing","description":"Computed status (ok, expiring, needs_reauth, error), last refresh and use, last error, scopes, expiry and the background refresh's attempts. Never a token.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"connection","in":"path","required":true,"description":"A connection id (uuid).","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"health":{"$ref":"#/components/schemas/ConnectionHealth"}},"required":["health"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_CONNECTION"]}},"/v1/tenants/{tenant}/connections/{connection}/test":{"post":{"operationId":"testConnection","tags":["Connections"],"summary":"Check a connection now","description":"A light check: a provider connection refreshes if needed and makes its read call; other sources list their tools. Nothing is sent for a connection that is not connected (`ok: false`).","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"connection","in":"path","required":true,"description":"A connection id (uuid).","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"steps":{"type":"array","items":{"type":"string"}},"health":{"$ref":"#/components/schemas/ConnectionHealth"}},"required":["ok","steps","health"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_CONNECTION","RATE_LIMITED"]}},"/v1/tenants/{tenant}/connections/{connection}/tool-changes":{"get":{"operationId":"reviewToolChanges","tags":["Connections"],"summary":"What changed in a connection's tool definitions","description":"For a connection to an outside server (MCP or Composio). Lists the server's tools afresh and returns every tool whose definition is no longer the one that was accepted, or that is new since the grant was set: the description and title before and after, changed hints, a summary of the schema's top-level arguments, and the `fingerprint` of the definition shown. Show this to a person before accepting. For a provider or built-in connection `pinned` is false and the lists are empty.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"connection","in":"path","required":true,"description":"A connection id (uuid).","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToolChangeReview"}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_CONNECTION","NOT_CONNECTED","UNAVAILABLE","RATE_LIMITED"]},"post":{"operationId":"acceptToolChanges","tags":["Connections"],"summary":"Accept changed tool definitions","description":"Accepts exactly the definitions you were shown: send each tool with the `fingerprint` from the review. The server's tools are listed afresh and compared; if any of them changed again (or is gone), nothing is accepted and the answer is 409 TOOL_CHANGED_AGAIN. Accepted tools are offered again at once, for every grant on the connection.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"connection","in":"path","required":true,"description":"A connection id (uuid).","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/ToolChangeReview"},{"type":"object","properties":{"accepted":{"type":"array","items":{"type":"string"},"description":"The tool names accepted."}},"required":["accepted"]}]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_CONNECTION","NOT_PINNED","BAD_REQUEST","NOT_CONNECTED","UNAVAILABLE","TOOL_CHANGED_AGAIN","RATE_LIMITED"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tools":{"minItems":1,"maxItems":400,"type":"array","items":{"type":"object","properties":{"tool":{"type":"string","minLength":1,"maxLength":200},"fingerprint":{"type":"string","pattern":"^[0-9a-f]{64}$"}},"required":["tool","fingerprint"],"additionalProperties":false}}},"required":["tools"],"additionalProperties":false}}}}}},"/v1/tenants/{tenant}/connections/{connection}/events":{"get":{"operationId":"getConnectionEvents","tags":["Connections"],"summary":"Which provider events a connection forwards","description":"The provider event types this connection sends you as `provider.event` webhooks. Off by default.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"connection","in":"path","required":true,"description":"A connection id (uuid).","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"$ref":"#/components/schemas/EventSubscription"}},"required":["events"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_CONNECTION"]},"put":{"operationId":"setConnectionEvents","tags":["Connections"],"summary":"Choose the provider events a connection forwards","description":"Replaces the list (`[]` = off, `\"*\"` = every type). Provider connections only (400 NOT_SUPPORTED otherwise). `sync_reply` lets this connection answer the record's synchronous event types.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"connection","in":"path","required":true,"description":"A connection id (uuid).","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"$ref":"#/components/schemas/EventSubscription"}},"required":["events"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_CONNECTION","NOT_SUPPORTED"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"types":{"maxItems":50,"type":"array","items":{"type":"string"}},"sync_reply":{"type":"boolean"}},"required":["types"],"additionalProperties":false}}}}}},"/v1/providers":{"get":{"operationId":"listProviders","tags":["Providers"],"summary":"List the providers your users can connect","description":"The live provider records in a public shape: what a \"Connect X\" picker needs. A weak ETag covers the set; send If-None-Match to get 304. Cached privately for 60 seconds. Grey out a provider with `connectable: false`.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Provider"}}},"required":["items"]}}}},"304":{"description":"Not modified since the ETag you sent."},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":[]}},"/v1/providers/{provider}":{"get":{"operationId":"getProvider","tags":["Providers"],"summary":"Get one provider","description":"One live provider record. 404 for an unknown id or a record that is not live.","parameters":[{"name":"provider","in":"path","required":true,"description":"A provider record id, as in GET /v1/providers.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"$ref":"#/components/schemas/Provider"}},"required":["provider"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_PROVIDER"]}},"/v1/app/rate-limits":{"get":{"operationId":"getRateLimits","tags":["Rate limits"],"summary":"Your app's calls-a-minute ceilings","description":"Your own numbers, what is in force, and the platform's ceiling.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"rate_limits":{"$ref":"#/components/schemas/AppRateLimits"}},"required":["rate_limits"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":[]},"put":{"operationId":"setRateLimits","tags":["Rate limits"],"summary":"Set calls-a-minute ceilings","description":"Optional ceilings on tool calls (MCP and REST) and proxy calls a minute, for the whole app and for each tenant. Each field: 1 to 100000, null to clear, left out to keep. You can lower your app's ceiling but not lift it past the platform's (`platform` in the answer). A call over a ceiling is refused before anything is sent: a tool call answers `blocked` with reason `rate_limited` and `retry_after_s`, a proxy call 429 `RATE_LIMITED` with `Retry-After`. Refused calls are not charged and do not count against daily caps. Minutes are counted one by one (fixed windows), so a burst across the turn of a minute can briefly reach twice a ceiling. A live key only.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"rate_limits":{"$ref":"#/components/schemas/AppRateLimits"}},"required":["rate_limits"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["TEST_KEY"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tool_calls_per_minute":{"description":"Tool calls a minute for the whole app (MCP and REST). null = the platform's ceiling.","anyOf":[{"type":"integer","minimum":1,"maximum":100000},{"type":"null"}]},"proxy_calls_per_minute":{"description":"Proxy calls a minute for the whole app. null = the platform's ceiling.","anyOf":[{"type":"integer","minimum":1,"maximum":100000},{"type":"null"}]},"tenant_tool_calls_per_minute":{"description":"Tool calls a minute for each tenant. null = no per-tenant ceiling.","anyOf":[{"type":"integer","minimum":1,"maximum":100000},{"type":"null"}]},"tenant_proxy_calls_per_minute":{"description":"Proxy calls a minute for each tenant. null = no per-tenant ceiling.","anyOf":[{"type":"integer","minimum":1,"maximum":100000},{"type":"null"}]}},"additionalProperties":false}}}}}},"/v1/tenants/{tenant}/rate-limits":{"get":{"operationId":"getTenantRateLimits","tags":["Rate limits"],"summary":"One tenant's ceilings","description":"The tenant's own numbers and what is in force for it.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"rate_limits":{"$ref":"#/components/schemas/TenantRateLimits"}},"required":["rate_limits"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT"]},"put":{"operationId":"setTenantRateLimits","tags":["Rate limits"],"summary":"Give one tenant its own ceilings","description":"Instead of your per-tenant numbers. null goes back to them. Never above your app's ceiling.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"rate_limits":{"$ref":"#/components/schemas/TenantRateLimits"}},"required":["rate_limits"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tool_calls_per_minute":{"description":"null = the app's per-tenant ceiling.","anyOf":[{"type":"integer","minimum":1,"maximum":100000},{"type":"null"}]},"proxy_calls_per_minute":{"description":"null = the app's per-tenant ceiling.","anyOf":[{"type":"integer","minimum":1,"maximum":100000},{"type":"null"}]}},"additionalProperties":false}}}}}},"/v1/app/proxy":{"get":{"operationId":"getProxySettings","tags":["Proxy"],"summary":"Is the proxy on for your app","description":"The proxy is off until you turn it on. `admin_locked`: a platform admin turned it off and only they can turn it on.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"proxy":{"$ref":"#/components/schemas/ProxySettings"}},"required":["proxy"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":[]},"put":{"operationId":"setProxySettings","tags":["Proxy"],"summary":"Turn the proxy on or off","description":"Also sets the default daily cap per connection (default 1000).","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"proxy":{"$ref":"#/components/schemas/ProxySettings"}},"required":["proxy"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["PROXY_LOCKED"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"daily_call_cap":{"type":"integer","minimum":0,"maximum":100000}},"additionalProperties":false}}}}}},"/v1/tenants/{tenant}/connections/{connection}/proxy/rules":{"get":{"operationId":"getProxyRules","tags":["Proxy"],"summary":"A connection's proxy rules","description":"The paths the proxy may call on this connection, and its own daily cap.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"connection","in":"path","required":true,"description":"A connection id (uuid).","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"rules":{"$ref":"#/components/schemas/ProxyRules"}},"required":["rules"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_CONNECTION","NOT_RECORD_CONNECTION"]},"put":{"operationId":"setProxyRules","tags":["Proxy"],"summary":"Narrow the proxy on a connection","description":"`allow` entries are \"METHOD /prefix\" (METHOD is GET, POST, PUT, PATCH, DELETE or *; at most 50). The prefix is a plain string prefix, so write `GET /repos/` to mean under /repos/. `null` = no path restriction, `[]` = nothing. `daily_call_cap: null` = the app's default.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"connection","in":"path","required":true,"description":"A connection id (uuid).","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"rules":{"$ref":"#/components/schemas/ProxyRules"}},"required":["rules"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_CONNECTION","NOT_RECORD_CONNECTION","BAD_RULE","PROXY_LOCKED"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"allow":{"anyOf":[{"maxItems":50,"type":"array","items":{"type":"string","maxLength":2010}},{"type":"null"}]},"daily_call_cap":{"anyOf":[{"type":"integer","minimum":0,"maximum":100000},{"type":"null"}]}},"required":["allow"],"additionalProperties":false}}}}}},"/v1/tenants/{tenant}/connections/{connection}/proxy":{"post":{"operationId":"proxyRequest","tags":["Proxy"],"summary":"Call a provider's API through a connection","description":"For your own server code. We add the connection's credential and send the request to the provider; you never see the token or key. `path` is relative to the provider's api_base_url and its host must be on the provider's allowed_hosts. Forwarded caller headers: Accept, Content-Type, If-Match, If-None-Match. Request body up to 1 MB, answer read to 2 MB, 25 seconds, redirects never followed. After a 401 an OAuth token is refreshed once and the request retried once. 120 calls per connection per minute, plus a daily cap, plus your app's and tenant's calls-a-minute ceilings (429 `RATE_LIMITED` with `Retry-After`). When the provider's host keeps failing (timeouts, dropped connections, 5xx), calls to it are refused at once for a short while with 503 `PROVIDER_UNAVAILABLE` and `Retry-After`: nothing is sent, nothing is capped or charged. Safe retries: send the request header `Idempotency-Key` (1 to 255 of letters, digits, `_ - : .`) with any request that is not a GET. A repeat of the same request under the same key within 24 hours returns the first answer (`replayed: true`, response header `Idempotent-Replayed: true`) without calling the provider, and is not capped or charged. A different request under the key is 409 `IDEMPOTENCY_KEY_REUSED`; a repeat while the first is running is 409 `IDEMPOTENCY_IN_FLIGHT` with `Retry-After`; an answer over 256 KB is returned once and repeats are 409 `IDEMPOTENCY_RESULT_TOO_LARGE`; when the request was sent but no answer came back, repeats are 409 `IDEMPOTENCY_OUTCOME_UNKNOWN` (it may have run: check at the provider, then use a new key). The key is ignored on a GET. For providers whose API has its own idempotency key (Stripe), a POST also carries one derived from yours.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"connection","in":"path","required":true,"description":"A connection id (uuid).","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProxyResult"}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"The provider could not be reached or answered too late.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["BAD_IDEMPOTENCY_KEY","IDEMPOTENCY_KEY_REUSED","IDEMPOTENCY_IN_FLIGHT","IDEMPOTENCY_RESULT_TOO_LARGE","IDEMPOTENCY_OUTCOME_UNKNOWN","PROVIDER_UNAVAILABLE","NO_TENANT","BILLING_REQUIRED","PROXY_DISABLED","PATH_NOT_ALLOWED","NO_CONNECTION","NOT_RECORD_CONNECTION","NOT_CONNECTED","NEEDS_REAUTH","UNAVAILABLE","NO_API_BASE","BAD_REQUEST","BAD_PATH","BAD_HEADER","BAD_BODY","METHOD_OVERRIDE","HOST_NOT_ALLOWED","BODY_TOO_LARGE","RATE_LIMITED","DAILY_CAP","UPSTREAM_FAILED","REFRESH_FAILED","UPSTREAM_TIMEOUT"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"]},"path":{"type":"string","maxLength":2000},"query":{"type":"object","propertyNames":{"type":"string","pattern":"^[A-Za-z0-9_.\\-[\\]:~]{1,100}$"},"additionalProperties":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"},{"maxItems":50,"type":"array","items":{"anyOf":[{"type":"string","maxLength":2000},{"type":"number"},{"type":"boolean"}]}}]}},"headers":{"type":"object","propertyNames":{"type":"string","maxLength":100},"additionalProperties":{"type":"string","maxLength":1000}},"body":{"type":"string"},"body_encoding":{"type":"string","enum":["utf8","base64"]}},"required":["method","path"],"additionalProperties":false}}}}}},"/v1/app/history":{"get":{"operationId":"getHistorySettings","tags":["Call history"],"summary":"How much of each call your app keeps, and for how long","description":"The default is `summary` for 90 days.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"history":{"$ref":"#/components/schemas/HistorySettings"}},"required":["history"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":[]},"put":{"operationId":"setHistorySettings","tags":["Call history"],"summary":"Choose how much of each call to keep, and for how long","description":"`keep`: `summary` or `full`. `days`: 30 to 400 (a call's row itself is deleted after 400 days). Send either or both; what you leave out stays. A live key only. `full` applies to calls made from now on and never overrides a grant: a grant with `payload` `result_only` keeps no input, and `none` keeps nothing. Going back to `summary` stops new full content at once; what was kept stays until its days run out, or you delete the tenant or actor. A shorter `days` clears older content at the next daily clean-up.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"history":{"$ref":"#/components/schemas/HistorySettings"}},"required":["history"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"keep":{"type":"string","enum":["summary","full"]},"days":{"type":"integer","minimum":30,"maximum":400}},"additionalProperties":false}}}}}},"/v1/app/default-grants":{"get":{"operationId":"getDefaultGrants","tags":["Grants and tools"],"summary":"Your app's default grant policy","description":"Off until you turn it on.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"default_grants":{"$ref":"#/components/schemas/DefaultGrants"}},"required":["default_grants"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":[]},"put":{"operationId":"setDefaultGrants","tags":["Grants and tools"],"summary":"Give every actor a default grant on every connection of its tenant","description":"For apps whose actors are a person's agents: on, every actor gets a grant on every connected connection of its tenant, made by Dev when the actor is created and when a connection is first connected, so you never re-send grants when someone connects something. A default never changes a grant that exists: what your app or a person set wins, and a grant that was removed is not brought back when its connection is signed in again. Default grants show `source: \"default\"` until someone sets them. A default must ask (or block) before write and destructive calls (400 `UNSAFE_DEFAULT` otherwise); it always has approval on. Changing it brings grants still `source: \"default\"` to the new policy at once (within each tenant's own, `PUT /v1/tenants/:t/default-grants`). Send `{ \"policy\": null }` to turn it off: new defaults stop, the grants already made stay. A live key only.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"default_grants":{"$ref":"#/components/schemas/DefaultGrants"}},"required":["default_grants"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["UNSAFE_DEFAULT"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"policy":{"anyOf":[{"type":"object","properties":{"kind_policy":{"type":"object","properties":{"read":{"type":"string","enum":["allow","ask","block"]},"write":{"type":"string","enum":["allow","ask","block"]},"destructive":{"type":"string","enum":["allow","ask","block"]}},"required":["read","write","destructive"],"additionalProperties":false},"daily_call_cap":{"type":"integer","minimum":0,"maximum":100000},"daily_spend_cap_usd":{"anyOf":[{"type":"number","minimum":0,"maximum":100000},{"type":"null"}]},"payload":{"type":"string","enum":["full","result_only","none"]}},"required":["kind_policy"],"additionalProperties":false},{"type":"null"}]}},"required":["policy"],"additionalProperties":false}}}}}},"/v1/tenants/{tenant}/default-grants":{"get":{"operationId":"getTenantDefaultGrants","tags":["Grants and tools"],"summary":"A tenant's default grant policy, and what is in force","description":"`policy`: the tenant's own (null = your app's applies). `effective`: what new and default grants in this tenant get now (the stricter of the two, field by field; null while your app's policy is off). `app`: your app's, the ceiling.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"default_grants":{"$ref":"#/components/schemas/TenantDefaultGrants"}},"required":["default_grants"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT"]},"put":{"operationId":"setTenantDefaultGrants","tags":["Grants and tools"],"summary":"Set a tenant's own default grant policy, under your app's","description":"For one person's \"what my agents may do without asking\". Same shape as your app's. It may be stricter than your app's, or as loose, never looser: per kind block < ask < allow, the daily call cap no higher, the spend cap no higher when your app sets one (400 `ABOVE_APP_DEFAULT`). Write and destructive still ask or block (400 `UNSAFE_DEFAULT`). Needs your app's policy on (409 `DEFAULTS_OFF`). The tenant's grants still `source: \"default\"` follow it at once; grants someone set are never touched. `{ \"policy\": null }` goes back to your app's. A tenant-scoped key can read but not change it (403 `KEY_SCOPED`).","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"default_grants":{"$ref":"#/components/schemas/TenantDefaultGrants"}},"required":["default_grants"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","KEY_SCOPED","UNSAFE_DEFAULT","ABOVE_APP_DEFAULT","DEFAULTS_OFF"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"policy":{"anyOf":[{"type":"object","properties":{"kind_policy":{"type":"object","properties":{"read":{"type":"string","enum":["allow","ask","block"]},"write":{"type":"string","enum":["allow","ask","block"]},"destructive":{"type":"string","enum":["allow","ask","block"]}},"required":["read","write","destructive"],"additionalProperties":false},"daily_call_cap":{"type":"integer","minimum":0,"maximum":100000},"daily_spend_cap_usd":{"anyOf":[{"type":"number","minimum":0,"maximum":100000},{"type":"null"}]},"payload":{"type":"string","enum":["full","result_only","none"]}},"required":["kind_policy"],"additionalProperties":false},{"type":"null"}]}},"required":["policy"],"additionalProperties":false}}}}}},"/v1/app/token-read":{"get":{"operationId":"getTokenReadSettings","tags":["Token read"],"summary":"Is token read on for your app","description":"Token read is off until you turn it on.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"token_read":{"$ref":"#/components/schemas/TokenReadSettings"}},"required":["token_read"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":[]},"put":{"operationId":"setTokenReadSettings","tags":["Token read"],"summary":"Turn token read on or off","description":"403 TOKEN_READ_LOCKED while a platform admin's \"off\" stands.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"token_read":{"$ref":"#/components/schemas/TokenReadSettings"}},"required":["token_read"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["TOKEN_READ_LOCKED"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"],"additionalProperties":false}}}}}},"/v1/tenants/{tenant}/connections/{connection}/token":{"post":{"operationId":"readAccessToken","tags":["Token read"],"summary":"Read a connection's OAuth access token","description":"For server code that must hold the token itself. The current access token of a provider connection that signs in with OAuth, refreshed first when under 5 minutes are left. Never the refresh token, never a pasted key, and never a token minted with our platform client (use the proxy for those). Prefer the proxy where it fits. 60 reads per connection per minute; every read is audited. The body is optional. `force_refresh: true` is for when the provider no longer takes the token you hold (revoked or rotated on their side while it still had time left): it is refreshed now. A token refreshed or issued in the last 30 seconds is returned as it is (`refreshed: false`), so several callers that saw the same rejection cause one refresh; at most 12 forced refreshes per connection an hour (429 RATE_LIMITED). A connection with no refresh token answers 409 UNAVAILABLE and stays connected; a refresh the provider refuses is 409 NEEDS_REAUTH, as for any read. A read follows your app's billing like a tool call: once the trial is over or the plan has ended it answers 402 BILLING_REQUIRED and hands out no token. A read is never counted or billed as a call.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"connection","in":"path","required":true,"description":"A connection id (uuid).","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccessToken"}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"5XX":{"description":"The provider could not be reached or answered too late.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","TOKEN_READ_DISABLED","NO_CONNECTION","NOT_RECORD_CONNECTION","NOT_CONNECTED","NEEDS_REAUTH","NOT_OAUTH","PLATFORM_CLIENT","UNAVAILABLE","RATE_LIMITED","REFRESH_FAILED","BILLING_REQUIRED"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"force_refresh":{"type":"boolean"}},"additionalProperties":false}}}}}},"/v1/tenants/{tenant}/actors/{actor}/grants":{"get":{"operationId":"listGrants","tags":["Grants and tools"],"summary":"An actor's grants","description":"Which connections (and which of their tools) this agent may use, with caps and approval settings.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"actor","in":"path","required":true,"description":"Your own actor (agent) id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"grants":{"type":"array","items":{"$ref":"#/components/schemas/Grant"}}},"required":["grants"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_ACTOR"]},"put":{"operationId":"setGrants","tags":["Grants and tools"],"summary":"Replace an actor's grants","description":"Replaces the whole set (`[]` removes every grant). Defaults: daily_call_cap 20, requires_approval true. `approve_by_link` also sends each approval to an email address or mobile number as a page anyone holding the link can decide; left out, a grant keeps its current target (GET shows it masked), `null` turns it off, and `requires_approval: false` drops it. Finer rules, all optional and all replaced with the set: `kind_policy` (reads / writes / destructive calls each allow, ask or block), `tool_rules` (per tool: its kind, action, own daily cap, argument limits, payload, result masking and filtering), `resources` (argument limits by name for every tool), `resources_strict` (offer only the tools every one of those limits is required on),`daily_spend_cap_usd`, `payload`, `expires_at` (a future time; the grant then gives nothing), `trust_read_hints`, `mcp_resources`, `mcp_prompts` and `mcp_ui` (open an MCP server's resources / prompt templates / app UI to the actor; default false).","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"actor","in":"path","required":true,"description":"Your own actor (agent) id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"grants":{"type":"array","items":{"$ref":"#/components/schemas/Grant"}}},"required":["grants"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_ACTOR","NO_CONNECTION","DUPLICATE","TOO_MANY","BAD_ID","BAD_GRANT","LINK_OFF","BAD_LINK","LINK_NOT_ALLOWED"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"grants":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"connection_id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"},"tools":{"anyOf":[{"maxItems":100,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},{"type":"null"}]},"daily_call_cap":{"type":"integer","minimum":0,"maximum":100000},"requires_approval":{"type":"boolean"},"approve_by_link":{"anyOf":[{"type":"object","properties":{"to":{"type":"string","minLength":3,"maxLength":254}},"required":["to"],"additionalProperties":false},{"type":"null"}]},"kind_policy":{"anyOf":[{"type":"object","properties":{"read":{"type":"string","enum":["allow","ask","block"]},"write":{"type":"string","enum":["allow","ask","block"]},"destructive":{"type":"string","enum":["allow","ask","block"]}},"required":["read","write","destructive"],"additionalProperties":false},{"type":"null"}]},"trust_read_hints":{"type":"boolean"},"tool_rules":{"anyOf":[{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":200},"additionalProperties":{"type":"object","properties":{"kind":{"type":"string","enum":["read","write","destructive"]},"action":{"type":"string","enum":["allow","ask","block"]},"daily_call_cap":{"type":"integer","minimum":0,"maximum":100000},"payload":{"type":"string","enum":["full","result_only","none"]},"result":{"type":"object","properties":{"mask":{"minItems":1,"maxItems":30,"type":"array","items":{"type":"string","pattern":"^[A-Za-z_][A-Za-z0-9_-]{0,63}(\\.[A-Za-z_][A-Za-z0-9_-]{0,63}){0,5}$"}},"keep":{"type":"object","properties":{"list":{"type":"string","pattern":"^[A-Za-z_][A-Za-z0-9_-]{0,63}(\\.[A-Za-z_][A-Za-z0-9_-]{0,63}){0,5}$"},"field":{"type":"string","pattern":"^[A-Za-z_][A-Za-z0-9_-]{0,63}(\\.[A-Za-z_][A-Za-z0-9_-]{0,63}){0,5}$"},"equals":{"anyOf":[{"type":"string","maxLength":500},{"type":"number"},{"type":"boolean"}]},"one_of":{"minItems":1,"maxItems":50,"type":"array","items":{"anyOf":[{"type":"string","maxLength":500},{"type":"number"},{"type":"boolean"}]}},"starts_with":{"type":"string","minLength":1,"maxLength":500},"ends_with":{"type":"string","minLength":1,"maxLength":500}},"required":["field"],"additionalProperties":false}},"additionalProperties":false},"args":{"type":"object","propertyNames":{"type":"string","pattern":"^[A-Za-z_][A-Za-z0-9_-]{0,63}(\\.[A-Za-z_][A-Za-z0-9_-]{0,63}){0,3}$"},"additionalProperties":{"type":"object","properties":{"required":{"type":"boolean"},"equals":{"anyOf":[{"type":"string","maxLength":500},{"type":"number"},{"type":"boolean"}]},"one_of":{"minItems":1,"maxItems":50,"type":"array","items":{"anyOf":[{"type":"string","maxLength":500},{"type":"number"},{"type":"boolean"}]}},"starts_with":{"type":"string","minLength":1,"maxLength":500},"ends_with":{"type":"string","minLength":1,"maxLength":500},"min":{"type":"number"},"max":{"type":"number"},"max_length":{"type":"integer","minimum":0,"maximum":1000000}},"additionalProperties":false}}},"additionalProperties":false}},{"type":"null"}]},"resources":{"anyOf":[{"type":"object","propertyNames":{"type":"string","pattern":"^[A-Za-z_][A-Za-z0-9_-]{0,63}$"},"additionalProperties":{"type":"object","properties":{"required":{"type":"boolean"},"equals":{"anyOf":[{"type":"string","maxLength":500},{"type":"number"},{"type":"boolean"}]},"one_of":{"minItems":1,"maxItems":50,"type":"array","items":{"anyOf":[{"type":"string","maxLength":500},{"type":"number"},{"type":"boolean"}]}},"starts_with":{"type":"string","minLength":1,"maxLength":500},"ends_with":{"type":"string","minLength":1,"maxLength":500},"min":{"type":"number"},"max":{"type":"number"},"max_length":{"type":"integer","minimum":0,"maximum":1000000}},"additionalProperties":false}},{"type":"null"}]},"resources_strict":{"type":"boolean"},"daily_spend_cap_usd":{"anyOf":[{"type":"number","minimum":0,"maximum":100000},{"type":"null"}]},"payload":{"type":"string","enum":["full","result_only","none"]},"mcp_resources":{"type":"boolean"},"mcp_prompts":{"type":"boolean"},"mcp_ui":{"type":"boolean"},"expires_at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"on_tool_change":{"anyOf":[{"type":"string","enum":["hold","ask","allow"]},{"type":"null"}]}},"required":["connection_id"],"additionalProperties":false}}},"required":["grants"],"additionalProperties":false}}}}}},"/v1/tenants/{tenant}/actors/{actor}/tools":{"get":{"operationId":"listTools","tags":["Grants and tools"],"summary":"An actor's tools","description":"Exactly what the MCP endpoint lists for this actor, for apps that don't speak MCP. Only connected connections; descriptions are the service's own words, wrapped as untrusted. `discovery` says how the list is offered: while `active` (tool discovery on, or `auto` over its threshold), `tools` is the three built-in tools the agent is listed (`builtin: true`), and callTool runs them; `view=all` gives every definition whatever the mode. With access requests on (setAccessRequests), `request_access` is listed last in either view, also `builtin: true`.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"actor","in":"path","required":true,"description":"Your own actor (agent) id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"view","in":"query","required":false,"description":"`agent` (the default): what the agent is listed. `all`: every definition, also in discovery mode.","schema":{"type":"string","enum":["agent","all"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"tools":{"type":"array","items":{"$ref":"#/components/schemas/Tool"}},"held":{"type":"array","items":{"$ref":"#/components/schemas/HeldTool"},"description":"Granted tools that are not offered until their changed definition is accepted."},"discovery":{"type":"object","properties":{"mode":{"type":"string","enum":["off","on","auto"]},"threshold":{"type":["integer","null"]},"active":{"type":"boolean","description":"The list is the built-in tools right now."},"tool_count":{"type":"integer","description":"How many tools the actor is offered."}},"required":["mode","threshold","active","tool_count"]}},"required":["tools","held","discovery"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_ACTOR","BAD_FILTER"]}},"/v1/tenants/{tenant}/actors/{actor}/tool-discovery":{"get":{"operationId":"getToolDiscovery","tags":["Grants and tools"],"summary":"How an actor's tools are offered","description":"The actor's tool discovery setting. `off` until you set it.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"actor","in":"path","required":true,"description":"Your own actor (agent) id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"tool_discovery":{"$ref":"#/components/schemas/ToolDiscovery"}},"required":["tool_discovery"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_ACTOR"]},"put":{"operationId":"setToolDiscovery","tags":["Grants and tools"],"summary":"Turn tool discovery on or off for an actor","description":"For an agent with a very large tool list. `on`: the agent is listed three built-in tools instead of every definition: `search_tools` (words in, matching tool names with a one-line summary, kind and approval setting out), `describe_tool` (one tool's full definition) and `call_tool` (`{ name, input }`: the call itself, under exactly the named tool's grant, caps, limits and approval; your call history names the real tool). `auto`: the same, but only while the actor is offered more than `threshold` tools (40 when left out). `off`: every definition, as before. A tool's own name can always be called directly. Search and describe only ever show what the actor's grants offer; they call no service, are not logged as calls and are limited to 60 a minute per actor.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"actor","in":"path","required":true,"description":"Your own actor (agent) id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"tool_discovery":{"$ref":"#/components/schemas/ToolDiscovery"}},"required":["tool_discovery"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_ACTOR"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"type":"string","enum":["off","on","auto"]},"threshold":{"type":"integer","minimum":1,"maximum":10000}},"required":["mode"],"additionalProperties":false}}}}}},"/v1/tenants/{tenant}/actors/{actor}/tools/search":{"get":{"operationId":"searchTools","tags":["Grants and tools"],"summary":"Search an actor's tools","description":"The search an agent runs with `search_tools`, for your own agent loop: words over each tool's name, title, description and connection, best match first. Works whatever the actor's discovery mode. A tool the actor's grants block, hide or hold is never found. Nothing is called.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"actor","in":"path","required":true,"description":"Your own actor (agent) id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"q","in":"query","required":false,"description":"Words about what the tool should do, or part of its name. Left out: every tool, in list order.","schema":{"type":"string","maxLength":200}},{"name":"kind","in":"query","required":false,"description":"Only tools of this kind.","schema":{"type":"string","enum":["read","write","destructive"]}},{"name":"connection","in":"query","required":false,"description":"Only one connection's tools: its id, its tool-name prefix or its provider.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Default 10.","schema":{"type":"integer","minimum":1,"maximum":25}},{"name":"cursor","in":"query","required":false,"description":"`next_cursor` from the page before, with the same filters.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/ToolSearchResult"}},"total":{"type":"integer","description":"Every tool the search matched, over all pages."},"next_cursor":{"type":["string","null"],"description":"The cursor for the following page; null at the end."},"unavailable":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"provider":{"type":"string"},"source":{"type":"string","enum":["mcp","builtin","composio","record"]}},"required":["id","label","provider","source"]},"description":"Granted connections that can't be listed right now, so were not searched."}},"required":["results","total","next_cursor","unavailable"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_ACTOR","BAD_FILTER"]}},"/v1/tenants/{tenant}/actors/{actor}/tools/describe":{"get":{"operationId":"describeTool","tags":["Grants and tools"],"summary":"One tool's definition","description":"One tool by name, exactly as listTools gives it: what `describe_tool` answers an agent. `status` is `ok` (with `tool`), `held` (with `held`: the grant holds the tool until its changed definition is accepted, so no definition is given) or `unavailable` (its connection can't be listed right now). A name the actor is not offered is 404, whatever the reason.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"actor","in":"path","required":true,"description":"Your own actor (agent) id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"name","in":"query","required":false,"description":"The tool's name. Required.","schema":{"type":"string","minLength":1,"maxLength":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok","held","unavailable"]},"tool":{"$ref":"#/components/schemas/Tool"},"held":{"$ref":"#/components/schemas/HeldTool"},"connection":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"provider":{"type":"string"},"source":{"type":"string","enum":["mcp","builtin","composio","record"]}},"required":["id","label","provider","source"]}},"required":["status"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_ACTOR","BAD_FILTER","UNKNOWN_TOOL"]}},"/v1/tenants/{tenant}/actors/{actor}/tools/call":{"post":{"operationId":"callTool","tags":["Grants and tools"],"summary":"Call a tool","description":"One call over REST, through exactly the checks MCP uses: the tool, billing, the input (16 KB), the daily cap and approval. Answers 200 for every outcome; read `status`. `needs_approval` did not run. `timed_out` may have completed, so check before retrying a write. `dry_run: true` runs every check and then sends nothing. `cost_label` (1 to 64 of A-Z a-z 0-9 . _ : -) is your own cost-centre label: it is kept on the call and usage groups by it (`by_label`, the calls list, the CSV); it never changes what is allowed. Over MCP, send it as `_meta[\"you.programmable.dev/cost_label\"]`. For an actor with tool discovery set, `name` may also be a built-in: `call_tool` with `input: { name, input }` is the call of the tool it names (same checks, same answer); `search_tools` and `describe_tool` answer `ok` or `blocked` with `structured_content` and no `call_id`. With access requests on, `name` may be `request_access` (`input: { provider, tools?, reason? }`): it calls no service and logs no call, sends your webhook an `access.requested` event, and answers `ok` with `structured_content.status` (`requested`, `granted`, `choose` with ids to pick from, or `not_delivered`), or `blocked` with reason `bad_input` or `rate_limited`.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"actor","in":"path","required":true,"description":"Your own actor (agent) id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallResult"}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_ACTOR","UNKNOWN_TOOL","BILLING_REQUIRED","BAD_TOOL_CALL"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"dry_run":{"type":"boolean"},"cost_label":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,64}$"}},"required":["name"],"additionalProperties":false}}}}}},"/v1/tenants/{tenant}/approvals":{"get":{"operationId":"listApprovals","tags":["Approvals"],"summary":"A tenant's approvals","description":"Pending ones oldest first, otherwise newest first. Pending approvals expire after 24 hours.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"status","in":"query","required":false,"description":"Default pending.","schema":{"type":"string","enum":["pending","approved","rejected","expired","all"]}},{"name":"limit","in":"query","required":false,"description":"Default 100.","schema":{"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Approval"}}},"required":["items"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT"]},"post":{"operationId":"createApprovalRequest","tags":["Approvals"],"summary":"Ask a person before an action","description":"Before an action your app runs itself (send, spend, delete, change or other), ask a person. `title` is the line they read first; `details` is shown in full as pretty JSON (at most 4,000 characters). Answers 201 with the approval, its `approve_url` and `digest`, and sends approval.needed. Approving runs nothing: once `status` is approved, spend the yes with useApproval, then act. At most 50 requests wait per tenant.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"201":{"description":"Created (200 when it already existed, for the upsert operations).","content":{"application/json":{"schema":{"type":"object","properties":{"approval":{"$ref":"#/components/schemas/Approval"}},"required":["approval"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_ACTOR","DETAILS_TOO_LONG","APP_DISABLED","REQUEST_QUEUE_FULL"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"actor":{"type":"string","minLength":1,"maxLength":128},"action":{"type":"string","enum":["send","spend","delete","change","other"]},"title":{"type":"string","minLength":1,"maxLength":200},"details":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["actor","action","title"],"additionalProperties":false}}}}}},"/v1/approvals/{approval}/decide":{"post":{"operationId":"decideApproval","tags":["Approvals"],"summary":"Approve or reject a call","description":"Approving needs the `digest` you showed the person, so they approve exactly what they saw. An approved call runs once, now, with every cap still applied; its outcome is in `approval.run`. To approve with edits, also send `input`: the tool's whole input as it should run. It must pass what a fresh call would (the tool's schema, the grant's limits); the approval you asked about becomes `superseded`, and the one that comes back is a new approval with its own id and digest, `edited: true` and the names of the changed arguments. Pass its `edit_notice` to the agent. A request cannot be edited. Works with an app key or an approval key.","parameters":[{"name":"approval","in":"path","required":true,"description":"An approval id.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"approval":{"$ref":"#/components/schemas/Approval"}},"required":["approval"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_APPROVAL","NO_DIGEST","DIGEST_MISMATCH","DECIDED","EXPIRED","APP_DISABLED","BAD_EDIT","NOT_EDITABLE","APPROVAL_KEY"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"decision":{"type":"string","enum":["approve","reject"]},"digest":{"type":"string","pattern":"^[0-9a-f]{64}$"},"input":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"tenant":{"type":"string","minLength":1,"maxLength":128},"decided_by":{"type":"string","minLength":1,"maxLength":128},"note":{"type":"string","maxLength":500}},"required":["decision"],"additionalProperties":false}}}}}},"/v1/approvals":{"get":{"operationId":"listAppApprovals","tags":["Approvals"],"summary":"Your app's approvals, across tenants","description":"For one place that decides everything: the approvals of all your tenants (of the key's mode), or of one with `tenant`. Pending ones oldest first, otherwise newest first. An approval key can list pending ones only.","parameters":[{"name":"status","in":"query","required":false,"description":"Default pending.","schema":{"type":"string","enum":["pending","approved","rejected","expired","all"]}},{"name":"tenant","in":"query","required":false,"description":"Your tenant id, to list one tenant only.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"Default 100.","schema":{"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Approval"}}},"required":["items"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","APPROVAL_KEY"]}},"/v1/approvals/{approval}":{"get":{"operationId":"getApproval","tags":["Approvals"],"summary":"One approval","description":"One of your app's approvals (a gated call or a request), for polling a decision without listing a whole tenant. `tenant`, when sent, must be the approval's.","parameters":[{"name":"approval","in":"path","required":true,"description":"An approval id.","schema":{"type":"string"}},{"name":"tenant","in":"query","required":false,"description":"Your tenant id; when sent, the approval must be in it.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"approval":{"$ref":"#/components/schemas/Approval"}},"required":["approval"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_APPROVAL"]}},"/v1/approvals/{approval}/use":{"post":{"operationId":"useApproval","tags":["Approvals"],"summary":"Spend an approved request","description":"Right before your app does the action, spend the yes once with the request's `digest`. Answers 200 with the approval (`used_at` set). Anything but 200 means: do not act. A yes can be used once, within 24 hours of the decision; a gated tool call already ran when approved and can't be used.","parameters":[{"name":"approval","in":"path","required":true,"description":"An approval id.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"approval":{"$ref":"#/components/schemas/Approval"}},"required":["approval"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_APPROVAL","NOT_APPROVED","ALREADY_USED","USE_EXPIRED","DIGEST_MISMATCH","NOT_A_REQUEST","APP_DISABLED"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"digest":{"type":"string","pattern":"^[0-9a-f]{64}$"},"tenant":{"type":"string","minLength":1,"maxLength":128}},"required":["digest"],"additionalProperties":false}}}}}},"/v1/tenants/{tenant}/usage":{"get":{"operationId":"getUsage","tags":["Usage"],"summary":"Calls and cost","description":"Calls, outcomes and cost by UTC day, connection, actor and your own cost label (`by_label`).","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"days","in":"query","required":false,"description":"Default 30.","schema":{"type":"integer","minimum":1,"maximum":400}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Usage"}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT"]}},"/v1/tenants/{tenant}/usage.csv":{"get":{"operationId":"exportUsageCsv","tags":["Usage"],"summary":"The tenant's calls as a CSV file","description":"Every gateway and proxy call of the tenant in a time range, newest first, one row each, as a CSV file (RFC 4180, UTF-8, no byte-order mark, a header line first). Columns: time, call_id, tenant, actor, tool, connection_id, connection_label, connection_provider, channel, outcome, reason, mode, cost_usd, duration_ms, approval_id, cost_label. Never an input or a result. `from` is inclusive and `to` exclusive; a bare date for `to` means the end of that UTC day. Default: the last 30 days; at most 90 days and 50,000 rows a file. A cut file keeps the newest rows, ends its name in -partial.csv and answers `X-Export-Truncated: true` with `X-Export-Next-Before`: send that as `before` with the same range for the next, older file. A cell a spreadsheet would read as a formula (starting with = + - @, tab or CR) starts with a single quote. A key reads only its own mode's calls; a tenant-scoped key only its own tenant. 6 exports a minute per tenant.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"from","in":"query","required":false,"description":"Start, inclusive: YYYY-MM-DD (UTC) or a date-time with a zone. Default 30 days before `to`.","schema":{"type":"string","maxLength":40}},{"name":"to","in":"query","required":false,"description":"End, exclusive: YYYY-MM-DD (the end of that UTC day) or a date-time with a zone. Default now.","schema":{"type":"string","maxLength":40}},{"name":"before","in":"query","required":false,"description":"The X-Export-Next-Before cursor of the previous, cut file.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"text/csv":{"schema":{"type":"string","description":"CSV text. Columns: time, call_id, tenant, actor, tool, connection_id, connection_label, connection_provider, channel, outcome, reason, mode, cost_usd, duration_ms, approval_id, cost_label."}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","BAD_FILTER","RATE_LIMITED"]}},"/v1/app/spend-limits":{"get":{"operationId":"getAppSpendLimits","tags":["Usage"],"summary":"Your app's monthly spending limit","description":"The most everything your app's agents may spend on tool calls in a UTC calendar month, with what is booked so far. `monthly` is null until you set one.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"spend_limits":{"type":"object","properties":{"monthly":{"anyOf":[{"$ref":"#/components/schemas/SpendLimit"},{"type":"null"}]}},"required":["monthly"]}},"required":["spend_limits"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":[]},"put":{"operationId":"setAppSpendLimits","tags":["Usage"],"summary":"Set your app's monthly spending limit","description":"`monthly: { cap_usd, warn_percent? }` sets it, `monthly: null` removes it. Checked before every call, with calls still running counted at their expected price: a service with a fixed price per call can never pass it; where the cost is only reported afterwards, only a tool's first call that ever costs can, once. Past it a call is `blocked`, reason `app_monthly_spend_cap`. `warn_percent` (default 80, null for none): `spend.warning` is sent once per month when booked spend first reaches that share, and the app's owners get one email; `spend.cap_reached` once when the limit first refuses a call. This is what tool calls cost at the services, not your plan here. Needs a live key.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"spend_limits":{"type":"object","properties":{"monthly":{"anyOf":[{"$ref":"#/components/schemas/SpendLimit"},{"type":"null"}]}},"required":["monthly"]}},"required":["spend_limits"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["TEST_KEY"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"monthly":{"anyOf":[{"type":"object","properties":{"cap_usd":{"type":"number","minimum":0,"maximum":100000},"warn_percent":{"anyOf":[{"type":"integer","minimum":1,"maximum":99},{"type":"null"}]}},"required":["cap_usd"],"additionalProperties":false},{"type":"null"}]}},"required":["monthly"],"additionalProperties":false}}}}}},"/v1/tenants/{tenant}/spend-limits":{"get":{"operationId":"getTenantSpendLimits","tags":["Usage"],"summary":"A tenant's spending limits","description":"The most this tenant's actors together may spend on tool calls per UTC day and per UTC calendar month, with what is booked so far. Each is null until set.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"spend_limits":{"type":"object","properties":{"daily":{"anyOf":[{"$ref":"#/components/schemas/SpendLimit"},{"type":"null"}]},"monthly":{"anyOf":[{"$ref":"#/components/schemas/SpendLimit"},{"type":"null"}]}},"required":["daily","monthly"]}},"required":["spend_limits"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT"]},"put":{"operationId":"setTenantSpendLimits","tags":["Usage"],"summary":"Set a tenant's spending limits","description":"\"This customer of mine may spend $X.\" `daily` and `monthly` each take `{ cap_usd, warn_percent? }` or null to remove; one left out keeps its value. Enforced like the app's limit; past one a call is `blocked`, reason `tenant_daily_spend_cap` or `tenant_monthly_spend_cap`. When several limits would refuse a call, the reason names the one with the least left. Warnings and events as for the app's limit, with the tenant on the event. A tenant-scoped key can read these but not change them.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"spend_limits":{"type":"object","properties":{"daily":{"anyOf":[{"$ref":"#/components/schemas/SpendLimit"},{"type":"null"}]},"monthly":{"anyOf":[{"$ref":"#/components/schemas/SpendLimit"},{"type":"null"}]}},"required":["daily","monthly"]}},"required":["spend_limits"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","KEY_SCOPED"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"daily":{"anyOf":[{"type":"object","properties":{"cap_usd":{"type":"number","minimum":0,"maximum":100000},"warn_percent":{"anyOf":[{"type":"integer","minimum":1,"maximum":99},{"type":"null"}]}},"required":["cap_usd"],"additionalProperties":false},{"type":"null"}]},"monthly":{"anyOf":[{"type":"object","properties":{"cap_usd":{"type":"number","minimum":0,"maximum":100000},"warn_percent":{"anyOf":[{"type":"integer","minimum":1,"maximum":99},{"type":"null"}]}},"required":["cap_usd"],"additionalProperties":false},{"type":"null"}]}},"additionalProperties":false}}}}}},"/v1/tenants/{tenant}/actors/{actor}/spend-limits":{"get":{"operationId":"getActorSpendLimits","tags":["Usage"],"summary":"An actor's monthly spending limit","description":"The most this one actor may spend on tool calls in a UTC calendar month, over every connection. Null until set.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"actor","in":"path","required":true,"description":"Your own actor (agent) id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"spend_limits":{"type":"object","properties":{"monthly":{"anyOf":[{"$ref":"#/components/schemas/SpendLimit"},{"type":"null"}]}},"required":["monthly"]}},"required":["spend_limits"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_ACTOR"]},"put":{"operationId":"setActorSpendLimits","tags":["Usage"],"summary":"Set an actor's monthly spending limit","description":"`monthly: { cap_usd, warn_percent? }` sets it, `monthly: null` removes it. A grant's own `daily_spend_cap_usd` (one connection, one day) still applies beside it. Past it a call is `blocked`, reason `actor_monthly_spend_cap`. A tenant-scoped key can read it but not change it.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"actor","in":"path","required":true,"description":"Your own actor (agent) id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"spend_limits":{"type":"object","properties":{"monthly":{"anyOf":[{"$ref":"#/components/schemas/SpendLimit"},{"type":"null"}]}},"required":["monthly"]}},"required":["spend_limits"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","NO_ACTOR","KEY_SCOPED"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"monthly":{"anyOf":[{"type":"object","properties":{"cap_usd":{"type":"number","minimum":0,"maximum":100000},"warn_percent":{"anyOf":[{"type":"integer","minimum":1,"maximum":99},{"type":"null"}]}},"required":["cap_usd"],"additionalProperties":false},{"type":"null"}]}},"required":["monthly"],"additionalProperties":false}}}}}},"/v1/tenants/{tenant}/calls":{"get":{"operationId":"listCalls","tags":["Call history"],"summary":"A tenant's calls","description":"Every gateway and proxy call of the tenant, newest first. `next` is the cursor for the following page (null at the end). No inputs or results here; getCall has them for one call. An `actor` the tenant doesn't have gives an empty list. A key reads only its own mode's calls (test or live).","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}},{"name":"actor","in":"query","required":false,"description":"Only this actor's calls (your actor id).","schema":{"type":"string"}},{"name":"outcome","in":"query","required":false,"description":"Only calls with this outcome.","schema":{"type":"string","enum":["running","ok","tool_error","error","timed_out","cancelled","blocked","needs_approval","dry_run"]}},{"name":"channel","in":"query","required":false,"description":"Only calls made this way.","schema":{"type":"string","enum":["mcp","rest","approval","proxy"]}},{"name":"tool","in":"query","required":false,"description":"Only calls to this tool.","schema":{"type":"string","minLength":1,"maxLength":200}},{"name":"cost_label","in":"query","required":false,"description":"Only calls with this cost label.","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,64}$"}},{"name":"limit","in":"query","required":false,"description":"Default 50.","schema":{"type":"integer","minimum":1,"maximum":200}},{"name":"before","in":"query","required":false,"description":"The `next` cursor from the previous page.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CallEntry"}},"next":{"type":["string","null"],"description":"The cursor for the following page; null at the end."}},"required":["items","next"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","BAD_FILTER"]}},"/v1/calls/{call}":{"get":{"operationId":"getCall","tags":["Call history"],"summary":"One call","description":"One of your app's calls by the `call_id` every outcome returns, with what it was given (`input_summary`) and what came back (`result_preview`, the service's text: untrusted). Both are clipped, and become null once your history window has passed (90 days unless you set another with `PUT /v1/app/history`). An app that keeps full history also gets the whole of each in `input` and `result`. A grant whose `payload` keeps nothing still keeps nothing. `tenant`, when sent, must be the call's. Another app's call is a 404, like an unknown one. A key reads only its own mode's calls; a tenant-scoped key only its own tenant's.","parameters":[{"name":"call","in":"path","required":true,"description":"A call id: the `call_id` every outcome returns.","schema":{"type":"string"}},{"name":"tenant","in":"query","required":false,"description":"Your tenant id; when sent, the call must be in it.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"call":{"$ref":"#/components/schemas/CallDetail"}},"required":["call"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_CALL"]}},"/v1/app/webhook":{"get":{"operationId":"getWebhook","tags":["Webhooks"],"summary":"Where your events go","description":"Your webhook URL, event filter and signature format. Never the secret.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"webhook":{"$ref":"#/components/schemas/WebhookSettings"}},"required":["webhook"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":[]},"put":{"operationId":"setWebhook","tags":["Webhooks"],"summary":"Set your webhook URL","description":"A public https address (null clears it). The signing secret (`whsec_…`) is created the first time, or with `rotate_secret`, and returned only then. `events` chooses which event types you receive: exact types (`approval.needed`) and families (`connection.*`); null means every type, which is the default; leave it out to keep the filter. An event your filter leaves out is never queued, so it is not retried and not listed. A type we do not send is refused, so a typo cannot silently drop events. `signature_format` chooses what `X-Programmable-Signature` carries (`suite`: `t=,v1=`; `legacy`: `sha256=`); leave it out to keep it. `X-Programmable-Signature-V2` carries the `t=,v1=` value in both.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"webhook":{"$ref":"#/components/schemas/WebhookSettings"},"secret":{"type":"string","description":"whsec_…, only when created or rotated."}},"required":["webhook"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["BAD_URL","BAD_EVENT_TYPES"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"anyOf":[{"type":"string","maxLength":2000,"format":"uri"},{"type":"null"}]},"rotate_secret":{"type":"boolean"},"events":{"description":"Which event types to receive: exact types (approval.needed) and families (connection.*). null = every type (the default). Leave it out to keep the filter as it is.","anyOf":[{"maxItems":40,"type":"array","items":{"type":"string","maxLength":100}},{"type":"null"}]},"signature_format":{"description":"What the X-Programmable-Signature header carries: suite = t=<unix seconds>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")> (the Programmable suite's format, and what a newly registered app starts with), legacy = sha256=<hex HMAC-SHA256(secret, raw body)> (what an app registered before this setting existed keeps until it switches). GET /v1/app/webhook says which yours is. X-Programmable-Signature-V2 carries the t=,v1= value in both. Leave it out to keep it as it is.","type":"string","enum":["legacy","suite"]}},"required":["url"],"additionalProperties":false}}}}}},"/v1/app/webhooks/stats":{"get":{"operationId":"getWebhookStats","tags":["Webhooks"],"summary":"Provider webhook counts","description":"Provider webhooks routed to your own connections: matched, not subscribed, and forwarded as provider.event. Counts only.","parameters":[{"name":"days","in":"query","required":false,"description":"Default 30.","schema":{"type":"integer","minimum":1,"maximum":400}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookStats"}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":[]}},"/v1/app/providers":{"get":{"operationId":"listAppClients","tags":["Your OAuth clients"],"summary":"Your own OAuth clients","description":"OAuth clients you registered so the provider's consent screen names your app. Never a secret.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppClients"}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":[]},"patch":{"operationId":"setRequireOwnClient","tags":["Your OAuth clients"],"summary":"Require your own OAuth clients","description":"With `require_own_client`, a connect for a provider where you have no client is refused (409 OWN_CLIENT_REQUIRED) instead of using ours.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppClients"}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"require_own_client":{"type":"boolean"}},"required":["require_own_client"],"additionalProperties":false}}}}}},"/v1/app/providers/{provider}/client":{"get":{"operationId":"getAppClient","tags":["Your OAuth clients"],"summary":"Your OAuth client for a provider","description":"Includes the redirect URI to register at the provider.","parameters":[{"name":"provider","in":"path","required":true,"description":"A provider record id, as in GET /v1/providers.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"client":{"$ref":"#/components/schemas/AppClient"}},"required":["client"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_CLIENT"]},"put":{"operationId":"setAppClient","tags":["Your OAuth clients"],"summary":"Register your OAuth client for a provider","description":"Secrets are write-only (omitted = kept for the same client_id). A new client_id becomes the active one; the old one keeps serving connections signed in with it.","parameters":[{"name":"provider","in":"path","required":true,"description":"A provider record id, as in GET /v1/providers.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"client":{"$ref":"#/components/schemas/AppClient"}},"required":["client"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_PROVIDER","UNSUPPORTED","TOO_MANY_CLIENTS","BAD_PRIVATE_KEY","REDIRECT_MISMATCH"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"client_id":{"type":"string","minLength":1,"maxLength":512},"client_secret":{"type":"string","minLength":1,"maxLength":4096},"webhook_secret":{"type":"string","minLength":8,"maxLength":4096},"clear_webhook_secret":{"type":"boolean"},"private_key":{"type":"string","minLength":1,"maxLength":8192},"private_key_id":{"type":"string","pattern":"^[A-Za-z0-9._:+/=-]{1,200}$"},"clear_private_key":{"type":"boolean"},"app_token":{"type":"string","minLength":8,"maxLength":4096},"clear_app_token":{"type":"boolean"},"install_slug":{"anyOf":[{"type":"string","pattern":"^[a-z0-9](?:[a-z0-9-]{0,98}[a-z0-9])?$"},{"type":"null"}]}},"required":["client_id"],"additionalProperties":false}}}}},"delete":{"operationId":"deleteAppClient","tags":["Your OAuth clients"],"summary":"Remove your OAuth client for a provider","description":"409 CLIENT_IN_USE while connections were signed in with it; `force=true` marks them needs_reauth instead.","parameters":[{"name":"provider","in":"path","required":true,"description":"A provider record id, as in GET /v1/providers.","schema":{"type":"string"}},{"name":"force","in":"query","required":false,"description":"Remove it even while connections use it.","schema":{"type":"string","enum":["true"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"},"needs_reauth":{"type":"integer"}},"required":["deleted","needs_reauth"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_CLIENT","CLIENT_IN_USE"]}},"/v1/tenants/{tenant}/mcp-oauth-email":{"get":{"operationId":"getMcpOauthEmail","tags":["MCP sign-in"],"summary":"Is an address bound for MCP sign-in","description":"Whether this tenant has an address that may authorize stock MCP clients (Claude, n8n) for its actors through our OAuth authorization server. The address itself is never returned. 404 while MCP sign-in is off on this service.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"mcp_oauth_email":{"$ref":"#/components/schemas/McpOauthEmail"}},"required":["mcp_oauth_email"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT"]},"put":{"operationId":"setMcpOauthEmail","tags":["MCP sign-in"],"summary":"Bind the address that may authorize MCP clients","description":"The one person whose verified Programmable sign-in address is this may authorize an MCP client for the listed actors (1 to 20 of your actor ids) of this tenant, at `https://<host>/mcp/<your app slug>/<tenant>/<actor>`, once your app's MCP sign-in switch is on (Developers > Server access). Only a keyed hash is stored, with the key you used: revoking that key unbinds the address and ends what it authorized (a rotation moves it to the new key). The same address again updates the actor list (actors dropped from it lose their clients); a different one replaces it and ends everything the old one authorized. Sends `mcp_oauth.email_bound`. Live tenants only (409 MCP_OAUTH_LIVE_ONLY with a test key); never your dashboard's test tenant (409 MCP_OAUTH_TEST_ACCOUNT).","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"mcp_oauth_email":{"$ref":"#/components/schemas/McpOauthEmail"}},"required":["mcp_oauth_email"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT","BAD_EMAIL","BAD_ACTORS","MCP_OAUTH_LIVE_ONLY","MCP_OAUTH_TEST_ACCOUNT"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","minLength":3,"maxLength":254},"actors":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}},"required":["email","actors"],"additionalProperties":false}}}}},"delete":{"operationId":"deleteMcpOauthEmail","tags":["MCP sign-in"],"summary":"Unbind the address","description":"Every MCP client the address authorized for this tenant stops at its next request. Sends `mcp_oauth.email_unbound`.","parameters":[{"name":"tenant","in":"path","required":true,"description":"Your own tenant id: 1-128 of A-Z a-z 0-9 . _ : -","schema":{"type":"string","pattern":"^[A-Za-z0-9._:-]{1,128}$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean","description":"false when no address was bound."}},"required":["deleted"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_TENANT"]}},"/v1/app/access-requests":{"get":{"operationId":"getAccessRequests","tags":["Access requests"],"summary":"Can your agents ask for access","description":"Whether your actors get the built-in tool request_access, over MCP and in listTools / callTool. Off by default.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"access_requests":{"$ref":"#/components/schemas/AccessRequests"}},"required":["access_requests"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":[]},"put":{"operationId":"setAccessRequests","tags":["Access requests"],"summary":"Let your agents ask for access","description":"Needs a webhook (409 NO_WEBHOOK): each request arrives as an access.requested event. Nothing is connected or granted; your server decides.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"access_requests":{"$ref":"#/components/schemas/AccessRequests"}},"required":["access_requests"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_WEBHOOK"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"],"additionalProperties":false}}}}}},"/v1/catalog/search":{"get":{"operationId":"searchCatalog","tags":["MCP server catalogue"],"summary":"Search MCP servers","description":"Remote MCP servers your users can connect (with a connect session's catalog_entry_id). Vendor-official servers first.","parameters":[{"name":"q","in":"query","required":false,"description":"Search text.","schema":{"type":"string","maxLength":200}},{"name":"provider","in":"query","required":false,"description":"Only this provider.","schema":{"type":"string","maxLength":120}},{"name":"official_only","in":"query","required":false,"description":"Only servers run by the service's own vendor.","schema":{"type":"string","enum":["true","1"]}},{"name":"remote_only","in":"query","required":false,"description":"Only servers with a remote URL.","schema":{"type":"string","enum":["true","1"]}},{"name":"limit","in":"query","required":false,"description":"Default 20.","schema":{"type":"integer","minimum":1,"maximum":50}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CatalogServer"}}},"required":["items"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":[]}},"/v1/catalog/servers/{slug}":{"get":{"operationId":"getCatalogServer","tags":["MCP server catalogue"],"summary":"Get one MCP server","description":"One server with every listing of the same endpoint.","parameters":[{"name":"slug","in":"path","required":true,"description":"A catalogue server's slug.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"server":{"$ref":"#/components/schemas/CatalogServer"},"listings":{"type":"array","items":{"type":"object","additionalProperties":true}}},"required":["server","listings"]}}}},"4XX":{"description":"A refusal: `{ error, code? }`. 401 for a missing, malformed, unknown or revoked key; 429 after too many failed keys.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"x-error-codes":["NO_SERVER"]}}},"components":{"securitySchemes":{"appKey":{"type":"http","scheme":"bearer","description":"Your app key, `pd_live_…`. Make one on the dashboard under Developers; it is shown once."}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string","description":"What went wrong, in a sentence."},"code":{"type":"string","description":"A stable UPPER_CASE code (see the error catalogue). Missing on a few generic refusals, such as 401."}},"required":["error"],"description":"Every refusal: `{ error, code? }` with a 4xx or 5xx status. Some carry more fields (see each operation)."},"Tenant":{"type":"object","properties":{"id":{"type":"string","description":"Your own tenant id."},"name":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","name","created_at","updated_at"],"description":"lib/apps.ts publicTenant"},"Actor":{"type":"object","properties":{"id":{"type":"string","description":"Your own actor id."},"tenant":{"type":"string"},"label":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","tenant","label","created_at","updated_at"],"description":"lib/apps.ts publicActor"},"ConnectionOauth":{"type":"object","properties":{"status":{"type":"string","enum":["disconnected","connected","needs_reauth"]},"issuer":{"type":["string","null"],"description":"Null for provider records."},"scope":{"type":["string","null"]},"expires_at":{"type":["string","null"],"format":"date-time"},"client_source":{"type":["string","null"],"enum":["dcr","cimd","manual","platform","app"],"description":"Whose OAuth client: dcr, cimd or manual for MCP servers; platform or app for a provider record sign-in."},"has_refresh_token":{"type":"boolean"},"last_error":{"type":["string","null"]},"connected_at":{"type":["string","null"],"format":"date-time"}},"required":["status","issuer","scope","expires_at","client_source","has_refresh_token","last_error","connected_at"]},"Connection":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["mcp","builtin","composio","record"]},"provider":{"type":"string"},"label":{"type":"string"},"config":{"type":"object","additionalProperties":true,"description":"Non-secret settings."},"metadata":{"type":"object","additionalProperties":{"type":"string"},"description":"Your own key/value pairs (`{}` when none): set on create or a connect session, changed with PATCH, filtered with metadata[key]=value. Never shown to the person, sent to the service or put in events."},"status":{"type":"string","enum":["pending","connected","needs_reauth","failed","disabled"],"description":"Only `connected` connections offer tools."},"has_secret":{"type":"boolean","description":"A credential is stored. Never the credential itself."},"scopes":{"type":["string","null"],"description":"Granted scopes (space-separated) for OAuth connections."},"last_error":{"type":["string","null"]},"last_used_at":{"type":["string","null"],"format":"date-time"},"connected_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"account_fingerprint":{"type":["string","null"],"description":"The provider account this connection signed in as, as your app's own fingerprint (a keyed hash, never the account id). Equal values in your app = the same account; null = the provider named no account (pasted keys, builtins, most MCP servers, Composio). A re-authorisation must come back as the same account (else error=account_mismatch).","pattern":"^[0-9a-f]{32}$"},"oauth":{"$ref":"#/components/schemas/ConnectionOauth"},"tenant":{"type":"string","description":"Your tenant id. Only on searchConnections, which lists across tenants."}},"required":["id","source","provider","label","config","metadata","status","has_secret","scopes","last_error","last_used_at","connected_at","created_at","updated_at","account_fingerprint"],"description":"lib/connections.ts PublicConnection. Never a secret, token or account id."},"ConnectionHealth":{"type":"object","properties":{"connection_id":{"type":"string"},"source":{"type":"string","enum":["mcp","builtin","composio","record"]},"provider":{"type":"string"},"auth_type":{"type":["string","null"],"enum":["oauth2_authorization_code","oauth2_client_credentials","api_key","basic","oauth1"]},"connection_status":{"type":"string","enum":["pending","connected","needs_reauth","failed","disabled"]},"status":{"type":"string","enum":["ok","expiring","needs_reauth","error"],"description":"`expiring`: no refresh token and under 3 days left."},"last_refresh_at":{"type":["string","null"],"format":"date-time"},"last_used_at":{"type":["string","null"],"description":"The last call that completed without error.","format":"date-time"},"last_error":{"type":["string","null"]},"last_error_at":{"type":["string","null"],"format":"date-time"},"scopes":{"type":["array","null"],"items":{"type":"string"}},"expires_at":{"type":["string","null"],"format":"date-time"},"has_refresh_token":{"type":["boolean","null"]},"refresh":{"type":["object","null"],"properties":{"attempts":{"type":"integer"},"next_attempt_at":{"type":["string","null"],"format":"date-time"},"last_error":{"type":["string","null"]},"last_error_at":{"type":["string","null"],"format":"date-time"}},"required":["attempts","next_attempt_at","last_error","last_error_at"]},"record":{"type":["object","null"],"properties":{"id":{"type":"string"},"drift":{"type":"object","additionalProperties":true}},"required":["id","drift"]},"customer_host":{"type":["object","null"],"properties":{"host":{"type":"string"}},"required":["host"]}},"required":["connection_id","source","provider","auth_type","connection_status","status","last_refresh_at","last_used_at","last_error","last_error_at","scopes","expires_at","has_refresh_token","refresh","record","customer_host"],"description":"lib/token-health.ts connectionHealth. Never a token or secret."},"Provider":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"auth_type":{"type":"string","enum":["oauth2_authorization_code","oauth2_client_credentials","api_key","basic","oauth1"]},"state":{"type":"string","enum":["live"]},"version":{"type":"integer"},"connectable":{"type":"boolean","description":"False while the record is paused for discovery drift: existing connections keep working, a new connect is 409 RECORD_NOT_LIVE."},"api_base_url":{"type":["string","null"],"description":"May be a template such as https://{site}.atlassian.net; input_fields names what fills it."},"allowed_hosts":{"type":"array","items":{"type":"string"},"description":"The hosts the proxy may call with this credential (exact names or *.suffix)."},"scopes":{"type":["object","null"],"properties":{"default":{"type":"array","items":{"type":"string"}},"allowed":{"type":"array","items":{"type":"string"}}},"required":["default","allowed"]},"client_source":{"type":["string","null"],"enum":["platform","tenant"]},"credential_fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"help":{"type":["string","null"]},"secret":{"type":"boolean"},"optional":{"type":"boolean"},"pattern":{"type":["string","null"]}},"required":["name","label","help","secret","optional","pattern"]},"description":"What the hosted page asks a person to paste. Credentials are never accepted on the app API."},"input_fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"help":{"type":["string","null"]},"pattern":{"type":["string","null"]},"host":{"type":"boolean"},"normalise":{"type":["string","null"]},"suffixes":{"type":["array","null"],"items":{"type":"string"}},"lookup":{"type":["string","null"]}},"required":["name","label","help","pattern","host","normalise","suffixes","lookup"]}},"webhooks":{"type":"boolean","description":"The record forwards provider webhooks as provider.event."},"updated_at":{"type":"string","format":"date-time"}},"required":["id","label","auth_type","state","version","connectable","api_base_url","allowed_hosts","scopes","client_source","credential_fields","input_fields","webhooks","updated_at"],"description":"lib/public-providers.ts PublicProvider. Never a client id, secret or token endpoint."},"Grant":{"type":"object","properties":{"connection":{"type":"object","properties":{"id":{"type":"string"},"source":{"type":"string","enum":["mcp","builtin","composio","record"]},"provider":{"type":"string"},"label":{"type":"string"},"status":{"type":"string","enum":["pending","connected","needs_reauth","failed","disabled"]}},"required":["id","source","provider","label","status"]},"tools":{"type":["array","null"],"items":{"type":"string"},"description":"Null = every tool the connection lists."},"daily_call_cap":{"type":"integer"},"requires_approval":{"type":"boolean"},"approve_by_link":{"type":["object","null"],"properties":{"to":{"type":"string","description":"Shown masked."}},"required":["to"]},"kind_policy":{"type":["object","null"],"properties":{"read":{"type":"string","enum":["allow","ask","block"]},"write":{"type":"string","enum":["allow","ask","block"]},"destructive":{"type":"string","enum":["allow","ask","block"]}},"required":["read","write","destructive"],"description":"What happens per kind of call: allow runs, ask waits for a person, block is not offered. Null = requires_approval decides every call."},"trust_read_hints":{"type":"boolean","description":"Let an outside server's own \"read only\" label count as a read. Off, a tool we have not labelled ourselves is a write."},"tool_rules":{"type":"object","additionalProperties":{"type":"object","additionalProperties":true,"description":"kind, action, daily_call_cap, payload, args, result"},"description":"Per tool, by the service's own tool name: `kind` (read / write / destructive), `action` (allow / ask / block), `daily_call_cap`, `payload`, `result` (`mask`: field names or path tails blanked in a JSON result; `keep`: `{ list?, field, equals | one_of | starts_with | ends_with }` keeps only matching items of a list; a result that is not JSON is withheld), and `args`: limits on the call's arguments by name or dotted path (`required`, `equals`, `one_of`, `starts_with`, `ends_with`, `min`, `max`, `max_length`; a list must satisfy them item by item)."},"resources":{"type":"object","additionalProperties":{"type":"object","additionalProperties":true,"description":"required, equals, one_of, starts_with, ends_with, min, max, max_length"},"description":"Limits on an argument BY NAME for every tool of the connection (`{ \"repo\": { \"one_of\": [\"acme/site\"] } }`). A tool whose input schema declares the argument must send it and satisfy the limit; a tool that does not declare it is checked only when the call sends it. For GitHub, Slack, Notion, Asana, Linear, Airtable and Jira a key may name the provider's resource instead (`repo`, `channel`, `page`, `project`, …): it lands on the argument or arguments that carry it in that provider's tools (GitHub's `repo` is `owner` + `repo`, compared as `\"acme/site\"`). A tool that does not take the resource as an argument is not limited by it, unless `resources_strict` is on."},"resources_strict":{"type":"boolean","description":"Strict resource limits. On, the agent is offered only the tools EVERY limit in `resources` is required on (the tool's schema declares the argument, or a whole form of the provider's resource, at the top level); every other tool is not offered, like a blocked tool, unless it has an entry of its own in `tool_rules` (even `{}`), whose action and `args` then decide. A record tool that could carry the resource only inside `body` does not count as limited. With no `resources` it changes nothing. Default false."},"daily_spend_cap_usd":{"type":["number","null"],"description":"Dollars of booked cost per UTC day for this actor on this connection. A source with a fixed price per call is counted before the call, so it cannot pass the cap; where the cost is only reported afterwards, a tool is counted at the most one call of it has cost lately, so only its first call that ever costs can pass the cap."},"payload":{"type":"string","enum":["full","result_only","none"],"description":"full; result_only = the call's input is not kept in the call history; none = neither input nor result is kept, and the agent is told only whether the call worked."},"mcp_resources":{"type":"boolean","description":"Only for a connection to an MCP server (`source: mcp`), default false: the actor may list and read the server's MCP resources through Dev's MCP endpoint (`resources/list`, `resources/templates/list`, `resources/read`). A read is a call: it counts toward the caps, is logged, and follows the grant's rule for reads (`kind_policy.read`, else `requires_approval`). What comes back is the server's content, marked as untrusted. Not the same as `resources` (argument limits)."},"mcp_prompts":{"type":"boolean","description":"Only for a connection to an MCP server, default false: the actor may list and fetch the server's prompt templates through Dev's MCP endpoint (`prompts/list`, `prompts/get`). A prompt is text written by the server's publisher that asks to be put straight into a model's context as instructions; Dev marks it as untrusted, but a client that uses a prompt as intended hands those words to the model. A fetch is a call, like a resource read."},"mcp_ui":{"type":"boolean","description":"Only for a connection to an MCP server, default false, and for ONE grant of an actor at most (a second is 400 BAD_GRANT): the server's MCP Apps pages (`ui://` HTML and scripts written by its publisher) are passed on to an MCP client that declared it renders them. Dev never renders, changes or runs a page, and what a page shows a person or hands to the model inside the client does not pass through Dev. Reading a page is a call, like a resource read."},"expires_at":{"type":["string","null"],"format":"date-time"},"expired":{"type":"boolean","description":"Past expires_at: the grant gives nothing until it is set again."},"on_tool_change":{"type":"string","enum":["hold","ask","allow"],"description":"Connections to outside servers only (source mcp or composio). What happens to a tool whose definition (description, input schema, hints, title) is no longer the one that was accepted, or that the server added after the grant was set: `hold` = not offered until the change is accepted (the default for a new grant); `ask` = offered, but every call waits for approval, and the approval says the definition changed; `allow` = offered as it is. A grant from before this setting existed is `allow` until you set it."},"source":{"type":"string","enum":["set","default"],"description":"`default`: made by your app's default grant policy (`PUT /v1/app/default-grants`) and not set by anyone since; `set`: set by your app or a person. Setting a grant makes it `set`."},"tool_changes":{"type":"array","items":{"type":"object","properties":{"tool":{"type":"string","description":"The service's own tool name."},"change":{"type":"string","enum":["changed","new"],"description":"`new`: the server added it after the grant was set."},"parts":{"type":"array","items":{"type":"string","enum":["description","input_schema","annotations","title"]},"description":"For `changed`: which parts of the definition differ."},"since":{"type":"string","description":"Since when the difference has been seen.","format":"date-time"},"effect":{"type":"string","enum":["held","asks","offered"],"description":"What this grant does with it now."}},"required":["tool","change","parts","since","effect"]},"description":"The tools this grant covers whose definition is not the accepted one right now. Empty when all are as accepted. Review and accept them with the connection's tool-changes."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["connection","tools","daily_call_cap","requires_approval","approve_by_link","kind_policy","trust_read_hints","tool_rules","resources","resources_strict","daily_spend_cap_usd","payload","mcp_resources","mcp_prompts","mcp_ui","expires_at","expired","on_tool_change","source","tool_changes","created_at","updated_at"],"description":"lib/grants.ts"},"Tool":{"type":"object","properties":{"name":{"type":"string","description":"`<prefix>__<tool>`, at most 62 characters of [A-Za-z0-9_-]."},"title":{"type":"string","description":"The service's display title, at most 64 characters, wrapped in <untrusted-data> like descriptions."},"description":{"type":"string","description":"Wrapped in <untrusted-data>: the service's own words."},"input_schema":{"type":"object","additionalProperties":true,"description":"Rebuilt from structural JSON Schema keys only."},"output_schema":{"type":"object","additionalProperties":true,"description":"The shape of this tool's `structured_content`, when the service declares one and it can be passed on without changing what it accepts. Only on a tool that runs at once under a grant that hands results back unmasked (no approval, `payload` not none, no `result` rule)."},"annotations":{"type":"object","properties":{"read_only":{"type":"boolean"},"destructive":{"type":"boolean"},"idempotent":{"type":"boolean"},"open_world":{"type":"boolean"}},"description":"Only the hints the service gave; they never relax a grant or approval."},"icons":{"type":"array","items":{"type":"object","properties":{"src":{"type":"string","description":"An https URL only.","format":"uri"},"mime_type":{"type":"string","description":"image/* only."},"sizes":{"type":"array","items":{"type":"string"}},"theme":{"type":"string","enum":["light","dark"]}},"required":["src"]},"description":"The service's https icons."},"connection":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"provider":{"type":"string"},"source":{"type":"string","enum":["mcp","builtin","composio","record"]}},"required":["id","label","provider","source"]},"requires_approval":{"type":"boolean","description":"This tool's calls wait for a person (the grant's rule for this tool or its kind)."},"kind":{"type":"string","enum":["read","write","destructive"],"description":"What the grant makes of this tool: its own rule, our label, the service's hint (only to be stricter, or with trust_read_hints), else write."},"daily_call_cap":{"type":"integer","description":"The smaller of the grant's cap and this tool's own."},"definition_changed":{"type":"boolean","description":"Present and true when this tool's definition is not the one that was accepted and the grant offers it anyway (`on_tool_change` ask or allow)."},"builtin":{"type":"boolean","description":"Present and true on a built-in tool of ours (tool discovery: search_tools, describe_tool, call_tool; and request_access where your app offers it). Its title and description are our own words, not wrapped; it has no connection, kind, cap or approval setting of its own."}},"required":["name","input_schema"],"description":"Exactly what the MCP endpoint lists for this actor. `connection`, `requires_approval`, `kind` and `daily_call_cap` are on every granted tool and absent only on a `builtin` one."},"ToolDiscovery":{"type":"object","properties":{"mode":{"type":"string","enum":["off","on","auto"],"description":"`off` (the default): every definition is listed. `on`: the three built-in tools instead. `auto`: the built-ins only while the actor is offered more than `threshold` tools."},"threshold":{"type":["integer","null"],"description":"Only with `auto` (1 to 10000; 40 when not named); null otherwise."}},"required":["mode","threshold"],"description":"How one actor's tool list is offered. It never changes what the actor may call."},"ToolSearchResult":{"type":"object","properties":{"name":{"type":"string","description":"The tool's name: what describe and call take."},"summary":{"type":"string","description":"The service's title and first line about the tool, one line of at most 160 characters, wrapped in <untrusted-data>. Absent when the service said nothing."},"kind":{"type":"string","enum":["read","write","destructive"],"description":"What the grant makes of this tool."},"requires_approval":{"type":"boolean","description":"A call waits for a person."},"connection":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"provider":{"type":"string"},"source":{"type":"string","enum":["mcp","builtin","composio","record"]}},"required":["id","label","provider","source"]}},"required":["name","kind","requires_approval","connection"]},"ResultBlock":{"type":"object","properties":{"type":{"type":"string","enum":["text","image","audio","resource_link","resource"],"description":"`text`: `text`. `image` / `audio`: `data` + `mime_type`. `resource_link`: `uri`, `name` and optional `title`, `description`, `mime_type`, `size`. `resource` (embedded): `resource`."},"text":{"type":"string","description":"A text block: the service's words, wrapped as <untrusted-data>…</untrusted-data>; or a note of ours in square brackets where a part was not passed on."},"data":{"type":"string","description":"An image or audio clip as standard base64, whole (a part over its size limit is replaced by a note, never cut). Images: png, jpeg, gif, webp, at most 1 MB. Audio: wav, mpeg, ogg, webm, flac, mp4, at most 1 MB. The bytes' own signature must agree with `mime_type`. 2 MB for all binary parts of one result."},"mime_type":{"type":"string","description":"A plain media type token, never the service's free text."},"uri":{"type":"string","description":"A link's address, as data: Dev never fetches it. An http(s) address is passed as it is; any other scheme is the vendor's own name for a resource, passed as `pdres://<connection prefix>/<the vendor's URI>`, which only this gateway's MCP endpoint can read, and only under a grant with `mcp_resources`."},"name":{"type":"string","description":"Wrapped in <untrusted-data>."},"title":{"type":"string","description":"Wrapped in <untrusted-data>."},"description":{"type":"string","description":"Wrapped in <untrusted-data>."},"size":{"type":"integer","description":"Bytes, as the service states it."},"resource":{"type":"object","properties":{"uri":{"type":"string","description":"As a link's `uri`."},"mime_type":{"type":"string"},"text":{"type":"string","description":"Wrapped in <untrusted-data>; counts toward the result's 32 KB of text."},"blob":{"type":"string","description":"Standard base64, whole: png, jpeg, gif, webp, wav, mpeg, ogg, webm, flac, mp4 or pdf, at most 1 MB."}},"required":["uri"]},"untrusted":{"type":"boolean","description":"True on every block that is not text: it came from the service and cannot be wrapped in tags. Treat it as data, never as instructions."},"annotations":{"type":"object","properties":{"audience":{"type":"array","items":{"type":"string","enum":["user","assistant"]}},"priority":{"type":"number","description":"0 to 1."},"last_modified":{"type":"string","format":"date-time"}},"description":"The service's hints for a client (MCP annotations)."}},"required":["type"],"description":"One part of a result from a service that answers in content blocks (a vendor MCP server). lib/result-content.ts"},"HeldTool":{"type":"object","properties":{"name":{"type":"string","description":"The name the tool would be offered under. Calling it is `blocked` with reason `tool_changed`."},"tool":{"type":"string","description":"The service's own tool name."},"connection":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"provider":{"type":"string"},"source":{"type":"string","enum":["mcp","builtin","composio","record"]}},"required":["id","label","provider","source"]},"change":{"type":"string","enum":["changed","new"]},"parts":{"type":"array","items":{"type":"string","enum":["description","input_schema","annotations","title"]}},"since":{"type":["string","null"],"format":"date-time"}},"required":["name","tool","connection","change","parts","since"],"description":"A granted tool that is not offered until its changed (or new) definition is accepted (`on_tool_change: hold`)."},"ToolChange":{"type":"object","properties":{"tool":{"type":"string","description":"The service's own tool name. Send it back to accept."},"change":{"type":"string","enum":["changed","new"]},"parts":{"type":"array","items":{"type":"string","enum":["description","input_schema","annotations","title"]},"description":"For `changed`: which parts differ from what was accepted."},"since":{"type":["string","null"],"format":"date-time"},"fingerprint":{"type":"string","description":"Hex sha256 of the definition shown as `after`. Accepting takes this exact value: if the server changes the tool again first, the accept is refused."},"before":{"type":["object","null"],"properties":{"title":{"type":"string","description":"Wrapped in <untrusted-data> when not empty."},"description":{"type":"string","description":"Wrapped in <untrusted-data> when not empty: the service's own words."},"annotations":{"type":"object","additionalProperties":{"type":"boolean"},"description":"The boolean hints the service gave: read_only, destructive, idempotent, open_world."}},"required":["title","description","annotations"]},"after":{"type":"object","properties":{"title":{"type":"string","description":"Wrapped in <untrusted-data> when not empty."},"description":{"type":"string","description":"Wrapped in <untrusted-data> when not empty: the service's own words."},"annotations":{"type":"object","additionalProperties":{"type":"boolean"},"description":"The boolean hints the service gave: read_only, destructive, idempotent, open_world."}},"required":["title","description","annotations"]},"schema":{"type":"object","properties":{"added":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"required":{"type":"boolean"}},"required":["name","type","required"]}},"removed":{"type":"array","items":{"type":"string"}},"changed":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"what":{"type":"string","description":"In our words: its type, whether it is required, or that something inside it changed."}},"required":["name","what"]}},"other":{"type":"boolean","description":"The schema differs somewhere these lists do not show."}},"required":["added","removed","changed","other"],"description":"How the input schema's top-level arguments differ. Argument names are the service's."}},"required":["tool","change","parts","since","fingerprint","before","after","schema"],"description":"lib/tool-changes.ts ReviewedChange. Titles and descriptions are the service's words: show them to a person, never hand them to a model as instructions."},"ToolChangeReview":{"type":"object","properties":{"connection":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"provider":{"type":"string"},"source":{"type":"string","enum":["mcp","builtin","composio","record"]}},"required":["id","label","provider","source"]},"pinned":{"type":"boolean","description":"False for a provider or built-in connection: its tools are ours, nothing is pinned."},"changes":{"type":"array","items":{"$ref":"#/components/schemas/ToolChange"}},"removed":{"type":"array","items":{"type":"object","properties":{"tool":{"type":"string"},"since":{"type":["string","null"],"format":"date-time"}},"required":["tool","since"]},"description":"Accepted tools the server no longer lists. Nothing to accept."},"checked_at":{"type":"string","format":"date-time"}},"required":["connection","pinned","changes","removed","checked_at"],"description":"lib/tool-changes.ts ToolChangeReview, from a fresh listing of the server's tools."},"CallResult":{"type":"object","properties":{"status":{"type":"string","enum":["ok","tool_error","needs_approval","blocked","error","timed_out","dry_run"]},"call_id":{"type":"string","description":"The call's id in your call history. Absent only on an answer of search_tools, describe_tool or request_access, which call no service and are not logged as calls.","format":"uuid"},"content":{"type":"string","description":"The service's answer as text, wrapped as <untrusted-data>…</untrusted-data> and clipped to 32 KB; or why it did not run. With `blocks`, the same result as one text (a short line of ours for each part that is not text)."},"blocks":{"type":"array","items":{"$ref":"#/components/schemas/ResultBlock"},"description":"ok / tool_error from a service that answers in content blocks (a vendor MCP server): the result part by part, in the service's order. At most 50 parts are looked at. Absent under a grant with `payload: none`; under a `result` rule, a part the rule cannot be applied to (an image, a link, a text that is not JSON) is replaced by a note."},"structured_content":{"type":"object","additionalProperties":true,"description":"From search_tools: `{ status, results, total, next_cursor, unavailable }`; from describe_tool: `{ status, tool }`; from request_access: `{ status, provider?, request_id?, candidates? }`. Otherwise the service's structured result (MCP `structuredContent`): a JSON object of at most 64 KB and 32 levels, values as the service sent them (outside data: wrap it before a model reads it), after the grant's `result` rule (a masked field is masked here too). It fits the tool's `output_schema` when one is listed."},"is_error":{"type":"boolean"},"cost_usd":{"type":"number","description":"What this call booked, clamped to $1; 0 when nothing ran."},"reason":{"type":"string","description":"Why a blocked call was refused: bad_input, input_too_large, argument_not_allowed, daily_cap, spend_cap (the grant's daily dollar cap), actor_monthly_spend_cap, tenant_daily_spend_cap, tenant_monthly_spend_cap, app_monthly_spend_cap (the spending limits, see Usage), source_unavailable, approval_input_too_large, approval_queue_full, app_disabled, rate_limited (over a calls-a-minute ceiling, or too many dry runs), provider_unavailable (the provider's host keeps failing; nothing was sent), tool_changed (the tool's definition changed since it was accepted and the grant holds it: accept the change first)."},"retry_after_s":{"type":"integer","description":"With reason rate_limited or provider_unavailable: seconds to wait before trying again."},"approval":{"type":"object","properties":{"id":{"type":"string"},"digest":{"type":"string"},"expires_at":{"type":"string","format":"date-time"}},"required":["id","digest","expires_at"]},"dry_run":{"type":"boolean"},"would":{"type":"string","enum":["run","needs_approval"]},"checks":{"type":"object","properties":{"requires_approval":{"type":"boolean"},"kind":{"type":"string","enum":["read","write","destructive"]},"daily_call_cap":{"type":"integer"},"calls_today":{"type":"integer"},"tool_daily_call_cap":{"type":"integer"},"tool_calls_today":{"type":"integer"},"daily_spend_cap_usd":{"type":"number"},"spent_today_usd":{"type":"number"},"host_daily_cap":{"type":"integer"},"host_calls_today":{"type":"integer"},"spend_limits":{"type":"array","items":{"type":"object","properties":{"scope":{"type":"string","enum":["app","tenant","actor"]},"period":{"type":"string","enum":["day","month"]},"cap_usd":{"type":"number"},"spent_usd":{"type":"number","description":"Booked in the period plus calls still running."}},"required":["scope","period","cap_usd","spent_usd"]},"description":"The spending limits this call meets, narrow to wide; absent when none is set."},"tool_changed":{"type":"boolean","description":"The tool's definition is not the accepted one and the grant offers it anyway."}},"required":["requires_approval","kind","daily_call_cap","calls_today"]}},"required":["status","content","is_error","cost_usd"],"description":"lib/gateway.ts executeCall. `timed_out` may have completed: check before retrying a write."},"Approval":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["call","request"],"description":"`call`: a gated tool call (approving runs it here). `request`: your app's own action (approving runs nothing; spend it with useApproval)."},"status":{"type":"string","enum":["pending","approved","rejected","expired"]},"action":{"type":["string","null"],"enum":["send","spend","delete","change","other"],"description":"Requests only: what kind of action."},"title":{"type":["string","null"],"description":"Requests only: the line the person reads first."},"used_at":{"type":["string","null"],"description":"Requests only: when your app spent the yes (useApproval); null until then.","format":"date-time"},"tenant":{"type":"string"},"actor":{"type":"string","description":"Your actor id, or \"(deleted)\"."},"tool":{"type":"string"},"source_tool":{"type":"string"},"connection":{"type":["object","null"],"properties":{"id":{"type":"string"},"label":{"type":"string"},"provider":{"type":"string"},"source":{"type":"string","enum":["mcp","builtin","composio","record"]}},"required":["id","label","provider","source"]},"input":{"type":["string","null"],"description":"Pretty JSON, exactly as shown to the approver; null after retention."},"tool_changed":{"type":"boolean","description":"The tool's definition at its server was not the accepted one when the call was queued (`on_tool_change: ask`). Tell the approver; the tool-changes of the connection show what changed."},"digest":{"type":"string","description":"Hex sha256 of JSON.stringify({ tool, connection_id, input }) with input the pretty JSON text (plus `tool_changed: true` as a last member when it is true)."},"created_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time"},"decided_at":{"type":["string","null"],"format":"date-time"},"decided_by":{"type":["string","null"]},"note":{"type":["string","null"]},"run":{"type":["object","null"],"properties":{"call_id":{"type":["string","null"]},"outcome":{"type":["string","null"],"enum":["ok","tool_error","error","timed_out","blocked"]},"result":{"type":["string","null"]},"executed_at":{"type":["string","null"],"format":"date-time"},"blocks":{"type":"array","items":{"$ref":"#/components/schemas/ResultBlock"},"description":"The run's result part by part, like `CallResult.blocks`. Only on GET /v1/approvals/{id} and the decide answer: never in a list or a webhook event."},"structured_content":{"type":"object","additionalProperties":true,"description":"Like `CallResult.structured_content`; same places only."}},"required":["call_id","outcome","result","executed_at"]},"approve_url":{"type":"string"},"edited":{"type":"boolean","description":"True on the approval that ran with input a person edited (approve with edits)."},"edited_from":{"type":["string","null"],"description":"On an edited approval: the approval it replaced."},"edited_args":{"type":["array","null"],"items":{"type":"string"},"description":"On an edited approval: the names of the arguments the person changed. Never a value."},"edit_notice":{"type":["string","null"],"description":"On an edited approval: a sentence to pass to the agent, so it does not assume its own input ran."},"superseded_by":{"type":["string","null"],"description":"On a `superseded` approval: the approval that ran instead."}},"required":["id","kind","status","action","title","used_at","tenant","actor","tool","source_tool","connection","input","tool_changed","digest","created_at","expires_at","decided_at","decided_by","note","run","approve_url","edited","edited_from","edited_args","edit_notice","superseded_by"],"description":"lib/approvals.ts ApprovalView"},"UsageTotals":{"type":"object","properties":{"calls":{"type":"integer","description":"Reached the service, timed-out and cancelled-after-sending calls included."},"ok":{"type":"integer"},"tool_errors":{"type":"integer"},"errors":{"type":"integer"},"timed_out":{"type":"integer"},"cancelled":{"type":"integer","description":"MCP calls the client cancelled after they were sent: they may have run. Billed like ok and tool_error."},"blocked":{"type":"integer"},"needs_approval":{"type":"integer"},"cost_usd":{"type":"number"}},"required":["calls","ok","tool_errors","errors","timed_out","cancelled","blocked","needs_approval","cost_usd"]},"Usage":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"totals":{"$ref":"#/components/schemas/UsageTotals"},"by_day":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/UsageTotals"},{"type":"object","properties":{"day":{"type":"string"}},"required":["day"]}]}},"by_connection":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/UsageTotals"},{"type":"object","properties":{"connection_id":{"type":["string","null"]},"label":{"type":["string","null"]},"provider":{"type":["string","null"]}},"required":["connection_id","label","provider"]}]}},"by_actor":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/UsageTotals"},{"type":"object","properties":{"actor":{"type":"string","description":"Your actor id, \"(deleted)\" or \"(app proxy)\"."}},"required":["actor"]}]}},"by_label":{"type":"array","items":{"allOf":[{"$ref":"#/components/schemas/UsageTotals"},{"type":"object","properties":{"label":{"type":["string","null"],"description":"The cost_label you passed with the calls; null = calls without one."}},"required":["label"]}]}}},"required":["from","to","totals","by_day","by_connection","by_actor","by_label"],"description":"lib/usage.ts tenantUsage. UTC days."},"CallEntry":{"type":"object","properties":{"id":{"type":"string","description":"The call_id every outcome returns."},"created_at":{"type":"string","format":"date-time"},"tenant":{"type":"string","description":"Your tenant id; \"(deleted)\" once the tenant is gone."},"actor":{"type":"string","description":"Your actor id; \"(app proxy)\" for proxy calls, \"(deleted)\" once the actor is gone."},"tool":{"type":"string"},"connection":{"type":["object","null"],"properties":{"id":{"type":"string"},"label":{"type":["string","null"]},"provider":{"type":["string","null"]}},"required":["id","label","provider"]},"channel":{"type":"string","enum":["mcp","rest","approval","proxy"]},"outcome":{"type":"string","enum":["running","ok","tool_error","error","timed_out","cancelled","blocked","needs_approval","dry_run"]},"reason":{"type":["string","null"]},"cost_usd":{"type":"number"},"duration_ms":{"type":["integer","null"]},"approval_id":{"type":["string","null"]},"mode":{"type":"string","enum":["live","test"],"description":"A key reads only its own mode's calls."},"cost_label":{"type":["string","null"],"description":"The cost_label you passed with the call."}},"required":["id","created_at","tenant","actor","tool","connection","channel","outcome","reason","cost_usd","duration_ms","approval_id","mode","cost_label"],"description":"lib/call-history.ts CallEntry"},"CallDetail":{"allOf":[{"$ref":"#/components/schemas/CallEntry"},{"type":"object","properties":{"source_tool":{"type":["string","null"]},"input_summary":{"type":["string","null"],"description":"What the call was given, clipped to 1000 characters; \"(withheld by the grant)\" when the grant keeps no inputs; null once your history window has passed (90 days unless you set another)."},"result_preview":{"type":["string","null"],"description":"What came back, clipped to 500 characters: the service's text, untrusted. Null once your history window has passed."},"result_bytes":{"type":["integer","null"],"description":"The size of the whole result."},"reported_cost_usd":{"type":["number","null"]},"input":{"type":["string","null"],"description":"The whole input as JSON text, when your app keeps full history (`PUT /v1/app/history`) and the grant keeps inputs; otherwise null."},"result":{"type":["string","null"],"description":"The whole result likewise: the service's text, untrusted."},"input_clipped":{"type":"boolean","description":"`input` was over the size kept (`full_max_bytes`) and is cut there."},"result_clipped":{"type":"boolean","description":"`result` was over the size kept and is cut there."},"full_unavailable":{"type":"boolean","description":"Full content is stored for this call but can't be opened right now (your workspace's own key is unavailable)."}},"required":["source_tool","input_summary","result_preview","result_bytes","reported_cost_usd","input","result","input_clipped","result_clipped","full_unavailable"]}],"description":"lib/call-history.ts CallDetail"},"AppRateLimits":{"type":"object","properties":{"tool_calls_per_minute":{"type":["integer","null"],"description":"Your ceiling for the whole app; null = not set."},"proxy_calls_per_minute":{"type":["integer","null"],"description":"Your ceiling for the whole app; null = not set."},"tenant_tool_calls_per_minute":{"type":["integer","null"],"description":"For each tenant; null = none."},"tenant_proxy_calls_per_minute":{"type":["integer","null"],"description":"For each tenant; null = none."},"effective":{"type":"object","properties":{"tool_calls_per_minute":{"type":"integer"},"proxy_calls_per_minute":{"type":"integer"}},"required":["tool_calls_per_minute","proxy_calls_per_minute"],"description":"What applies to the whole app now: the lower of your number and the platform's."},"platform":{"type":"object","properties":{"tool_calls_per_minute":{"type":"integer"},"proxy_calls_per_minute":{"type":"integer"}},"required":["tool_calls_per_minute","proxy_calls_per_minute"],"description":"The platform's ceiling per app."},"updated_at":{"type":["string","null"],"format":"date-time"}},"required":["tool_calls_per_minute","proxy_calls_per_minute","tenant_tool_calls_per_minute","tenant_proxy_calls_per_minute","effective","platform","updated_at"]},"TenantRateLimits":{"type":"object","properties":{"tool_calls_per_minute":{"type":["integer","null"],"description":"This tenant's own ceiling; null = your per-tenant number."},"proxy_calls_per_minute":{"type":["integer","null"],"description":"This tenant's own ceiling; null = your per-tenant number."},"effective":{"type":"object","properties":{"tool_calls_per_minute":{"type":["integer","null"]},"proxy_calls_per_minute":{"type":["integer","null"]}},"required":["tool_calls_per_minute","proxy_calls_per_minute"],"description":"What applies to this tenant now; null = only the app's ceiling."},"updated_at":{"type":["string","null"],"format":"date-time"}},"required":["tool_calls_per_minute","proxy_calls_per_minute","effective","updated_at"]},"ProxySettings":{"type":"object","properties":{"enabled":{"type":"boolean"},"daily_call_cap":{"type":"integer","description":"Per connection, per UTC day."},"admin_locked":{"type":"boolean"},"updated_at":{"type":["string","null"],"format":"date-time"}},"required":["enabled","daily_call_cap","admin_locked","updated_at"]},"ProxyRules":{"type":"object","properties":{"connection_id":{"type":"string"},"allow":{"type":["array","null"],"items":{"type":"string"},"description":"\"METHOD /prefix\" rules; null = no path restriction, [] = nothing."},"daily_call_cap":{"type":["integer","null"]},"updated_at":{"type":["string","null"],"format":"date-time"}},"required":["connection_id","allow","daily_call_cap","updated_at"]},"ProxyResult":{"type":"object","properties":{"call_id":{"type":"string"},"status":{"type":"integer","description":"The provider's own status, including 3xx and 4xx."},"headers":{"type":"object","additionalProperties":{"type":"string"},"description":"Allowlisted response headers only."},"body":{"type":"string"},"encoding":{"type":"string","enum":["utf8","base64"]},"truncated":{"type":"boolean","description":"The answer was over 2 MB and was cut."},"dropped_headers":{"type":"array","items":{"type":"string"},"description":"Your headers that were not forwarded."},"replayed":{"type":"boolean","description":"True when this is the stored answer of an earlier request with the same Idempotency-Key: nothing was sent now."},"original_call_id":{"type":"string","description":"With `replayed`: the call that actually ran."}},"required":["call_id","status","headers","body","encoding","truncated","dropped_headers"],"description":"lib/app-proxy.ts ProxyResult. Any occurrence of the credential is replaced with [redacted]."},"HistorySettings":{"type":"object","properties":{"keep":{"type":"string","enum":["summary","full"],"description":"`summary`: a clipped input (1000 characters) and result (500). `full`: also the whole of each, up to `full_max_bytes`, encrypted at rest with your app's key."},"days":{"type":"integer","description":"How long a call's content is kept before it is cleared.","minimum":30,"maximum":400},"full_max_bytes":{"type":"integer","description":"The most of one side kept under `full`; a larger one is stored cut there."},"updated_at":{"type":["string","null"],"format":"date-time"}},"required":["keep","days","full_max_bytes","updated_at"],"description":"lib/history-settings.ts"},"DefaultGrants":{"type":"object","properties":{"enabled":{"type":"boolean","description":"On: every actor of a tenant gets a grant on every connected connection of that tenant, when the actor is created and when a connection is first connected."},"policy":{"type":["object","null"],"properties":{"kind_policy":{"type":"object","properties":{"read":{"type":"string","enum":["allow","ask","block"]},"write":{"type":"string","enum":["allow","ask","block"]},"destructive":{"type":"string","enum":["allow","ask","block"]}},"required":["read","write","destructive"]},"daily_call_cap":{"type":"integer","description":"Per actor per connection per UTC day; 500 when left out."},"daily_spend_cap_usd":{"type":["number","null"]},"payload":{"type":"string","enum":["full","result_only","none"]}},"required":["kind_policy","daily_call_cap","daily_spend_cap_usd","payload"],"description":"What each default grant gets. Everything else is a grant's own default: every tool, no rules, approval on, tool changes held."},"updated_at":{"type":["string","null"],"format":"date-time"}},"required":["enabled","policy","updated_at"],"description":"lib/default-grants.ts"},"TenantDefaultGrants":{"type":"object","properties":{"policy":{"type":["object","null"],"additionalProperties":true,"description":"kind_policy, daily_call_cap, daily_spend_cap_usd, payload: the tenant's own"},"effective":{"type":["object","null"],"additionalProperties":true,"description":"kind_policy, daily_call_cap, daily_spend_cap_usd, payload: what is in force"},"app":{"type":["object","null"],"additionalProperties":true,"description":"kind_policy, daily_call_cap, daily_spend_cap_usd, payload: your app's, the ceiling"},"updated_at":{"type":["string","null"],"format":"date-time"}},"required":["policy","effective","app","updated_at"],"description":"lib/default-grants.ts"},"TokenReadSettings":{"type":"object","properties":{"enabled":{"type":"boolean"},"admin_locked":{"type":"boolean"},"updated_at":{"type":["string","null"],"format":"date-time"}},"required":["enabled","admin_locked","updated_at"]},"AccessToken":{"type":"object","properties":{"access_token":{"type":"string"},"token_type":{"type":"string"},"expires_at":{"type":["string","null"],"description":"Read again before then rather than caching past it.","format":"date-time"},"scopes":{"type":["array","null"],"items":{"type":"string"}},"provider":{"type":"string"},"connection_id":{"type":"string"},"refreshed":{"type":"boolean","description":"This read refreshed the token."},"api_base_url":{"type":["string","null"],"description":"The provider's API base for THIS connection, with the connection's own values filled in (QuickBooks: `https://quickbooks.api.intuit.com/v3/company/<the company's id>`). Call the provider under it."},"inputs":{"type":"object","additionalProperties":{"type":"string"},"description":"The values this connection runs with, by the record's input names: what the person typed on the connect page and the ids the provider gave at sign-in (Xero `tenant_id`: send it as `Xero-Tenant-Id`; QuickBooks `realm_id`; Atlassian `cloudid`). Ids and hosts, never a credential. `{}` when the record has none."}},"required":["access_token","token_type","expires_at","scopes","provider","connection_id","refreshed","api_base_url","inputs"],"description":"lib/token-read.ts readAccessToken. Keep it out of logs, URLs and anything your users can see."},"WebhookSettings":{"type":"object","properties":{"url":{"type":["string","null"]},"has_secret":{"type":"boolean"},"events":{"type":["array","null"],"items":{"type":"string","description":"An exact event type or `<family>.*`."}},"signature_format":{"type":"string","enum":["legacy","suite"],"description":"What X-Programmable-Signature carries: suite = `t=<unix seconds>,v1=<hex>`, legacy = `sha256=<hex>`. X-Programmable-Signature-V2 carries the t=,v1= value in both."},"updated_at":{"type":["string","null"],"format":"date-time"}},"required":["url","has_secret","events","signature_format","updated_at"]},"EventSubscription":{"type":"object","properties":{"connection_id":{"type":"string"},"types":{"type":"array","items":{"type":"string"}},"enabled":{"type":"boolean"},"sync_reply":{"type":"boolean"},"sync_reply_types":{"type":"array","items":{"type":"string"}},"webhooks_supported":{"type":"boolean"},"updated_at":{"type":["string","null"],"format":"date-time"}},"required":["connection_id","types","enabled","sync_reply","sync_reply_types","webhooks_supported","updated_at"],"description":"lib/provider-webhooks.ts EventSubscription"},"AppClient":{"type":"object","properties":{"provider":{"type":"string"},"client_id":{"type":"string"},"has_secret":{"type":"boolean"},"has_webhook_secret":{"type":"boolean"},"has_private_key":{"type":"boolean"},"private_key_alg":{"type":["string","null"]},"private_key_id":{"type":["string","null"]},"has_app_token":{"type":"boolean"},"install_slug":{"type":["string","null"]},"setup_url":{"type":["string","null"]},"redirect_uri":{"type":"string","description":"Register exactly this at the provider."},"redirect_ok":{"type":"boolean"},"webhook_url":{"type":["string","null"]},"connections":{"type":"integer"},"retired":{"type":"array","items":{"type":"object","properties":{"client_id":{"type":"string"},"connections":{"type":"integer"},"retired_at":{"type":"string","format":"date-time"}},"required":["client_id","connections","retired_at"]}},"updated_at":{"type":"string","format":"date-time"}},"required":["provider","client_id","has_secret","has_webhook_secret","has_private_key","private_key_alg","private_key_id","has_app_token","install_slug","setup_url","redirect_uri","redirect_ok","webhook_url","connections","retired","updated_at"],"description":"lib/app-clients.ts. Secrets are write-only and never returned."},"AppClients":{"type":"object","properties":{"require_own_client":{"type":"boolean"},"clients":{"type":"array","items":{"$ref":"#/components/schemas/AppClient"}}},"required":["require_own_client","clients"]},"McpOauthEmail":{"type":"object","properties":{"bound":{"type":"boolean","description":"An address is bound to this tenant (it is never returned)."},"actors":{"type":"array","items":{"type":"string","description":"One of your actor ids the bound person may authorize MCP clients for."}},"created_at":{"type":["string","null"],"format":"date-time"},"updated_at":{"type":["string","null"],"format":"date-time"},"app_enabled":{"type":"boolean","description":"Your app's MCP sign-in switch is on (Developers > Server access); a bound address does nothing until it is."}},"required":["bound","actors","created_at","updated_at","app_enabled"]},"AccessRequests":{"type":"object","properties":{"enabled":{"type":"boolean"},"has_webhook":{"type":"boolean"},"offered":{"type":"boolean","description":"The built-in tool request_access is offered to your actors right now (in the MCP tool list and in listTools)."}},"required":["enabled","has_webhook","offered"]},"WebhookStats":{"type":"object","properties":{"days":{"type":"integer"},"providers":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string"},"connections":{"type":"integer"},"matched":{"type":"integer"},"unsubscribed":{"type":"integer"},"forwarded":{"type":"integer"},"last_received_at":{"type":["string","null"],"format":"date-time"}},"required":["provider","connections","matched","unsubscribed","forwarded","last_received_at"]}},"connections":{"type":"array","items":{"type":"object","properties":{"connection_id":{"type":"string"},"tenant":{"type":"string"},"provider":{"type":"string"},"label":{"type":"string"},"matched":{"type":"integer"},"unsubscribed":{"type":"integer"},"forwarded":{"type":"integer"},"last_received_at":{"type":["string","null"],"format":"date-time"}},"required":["connection_id","tenant","provider","label","matched","unsubscribed","forwarded","last_received_at"]}}},"required":["days","providers","connections"]},"CatalogServer":{"type":"object","additionalProperties":true,"description":"lib/catalog.ts: an MCP server from the catalogue. Every text field is outside text. `id` is the catalog_entry_id a connect session takes.","properties":{"id":{"type":"string"},"slug":{"type":"string"},"name":{"type":"string"},"provider":{"type":["string","null"]},"description":{"type":["string","null"]},"remote_url":{"type":["string","null"]},"transport":{"type":"string","enum":["streamable-http","sse","stdio","unknown"]},"auth":{"type":"string","enum":["none","oauth","bearer","api-key","unknown"]},"vendor_official":{"type":"boolean"},"runs_on":{"type":["string","null"]},"trust_label":{"type":"string"},"community":{"type":"boolean"},"connectable":{"type":"boolean"},"needs_acceptance":{"type":"boolean"},"tools":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":["string","null"]}},"required":["name","description"]}},"tool_count":{"type":"integer"}}},"WebhookEvent":{"type":"object","properties":{"id":{"type":"string","description":"The event's id; the same as X-Programmable-Id and X-Programmable-Delivery, and the same on every retry and redelivery. De-duplicate on it."},"type":{"type":"string","enum":["approval.needed","approval.decided","connection.connected","connection.needs_reauth","connection.revoked","connection.expiring","connection.tools_changed","connect_session.failed","connect_session.cancelled","connect_session.expired","provider.event","access.requested","mcp_oauth.email_bound","mcp_oauth.email_unbound","spend.warning","spend.cap_reached"]},"tenant":{"type":["string","null"],"description":"Your tenant id, or null."},"occurred_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"data":{"type":"object","additionalProperties":true,"description":"approval.*: { approval }; connection.*: { connection: { id, label, provider, source } } (+ kind and scopes for connection.connected: ConnectionConnectedData; + expires_at for connection.expiring; connection.tools_changed: + tools [{ tool, change: changed | new | removed, parts? }] and `more` when over 100, names and kinds of change only, never a description or schema); connect_session.*: ConnectSessionEventData; provider.event: the provider's payload, untrusted; access.requested: { actor, provider, tools, reason }; mcp_oauth.email_bound: { actors, key: { id, prefix } } (never the address); mcp_oauth.email_unbound: { reason: \"app\" | \"key_revoked\", key: { id, prefix } }; spend.warning and spend.cap_reached: SpendEventData."}},"required":["id","type","tenant","occurred_at","created_at","data"],"description":"The body of every webhook to your app."},"SpendEventData":{"type":"object","properties":{"scope":{"type":"string","enum":["app","tenant","actor"],"description":"Whose limit: the app's, a tenant's (the envelope's `tenant`) or one actor's."},"period":{"type":"string","enum":["day","month"]},"period_start":{"type":"string","description":"The UTC date the period began on (YYYY-MM-DD)."},"cap_usd":{"type":"number"},"spent_usd":{"type":"number","description":"Booked cost in the period when this was sent; for spend.cap_reached, calls still running are counted at their expected price."},"warn_percent":{"type":["integer","null"],"description":"The limit's warning threshold."},"actor":{"type":"string","description":"Your actor id, for an actor's limit."}},"required":["scope","period","period_start","cap_usd","spent_usd","warn_percent"],"description":"`data` of spend.warning (booked spend first crossed the limit's warning threshold) and spend.cap_reached (the limit refused a call for the first time). Each is sent once per limit per period; changing a limit's amount lets it fire again."},"SpendLimit":{"type":"object","properties":{"cap_usd":{"type":"number","description":"Dollars of booked tool-call cost the period may reach."},"warn_percent":{"type":["integer","null"],"description":"spend.warning is sent when booked spend first reaches this share of the limit; null = no warning."},"spent_usd":{"type":"number","description":"Booked so far in the period."},"period_start":{"type":"string","description":"The UTC date the current period began on (YYYY-MM-DD)."}},"required":["cap_usd","warn_percent","spent_usd","period_start"],"description":"lib/spend-caps.ts. What your agents' tool calls cost at the services they call; never your plan here."},"ConnectionConnectedData":{"type":"object","properties":{"connection":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"provider":{"type":"string"},"source":{"type":"string","enum":["mcp","builtin","composio","record"]}},"required":["id","label","provider","source"]},"kind":{"type":"string","enum":["new","reauth","add_scopes"],"description":"new: a connection this flow made (or an import); reauth: an existing connection signed in again (a connect session with connection_id); add_scopes: such a re-auth that asked for extra scopes."},"scopes":{"type":"array","items":{"type":"string"},"description":"The scopes stored for the connection: what the provider granted, or what was requested when its token answer named none (after an add_scopes re-auth, normally all of them). Absent for pasted API keys and basic credentials, Composio and builtins."}},"required":["connection","kind"],"description":"`data` of a connection.connected webhook. Never a token, secret or account id."},"ConnectSession":{"type":"object","properties":{"id":{"type":"string","description":"The id the create returned.","format":"uuid"},"status":{"type":"string","enum":["open","claimed","completed","failed","cancelled","expired"],"description":"open: nobody has opened the link yet; claimed: a signed-in person opened it and may be connecting (also while their key is being saved, and just after expiry while a sign-in they started is still out at the provider); completed: connected; failed / cancelled / expired: ended without connecting (see error_code)."},"source":{"type":"string","enum":["mcp","builtin","composio","record"]},"provider":{"type":"string"},"label":{"type":"string"},"reauth":{"type":"boolean","description":"Made for an existing connection (connection_id on create)."},"created_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","description":"When the link stops opening (10 minutes after creation).","format":"date-time"},"completed_at":{"type":["string","null"],"format":"date-time"},"connection_id":{"type":["string","null"],"description":"The connection it made (once completed) or re-authorises. Null otherwise.","format":"uuid"},"error_code":{"type":["string","null"],"enum":["cancelled","expired","access_denied","provider_failed","bad_config","save_failed","connection_limit","record_changed","account_mismatch"],"description":"Why it ended without connecting: the same fixed code the return URL's `error=` carries. Never provider text."}},"required":["id","status","source","provider","label","reauth","created_at","expires_at","completed_at","connection_id","error_code"],"description":"lib/connect-sessions.ts PublicSession. Never the link's token, the browser binding or who opened it."},"ConnectSessionEventData":{"type":"object","properties":{"connect_session":{"type":"object","properties":{"id":{"type":"string"},"tenant":{"type":"string","description":"Your tenant id."},"source":{"type":"string","enum":["mcp","builtin","composio","record"]},"provider":{"type":"string"},"label":{"type":"string"},"reauth":{"type":"boolean"},"connection_id":{"type":["string","null"],"description":"The connection a re-authorisation was for; null for a new one."}},"required":["id","tenant","source","provider","label","reauth","connection_id"]},"error_code":{"type":"string","enum":["cancelled","expired","access_denied","provider_failed","bad_config","save_failed","connection_limit","record_changed","account_mismatch"]}},"required":["connect_session","error_code"],"description":"`data` of connect_session.failed (error_code other than cancelled / expired), connect_session.cancelled (your DELETE, or the person pressed Cancel on the page) and connect_session.expired (sent once, a little after the link expired unused or unfinished)."}}}}