# Programmable Dev documentation Base URL: https://programmable.dev. OpenAPI: https://programmable.dev/openapi.json. ## How it fits together Your server holds an app key; your agents hold short-lived tokens; people connect their accounts on our page. Programmable Dev sits between your AI agents and the services they use. Three kinds of caller, three credentials: - **Your server** calls the app API (`/v1/…`) with your app key, `Authorization: Bearer pd_live_…`. It creates tenants (your customers) and actors (their agents), starts connect sessions, sets grants and reads usage. - **Your agents** call the MCP endpoint (`/mcp/:tenant/:actor`) with a token your server mints for them, `pdt_…`, valid for at most 15 minutes. They see only the tools their grants allow. - **People** connect their accounts on our hosted page. Their keys and OAuth tokens never pass through your app or your agents. Every tool call goes through the same checks: the grant, a daily cap, an optional human approval, billing, and a log row with its cost. Results from outside services come back marked as untrusted data. **Which ids to use.** You name tenants and actors with your own ids; we never invent them. | Thing | What it is | Use as its id | | --- | --- | --- | | Tenant | Whoever owns the connected accounts: one of your customers, workspaces or users. Connections, usage and limits belong to it, and one tenant never sees another's. | Your own id for that customer or user | | Actor | One caller inside a tenant: an agent, a bot, a workflow. Grants, caps and the call log are per actor. | Your own id for that agent | | Connection | One signed-in account or key of a tenant (their Slack, their GitHub). Several actors can be granted the same connection. | Ours (a UUID); keep it next to your record, or find it again by `metadata` | A person who uses several agents is one tenant with several actors, not several tenants. The server proxy and token read act for the tenant and name no actor. Ids are 1 to 128 characters of `A-Z a-z 0-9 . _ : -`. The full machine-readable contract is at [/openapi.json](https://programmable.dev/openapi.json). A summary for language models is at [/llms.txt](https://programmable.dev/llms.txt). ## Quickstart: your first proxied call From an app key to a call to GitHub through a user's connection, in about five minutes. You need an account on the dashboard and an account at a provider to connect. This guide uses GitHub; any id from [GET /v1/providers](https://programmable.dev/docs#op-listProviders) works the same way. Each step shows curl; the same calls in the SDKs are at the end. **1. Make an app key.** On the dashboard, open [Developers](https://programmable.dev/dashboard/developers) and make a key. It is shown once; keep it in your server's secrets. ```bash export PD_APP_KEY=pd_live_… ``` **2. Let connect sessions return to your site.** On [Connections](https://programmable.dev/dashboard/connections), add your site's origin (for example `https://app.example.com`) under Return origins. It must be https. **3. Create a tenant and an actor.** A tenant is one of your customers; an actor is one of their agents. Both use your own ids and are created on first use. ```bash curl -X POST https://programmable.dev/v1/tenants/acme \ -H "Authorization: Bearer $PD_APP_KEY" -H "Content-Type: application/json" \ -d '{"name":"Acme Inc"}' curl -X POST https://programmable.dev/v1/tenants/acme/actors/support-bot \ -H "Authorization: Bearer $PD_APP_KEY" ``` **4. Connect GitHub.** Start a connect session and open the `url` it returns. Sign in, approve GitHub, and your browser comes back to `return_url` with `result=connected&connection=`. ```bash curl -X POST https://programmable.dev/v1/tenants/acme/connect-sessions \ -H "Authorization: Bearer $PD_APP_KEY" -H "Content-Type: application/json" \ -d '{"source":"record","provider":"github","return_url":"https://app.example.com/connected"}' # → { "url": "https://programmable.dev/connect/pcs_…", "expires_at": "…" } (open it within 10 minutes) ``` **5. Turn the proxy on** for your app (it is off until you do). ```bash curl -X PUT https://programmable.dev/v1/app/proxy \ -H "Authorization: Bearer $PD_APP_KEY" -H "Content-Type: application/json" \ -d '{"enabled":true}' ``` **6. Call GitHub through the connection.** We add the user's token; you never see it. ```bash curl -X POST https://programmable.dev/v1/tenants/acme/connections/$CONNECTION_ID/proxy \ -H "Authorization: Bearer $PD_APP_KEY" -H "Content-Type: application/json" \ -d '{"method":"GET","path":"/user"}' # → { "call_id": "…", "status": 200, "headers": { … }, "body": "{\"login\":\"…\"}", "encoding": "utf8", "truncated": false, "dropped_headers": [] } ``` That is a proxied call. To let an agent use GitHub as tools instead, grant the connection to the actor and give the agent an MCP token: ```bash curl -X PUT https://programmable.dev/v1/tenants/acme/actors/support-bot/grants \ -H "Authorization: Bearer $PD_APP_KEY" -H "Content-Type: application/json" \ -d '{"grants":[{"connection_id":"'$CONNECTION_ID'","requires_approval":true,"daily_call_cap":50}]}' curl -X POST https://programmable.dev/v1/tenants/acme/actors/support-bot/tokens \ -H "Authorization: Bearer $PD_APP_KEY" # → { "token": "pdt_…", "expires_at": "…", "mcp_url": "https://programmable.dev/mcp/acme/support-bot" } ``` The same steps with the SDKs. The SDKs (`@programmable/dev` on npm, `programmable-dev` on PyPI) are not published yet. Every call below is a plain JSON request, so the curl lines work today. TypeScript: ```ts import { ProgrammableDev } from "@programmable/dev"; const pd = new ProgrammableDev(); // reads PD_APP_KEY await pd.upsertTenant("acme", { name: "Acme Inc" }); await pd.upsertActor("acme", "support-bot"); const { url } = await pd.createConnectSession("acme", { source: "record", provider: "github", return_url: "https://app.example.com/connected" }); // …send the person to url; they come back with ?connection= await pd.setProxySettings({ enabled: true }); const res = await pd.proxyRequest("acme", connectionId, { method: "GET", path: "/user" }); console.log(res.status, JSON.parse(res.body).login); ``` Python: ```python from programmable_dev import Client pd = Client() # reads PD_APP_KEY pd.upsert_tenant("acme", {"name": "Acme Inc"}) pd.upsert_actor("acme", "support-bot") url = pd.create_connect_session("acme", {"source": "record", "provider": "github", "return_url": "https://app.example.com/connected"})["url"] # …send the person to url; they come back with ?connection= pd.set_proxy_settings({"enabled": True}) res = pd.proxy_request("acme", connection_id, {"method": "GET", "path": "/user"}) print(res["status"], res["body"]) ``` ## App keys and authentication One Bearer key per server, two live at a time so you can rotate without downtime. Send your app key on every app API call: `Authorization: Bearer pd_live_…`. Cookies are ignored on these routes, so there is no CSRF surface. Make and rotate keys on the dashboard under [Developers](https://programmable.dev/dashboard/developers); each key is shown once. - At most 2 live keys per app. Rotating a key makes a new one at once and keeps the old one working for a grace period (24 hours by default), so you can roll the new key out first. - A revoked key stops at once, and so does every MCP token it minted. - 30 failed keys or tokens a minute from one address, then 429 for the rest of that minute. - Never put an app key in a browser, a mobile app or an agent's prompt. Agents get MCP tokens instead. MCP tokens (`pdt_…`) come from `POST /v1/tenants/:t/actors/:a/tokens`: 60-900 seconds, bound to one tenant and actor, returned once. They carry no grants: grants are read live on every call, so a change applies at once. Ids are yours: a tenant or actor id is 1-128 of `A-Z a-z 0-9 . _ : -`. Ids starting with `dashboard-` are kept for the dashboard's test account. ## Connect sessions Send a person to our page to connect an account; they come back to your site. `POST /v1/tenants/:t/connect-sessions` returns a `url` that works for 10 minutes and once. Send the person there (a redirect or a link). They sign in with Programmable, then paste a key or approve at the provider on our page. Keys never pass through your app. For a link sent by email, or opened on a phone, ask for longer with `ttl_seconds` (5 to 60 minutes) and pin it with `expected_email`. **The person needs a Programmable account.** The hosted page always signs them in with Programmable (they can make the account there, on the way); your app's own login is not accepted there, and there is no mode in which your app vouches for who they are. That is deliberate: the page takes credentials, so we check who is typing them. Tell people before you send them, and use `expected_email` when you know their address: it must match an address their sign-in verified. | source | What it connects | Body | | --- | --- | --- | | record | A provider from [GET /v1/providers](https://programmable.dev/docs#op-listProviders): GitHub, Google, Slack and others | `provider: ""`, optional `config.inputs` | | mcp | A remote MCP server | `config: { url, auth_mode? }` | | builtin | web_search, web_reader or apify | `provider`, `config` | | composio | Slack, Notion, GitHub, HubSpot, Airtable or Linear through Composio | `provider` | | (catalogue) | An MCP server from the catalogue | `catalog_entry_id` instead of `source` | When the person is done, their browser goes to `return_url` with: - `result=connected&connection=` on success. - `result=failed&error=` otherwise: `cancelled`, `expired`, `access_denied`, `provider_failed`, `bad_config`, `save_failed`, `connection_limit`, `record_changed` (start a new session) or `account_mismatch` (a re-authorisation signed in as a different provider account; nothing changed). A failed re-authorisation also carries `connection=`. `return_url`'s origin must be one of your app's return origins (dashboard, [Connections](https://programmable.dev/dashboard/connections)). Set `expected_email` so only that person can use the link: a leaked link is then useless to anyone else. To sign a connection in again, pass its `connection_id`. To ask for more scopes on a signed-in provider connection, add `add_scopes`; each must be in the provider's `scopes.allowed`. A tenant holds at most 100 connections. **Treat the redirect as a hint.** Anyone can open your `return_url` with any `result` and `connection` in it. Before you record a connection as made, confirm it from our side: the `connection.connected` webhook, or `GET /v1/tenants/:t/connect-sessions/:id` and the connection itself with your app key. You also get a `connection.connected` webhook when a session finishes, and `connect_session.failed`, `connect_session.cancelled` or `connect_session.expired` when it ends without connecting, so you don't depend on the redirect. The create answers with the session's `id`: `GET /v1/tenants/:t/connect-sessions/:id` says how it stands (`open`, `claimed`, `completed`, `failed`, `cancelled` or `expired`, with the same `error_code`), and `DELETE` cancels it (the link stops working at once). ## The proxy Your server calls a provider's API with a user's connection; the credential stays with us. For your own server code, not agents. `POST /v1/tenants/:t/connections/:id/proxy` with `{ method, path, query?, headers?, body?, body_encoding? }` sends the request to the provider's `api_base_url` + `path`, with the connection's credential added. You get the provider's status, allowlisted headers and body back. Any trace of the credential in the answer is replaced with `[redacted]`. - Off until you turn it on: `PUT /v1/app/proxy { "enabled": true }` (dashboard: Developers > Server access). - Provider connections (`source: "record"`) in status `connected` only. - The host must be on the provider's `allowed_hosts`, the path must stay under the base path, and it may not contain `//`, `.` or `..` segments, encoded slashes, `?` or `#`. Put query parameters in `query`. - Forwarded headers: `Accept`, `Content-Type`, `If-Match`, `If-None-Match`. Others are dropped and listed in `dropped_headers`. - Request body up to 1 MB; the answer is read to 2 MB (`truncated: true` past that); 25 seconds; redirects are returned, never followed. - After a 401, an OAuth token is refreshed once and the request retried once. A second 401 marks the connection `needs_reauth` (409 `NEEDS_REAUTH`). - 120 calls per connection per minute, and a daily cap per connection (default 1000). **Safe retries.** Send the header `Idempotency-Key: ` with a request that changes something (anything but a GET). If your call to us times out, repeat it with the same key and body: you get the first answer back (`replayed: true`) and the provider is not called twice. Keys are per connection, last 24 hours, and take letters, digits and `_ - : .` (up to 255). The key belongs to one request: another method, path, query or body under it is refused with 409 `IDEMPOTENCY_KEY_REUSED`. While the first request is still running a repeat gets 409 `IDEMPOTENCY_IN_FLIGHT` and a `Retry-After`. Two cases cannot be replayed and say so instead of calling the provider again: an answer over 256 KB (409 `IDEMPOTENCY_RESULT_TOO_LARGE`) and a request that was sent but never answered (409 `IDEMPOTENCY_OUTCOME_UNKNOWN`: it may have run, so check at the provider and use a new key). A provider's own error answer is stored and replayed like any other answer; to try again, use a new key. ```bash curl -X POST https://programmable.dev/v1/tenants/acme/connections/$CONNECTION_ID/proxy \ -H "Authorization: Bearer $PD_APP_KEY" -H "Content-Type: application/json" \ -H "Idempotency-Key: order-1042-refund" \ -d '{"method":"POST","path":"/v1/refunds","headers":{"Content-Type":"application/x-www-form-urlencoded"},"body":"charge=ch_123"}' ``` Narrow a connection with rules: `PUT /v1/tenants/:t/connections/:id/proxy/rules { "allow": ["GET /repos/", "POST /repos/acme/web/issues"] }`. A rule is `METHOD /prefix` with METHOD one of GET, POST, PUT, PATCH, DELETE or `*`. ## Token read When your server must hold a user's OAuth access token itself. Some systems need the token in hand: an execution sandbox, a workflow engine. `POST /v1/tenants/:t/connections/:id/token` returns the current access token of a provider connection that signs in with OAuth, refreshed first when under 5 minutes are left. ```json { "access_token": "gho_…", "token_type": "bearer", "expires_at": "2026-10-14T15:02:11.000Z", "scopes": ["read:user"], "provider": "github", "connection_id": "7d3c…", "refreshed": false } ``` - Off until you turn it on: `PUT /v1/app/token-read { "enabled": true }`. - Never the refresh token, never a pasted key, and never a token minted with our own platform client (that one is the same identity for every tenant; use the proxy). - Read again before `expires_at` rather than caching past it. Keep the token out of logs, URLs and anything your users can see. - 60 reads per connection per minute. Every read is audited. - A read is not a call: it is never counted or billed. It does follow your app's billing: after the trial, or once a plan has ended, it answers 402 `BILLING_REQUIRED` like a tool call, and no token is handed out. - If the provider rejects a token that still had time left (revoked or rotated on their side), read again with `{ "force_refresh": true }`: it is refreshed now. One refreshed in the last 30 seconds is returned as it is, and a connection is refreshed this way at most 12 times an hour. Prefer the proxy where it fits: a token handed out is a token you must keep safe. ## The MCP endpoint Agents connect to one URL per tenant and actor and see only their granted tools. `https://programmable.dev/mcp/:tenant/:actor`, Streamable HTTP, protocol versions 2025-11-25, 2025-06-18, 2025-03-26. Send `Authorization: Bearer pdt_…` on every request. A token for another tenant or actor is a 404. Most MCP clients take the URL and a header. For example: ```json { "mcpServers": { "programmable": { "url": "https://programmable.dev/mcp/acme/support-bot", "headers": { "Authorization": "Bearer pdt_…" } } } } ``` - Methods: `initialize`, `ping`, `tools/list` and `tools/call`. Tool names are `__`. - Tokens last at most 15 minutes: mint a new one before it expires. The MCP session (`Mcp-Session-Id`) survives a token change. - Every `tools/call` result carries `_meta`: `you.programmable.dev/cost_usd`, `you.programmable.dev/call_id` and `you.programmable.dev/status` (ok, tool_error, blocked, needs_approval, error, timed_out, cancelled). Map the status rather than parsing text; keep `_meta` out of the model's context. - A gated call answers `needs_approval` and did NOT run. `timed_out` may have completed: check before retrying a write. - Cancel: inside a session (`Mcp-Session-Id`), `notifications/cancelled` with the `requestId` of a running `tools/call` stops it. Cancelled before it was sent: `blocked` (reason `cancelled`), not counted or billed. After: `cancelled`, which may have run (check before retrying a write): it counts toward the daily cap and is billed like a normal call. A task is cancelled with `tasks/cancel`. - Progress: a `tools/call` with `params._meta.progressToken`, from a client that accepts `text/event-stream`, is answered as an SSE stream: `notifications/progress` at once and every 5 seconds (fixed wording, `progress` in seconds, no `total`), then the result. - Dry run: send `params._meta: { "you.programmable.dev/dry_run": true }` with `tools/call`. Every check runs and nothing is sent. - Tasks (protocol 2025-11-25 only): `initialize` advertises `capabilities.tasks`, and a gated tool lists `execution.taskSupport: "optional"`. Send `params.task: {}` with `tools/call` and a gated call answers a task instead of text; poll `tasks/get` (`working` while a person decides, then `completed`, `failed` or `cancelled`), read the approved run's result with `tasks/result` (marked untrusted, like any result), list with `tasks/list`, withdraw a waiting one with `tasks/cancel`. Tasks last 24 hours; 120 task requests a minute per actor. Older versions and calls without `task` answer as before. - Tool discovery (off by default, per actor): for an agent with hundreds of tools, `tools/list` gives `search_tools`, `describe_tool` and `call_tool` in place of every definition. See [Grants, tool calls and approvals](https://programmable.dev/docs#tools-and-approvals). - `request_access` (off by default, needs a webhook): an agent asks your server for a tool it lacks, as an `access.requested` event. 10 an hour per actor. Over REST it is the last entry of `GET …/tools` and runs through `POST …/tools/call` like any other name. | JSON-RPC error | Meaning | | --- | --- | | -32700 | Not JSON (HTTP 400). | | -32600 | Not a valid JSON-RPC message. | | -32601 | Unknown method. | | -32602 | Unknown tool, or `arguments` is not an object (re-list tools). | | -32002 | Billing required: `error.data.code` is `BILLING_REQUIRED` with `billing_url`. | | -32003 | `tasks/result` for a task still waiting for a person: `error.data.task` is its status. Poll `tasks/get` and ask again. | At this URL tokens come from your server, so `/.well-known/oauth-protected-resource/mcp/:t/:a` lists no authorization server (RFC 9728): give a stock MCP client the token as a configured header, or use MCP sign-in (next section). ## MCP sign-in (OAuth for stock MCP clients) Claude, n8n and other MCP clients connect to one agent by sending a person to sign in, with no token to paste. Available while MCP sign-in is switched on for this service (its metadata below answers 404 otherwise). The MCP server URL then names your app too, because tenant and actor ids are your own and only unique within your app: ```http https://programmable.dev/mcp/// ``` Give that URL to the MCP client with no headers. Its first request gets a 401 whose `WWW-Authenticate` names the Protected Resource Metadata; that lists our authorization server, whose metadata is at `/.well-known/oauth-authorization-server`. The client registers itself (a Client ID Metadata Document URL as its `client_id`, or `POST /oauth/register`), opens `/oauth/authorize` in a browser with PKCE (S256) and `resource` set to the URL above, and exchanges the code at `/oauth/token`. Access tokens last 15 minutes and refresh tokens rotate; the person can revoke on Settings > Profile. - Who can say yes: for your dashboard's test agent (`dashboard-test` / `dashboard-agent`), a developer or owner of your app's workspace. For your own tenants, only the person whose verified Programmable sign-in address you bound with `PUT /v1/tenants/:t/mcp-oauth-email { email, actors }`, for the actors you listed (1 to 20), and only once your app's MCP sign-in switch is on (Developers > Server access). Nobody else, and never by a link alone. - The token reaches that one actor at that one URL (any other path is 404) and carries no grants: tools, daily caps and approvals are the actor's, as with a minted token. - It stops when the switch goes off, the address is unbound or changed, the actor is dropped from the list, the key that bound the address is revoked (a rotation moves the binding to the new key unless you choose to end it: do that if the key may have leaked), the developer leaves or is demoted, or the tenant or actor is deleted; while the app is turned off it is refused. - Errors before the person decides stay on our page; your client is only ever sent the person's answer (`code` or `access_denied`). - Live tenants only. Test-mode tenants keep using minted actor tokens. ## Grants, tool calls and approvals Which tools each agent may use, how many times a day, and which calls wait for a person. `PUT /v1/tenants/:t/actors/:a/grants` replaces an actor's grants. Each names a connection, optionally a list of tools, a `daily_call_cap` (default 20) and `requires_approval` (default true). Agents without MCP can call `POST …/tools/call`: same checks, same answers. - Input up to 16 KB. Results are clipped to 32 KB and wrapped as `…`. - A gated call creates an approval (24 hours to decide; at most 20 waiting per actor and connection) and sends `approval.needed`. - Approve with `POST /v1/approvals/:id/decide { "decision": "approve", "digest": "…" }`. The digest proves the person saw exactly this tool, connection and input. An approved call runs once, then; the outcome comes as `approval.decided`. - Approve with edits: send `input` too (the tool's whole input as it should run) to fix an argument instead of rejecting. It is checked like a fresh call. The approval you asked about becomes `superseded`; a new approval (`edited: true`, its own id and digest, `edited_args` with the names of the changed arguments) runs once. Pass its `edit_notice` to the agent so it knows its own input did not run. A request cannot be edited. - Approval keys (`pd_appr_…`, Developers > API keys): for a chat bot or a small tool that only decides. Such a key can call `GET /v1/approvals` (pending only), `GET /v1/approvals/:id` and `POST /v1/approvals/:id/decide`; every other route answers 403 `APPROVAL_KEY`. - Dry runs (`"dry_run": true`): every check, nothing sent, 60 a minute per actor. Changed tool definitions. An outside server (an MCP server, or Composio) can change a tool's description or input schema after you granted it. We keep a fingerprint of each tool's definition as it was when the grant was set, and compare on every listing and call. A grant's `on_tool_change` says what happens to a tool that no longer matches, or that the server added later: `hold` (the default for a new grant) stops offering it until someone accepts the change, `ask` keeps offering it but makes every call wait for approval, `allow` offers it as it is. You get `connection.tools_changed`; `GET …/grants` lists the affected tools under `tool_changes` and `GET …/tools` under `held`. To accept: `GET /v1/tenants/:t/connections/:id/tool-changes` shows what changed, with a `fingerprint` per tool; show it to a person, then `POST` the same path with `{ "tools": [{ "tool", "fingerprint" }] }`. If the server changed the tool again in between, nothing is accepted (409 `TOOL_CHANGED_AGAIN`). Provider connections and built-ins are not affected: their tools are ours. Tool discovery, for agents with very large tool lists. An agent granted several connections can be offered hundreds of tools, and it has to read every definition before it can do anything. `PUT /v1/tenants/:t/actors/:a/tool-discovery { "mode": "on" }` lists that actor three built-in tools instead: `search_tools` (a few words in; matching tool names out, each with a one-line summary, its kind and whether a call waits for a person; 10 a page, at most 25), `describe_tool` (one tool's full definition, exactly as the list would have given it) and `call_tool` (`{ name, input }`). `"mode": "auto"` does the same only while the actor is offered more than `threshold` tools (40 unless you name one). It is off until you set it, and it changes what an agent is listed, never what it may call. - `call_tool` is the call of the tool it names: the same grant, argument and resource limits, caps, spending limits, approval (the approver sees the real tool and its input), dry run, cost label and task. Your call history and usage name the real tool, never `call_tool`. A tool's own name can still be called directly. - Search and describe show only what the actor's grants offer. A tool the grant blocks or hides is never found; a tool on hold after a changed definition is named as on hold, without its definition. - Search and describe call no service, so they are not calls: nothing in your call history, usage or bill, no cap and no approval. 60 a minute per actor. Summaries and descriptions are the services' own words, wrapped as untrusted. - Search is by words (name, then title, then connection, then description), not by meaning: short queries like "send email" or "create issue" work best. - Without MCP: `GET …/tools` returns the three built-ins while discovery is active (`discovery.active`; `?view=all` for every definition) and `POST …/tools/call` runs them, so you can forward your model's calls as they come. Or search yourself with `GET …/tools/search?q=` and `GET …/tools/describe?name=`. Setup links: one link that connects a service in your dashboard's test account and grants the tools it lists, for trying a provider before you write code: `/dashboard/setup?provider=github&tools=a,b&cap=50` (or `server=` for an MCP server from the catalogue). Opening it never acts: the page shows what it would do, and you press the buttons. [Open the setup page](https://programmable.dev/dashboard/setup). ## Webhooks Signed events to your server: approvals, connections, provider events and access requests. Set your URL with `PUT /v1/app/webhook { "url": "https://app.example.com/hooks/programmable" }` (or on the dashboard, Developers > Webhooks). The answer carries the signing secret `whsec_…` the first time, and after `rotate_secret: true`; keep it. | Event | When | data | | --- | --- | --- | | approval.needed | A call is waiting for a person | `{ approval }` | | approval.decided | Approved (with `run`), rejected, expired, or replaced by an edited one (`superseded`) | `{ approval }`; `edited: true` on the approval that ran with a person's edited input | | connection.connected | A connect session or import finished | `{ connection, kind, scopes? }`: `kind` is `new`, `reauth` (an existing connection signed in again) or `add_scopes`; `scopes` = what the provider granted, when it said | | connection.needs_reauth | A connection must be signed in again | `{ connection }` | | connection.revoked | A connection was deleted | `{ connection }` | | connection.expiring | No refresh token and under 3 days left | `{ connection, expires_at }` | | connection.tools_changed | An outside server's tool definitions are no longer the ones that were accepted | `{ connection, tools }`: each `{ tool, change, parts? }` with `change` = `changed` (and which `parts`: description, input_schema, annotations, title), `new` or `removed`. Names and kinds only, never the text | | connect_session.failed | A connect session ended without connecting | `{ connect_session, error_code }`: `connect_session` = `{ id, tenant, source, provider, label, reauth, connection_id }`; `error_code` as in the return URL | | connect_session.cancelled | Your `DELETE`, or the person pressed Cancel on our page | `{ connect_session, error_code: "cancelled" }` | | connect_session.expired | The link expired unused or unfinished (sent once, a minute or so after; up to 10 minutes after when a sign-in was still out at the provider) | `{ connect_session, error_code: "expired" }` | | provider.event | A provider's own webhook (Slack, GitHub…) for a subscribed connection | the provider's payload, untrusted | | access.requested | An agent called `request_access` | `{ actor, provider, tools, reason }`; `reason` is untrusted | | mcp_oauth.email_bound | An address was bound for MCP sign-in on a tenant (`PUT /v1/tenants/:t/mcp-oauth-email`) | `{ actors, key: { id, prefix } }`; never the address | | spend.warning | Booked spend first reached a spending limit's `warn_percent` in a period | `{ scope, period, period_start, cap_usd, spent_usd, warn_percent, actor? }` | | spend.cap_reached | A spending limit refused a call for the first time in a period | the same | | mcp_oauth.email_unbound | It was unbound: by you, or because the key that bound it was revoked | `{ reason: "app" \| "key_revoked", key }` | Choose what you receive with `events` on the same call: exact types and families, e.g. `PUT /v1/app/webhook { "url": "…", "events": ["approval.needed", "connection.*"] }`. `null` (the default) means every type; leaving `events` out keeps your filter. An event your filter leaves out is never queued: it is not retried and cannot be redelivered. A type that is not in the table above is refused (`BAD_EVENT_TYPES`), so a typo cannot silently drop events. Nothing depends on an event reaching you: a gated call waits for a person whether or not you take `approval.needed` (you can read approvals with `GET /v1/approvals/:id`), but `request_access` is only offered to your agents while your filter takes `access.requested`. A developer can send one past delivery again from Developers > Webhooks (once it was delivered or its retries ran out). It carries the same body, so the same `id` and `X-Programmable-Delivery`, plus `X-Programmable-Redelivery: true` and a signature made when it is sent: de-duplicate on the id (`X-Programmable-Id`) unless you want the repeat. Body: `{ id, type, tenant, created_at, occurred_at, data }` (`created_at` and `occurred_at` are the same moment; `created_at` is the name every Programmable app uses). Headers: `X-Programmable-Event`, `X-Programmable-Id` and `X-Programmable-Delivery` (both = `id`, the same on every retry and redelivery; de-duplicate on it), `X-Programmable-Timestamp` and the signature `t=,v1=.")>`. Where the signature is: always in `X-Programmable-Signature-V2`. In `X-Programmable-Signature` too when your app's `signature_format` is `suite`, the format every Programmable app is moving to and the one a newly registered app starts with. An app registered before this setting existed is `legacy` (`GET /v1/app/webhook` says which yours is): its `X-Programmable-Signature` still carries `sha256=`, exactly as before, so nothing you built stopped working. Switch when your receiver is ready: `PUT /v1/app/webhook { "url": "…", "signature_format": "suite" }` or Developers > Webhooks (and back with `legacy`). A receiver that reads `-V2`, as the examples and both SDKs do, works in either format; the SDKs accept the value from either header. Answer 2xx within 10 seconds. Anything else is retried after 1 min, 5 min, 30 min, 2 h, 12 h, then dropped. Redirects are not followed. While your app is turned off, its events are held rather than tried, and sent once it is turned on again. Events more than 3 days old, and an `approval.needed` whose approval was decided or expired meanwhile, are dropped instead; a deleted app's events are never sent. After a hold, order by `occurred_at`. **Verify every delivery** over the raw body, before parsing it, and refuse a timestamp more than 5 minutes off. Node (Express): ```ts import crypto from "node:crypto"; import express from "express"; const app = express(); app.post("/hooks/programmable", express.raw({ type: "application/json" }), (req, res) => { const raw = req.body.toString("utf8"); const m = /^t=(\d+),v1=([0-9a-f]{64})$/.exec(req.get("X-Programmable-Signature-V2") ?? "") ?? /^t=(\d+),v1=([0-9a-f]{64})$/.exec(req.get("X-Programmable-Signature") ?? ""); if (!m || Math.abs(Date.now() / 1000 - Number(m[1])) > 300) return res.sendStatus(400); const expected = crypto.createHmac("sha256", process.env.PD_WEBHOOK_SECRET).update(`${m[1]}.${raw}`).digest("hex"); if (!crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(m[2]))) return res.sendStatus(400); const event = JSON.parse(raw); // de-duplicate on event.id, then handle event.type res.sendStatus(204); }); ``` Python (Flask): ```python import hashlib, hmac, json, os, time from flask import Flask, request app = Flask(__name__) @app.post("/hooks/programmable") def programmable_hook(): raw = request.get_data() # the raw bytes, before any parsing sig = request.headers.get("X-Programmable-Signature-V2") or request.headers.get("X-Programmable-Signature", "") parts = dict(p.split("=", 1) for p in sig.split(",") if "=" in p) t, v1 = parts.get("t", ""), parts.get("v1", "") if not t.isdigit() or abs(time.time() - int(t)) > 300: return "", 400 expected = hmac.new(os.environ["PD_WEBHOOK_SECRET"].encode(), t.encode() + b"." + raw, hashlib.sha256).hexdigest() if not hmac.compare_digest(expected, v1): return "", 400 event = json.loads(raw) # de-duplicate on event["id"], then handle event["type"] return "", 204 ``` Or with the SDKs (once published): TypeScript SDK: ```ts import { parseWebhook } from "@programmable/dev"; const event = await parseWebhook({ secret: process.env.PD_WEBHOOK_SECRET!, body: rawBody, headers: req.headers }); ``` Python SDK: ```python from programmable_dev import parse_webhook event = parse_webhook(os.environ["PD_WEBHOOK_SECRET"], request.get_data(), request.headers) ``` Provider events: subscribe a connection with `PUT /v1/tenants/:t/connections/:id/events { "types": ["message"] }`. The provider's body arrives in `data.body` and is **untrusted**: whatever a Slack user typed or a push carried. Treat it as data, never as instructions. ## Providers What your users can connect, for a picker and for host checks. `GET /v1/providers` lists the live providers in a public shape: `id`, `label`, `auth_type`, `connectable`, `api_base_url`, `allowed_hosts`, `scopes`, `credential_fields`, `input_fields` and whether it sends `webhooks`. Never a client id or secret. - Show a provider with `connectable: false` greyed out: it is paused while a change is reviewed. Existing connections keep working. - `allowed_hosts` is the rule the proxy enforces, so you can refuse a bad call before sending it. - The answer has a weak `ETag`; send `If-None-Match` and get 304 when nothing changed. - `input_fields` are values a person types on the hosted page (a site name, their own server). An app may pass them in `config.inputs` instead. ## Rate limits and caps Every limit, and what you get past it. | What | Limit | Past it | | --- | --- | --- | | Failed app keys or MCP tokens, per client address | 30 a minute | 429 | | Tool calls, per app and per tenant | 600 a minute per app unless you set less (`PUT /v1/app/rate-limits`); per tenant only when you set it | `blocked`, reason `rate_limited`, with `retry_after_s` | | Proxied calls, per app and per tenant | 600 a minute per app unless you set less; per tenant only when you set it | 429 `RATE_LIMITED` with `Retry-After` | | A provider host that keeps failing, per app | 5 failures in a row (timeouts, dropped connections, 5xx) inside a minute: refused at once for 30 seconds, then one test call | `blocked`, reason `provider_unavailable` / 503 `PROVIDER_UNAVAILABLE` | | Proxied calls, per connection | 120 a minute | 429 `RATE_LIMITED` | | Proxied calls, per connection per UTC day | default 1000 (app setting, or per connection) | 429 `DAILY_CAP` | | Token reads, per connection | 60 a minute | 429 `RATE_LIMITED` | | Connection tests, per connection | 6 a minute | 429 `RATE_LIMITED` | | Tool calls, per grant per UTC day | daily_call_cap (default 20) | `blocked`, reason `daily_cap` | | Tool-call cost, per grant per UTC day | daily_spend_cap_usd (off unless set) | `blocked`, reason `spend_cap` | | Tool-call cost, per actor per UTC month / per tenant per UTC day and month / per app per UTC month | spending limits (off unless set): `PUT …/actors/:a/spend-limits`, `PUT /v1/tenants/:t/spend-limits`, `PUT /v1/app/spend-limits` | `blocked`, reason `actor_monthly_spend_cap`, `tenant_daily_spend_cap`, `tenant_monthly_spend_cap` or `app_monthly_spend_cap` | | Dry runs, per actor | 60 a minute | `blocked`, reason `rate_limited` | | Approvals waiting, per actor and connection | 20 | `blocked`, reason `approval_queue_full` | | Access requests, per actor | 10 an hour | `rate_limited` | | Calls to a customer's own server, per host | 60 a minute, 500 a day per connection | 429 / `blocked` | | Connections, per tenant | 100 | 409 `CONNECTION_LIMIT` | A 429 may carry `Retry-After`. Daily caps reset at 00:00 UTC, monthly spending limits on the first of the UTC month. A refused call is never billed and never counts against a cap. Spending limits count what your agents' tool calls cost at the services they call (`cost_usd`), not your plan here. Each can warn before it is reached: `spend.warning` when booked spend first reaches `warn_percent` (default 80) of the limit, and `spend.cap_reached` the first time it refuses a call, once per limit per period. To attribute cost to your own cost centres, pass `cost_label` with a call: usage groups by it. ## Security model What each credential can do, what a leak costs you, and what we do not protect against. Four things can leak. What each one opens: | If this leaks | What it can do | What it cannot do | What to do | | --- | --- | --- | --- | | App key (`pd_live_…`) | Everything your app can: every tenant's connections, grants and calls, the server proxy, and token read if you turned it on | Read a stored key, password or refresh token: those are never returned to anyone | Rotate it (the old key keeps working for a grace period) or revoke it at once. Give a key to one tenant only (`tenant` when you make it) wherever one customer's integration holds it | | Actor token (`pdt_…`) | Call that one actor's granted tools, within its caps and approvals, for at most 15 minutes | Reach another actor or tenant, change grants, connect anything | Nothing: it expires. Revoking the key that minted it kills it at once | | Connect link | Let the first signed-in person who opens it connect their own account to that tenant, until it expires or is used | Read anything. With `expected_email`, be used by anyone else | Cancel the session (`DELETE …/connect-sessions/:id`). Always set `expected_email` when you know the person | | Connection id, tenant id, actor id, call id | Nothing by itself | Anything: every one of them is only a name, and needs your app key or an actor token | Nothing | **What we do for you.** Credentials are encrypted at rest and decrypted only to make a call; they are never in a response, a log or an error. A tenant's data is reachable only through a credential scoped to it. Every call is checked against the actor's grant when it is made, so a grant you tighten applies to the next call. Calls you mark as needing approval wait for a person who sees exactly what will be sent. **Text from outside is data, not instructions.** Tool results, and tool names and descriptions from outside servers, come back wrapped as ``. A page, an email or a ticket an agent reads can contain text written to steer it (prompt injection). The wrapper tells your model where outside text starts and ends; it does not make a model obey you over the text. What limits the damage is the grant: reads that run, writes that ask a person, destructive calls blocked, argument limits and caps. Set those as if the agent will one day be tricked. **What we do not protect against.** An app key used by whoever holds it: we cannot tell your server from someone who stole its key. A person who approves a call without reading it. A provider that is itself compromised. What your own code does with a token once you turn token read on. To report a security problem, write to the address on the [legal page](https://programmable.dev/legal). ## Errors One shape for every refusal, and a catalogue of every code. Every refusal is JSON `{ "error": "…", "code": "…" }` with a 4xx or 5xx status. `error` is a sentence for a person; branch on `code`, which is stable. A few generic refusals (401 for a bad key, 400 for a body that does not fit) carry no code. Some carry more: `tools/call` refusals carry `call_id` and `status`; `BILLING_REQUIRED` carries `billing_url`. Retry only 429 and 5xx, after a wait. A tool call that answered `timed_out`, or a proxied write that hit `UPSTREAM_TIMEOUT`, may have reached the provider: check before you send it again. The catalogue below is built from the code. The connect-page codes are what a person sees on our hosted page, or what comes back to your `return_url` in the session's `error`. ## API reference ### Tenants and actors A tenant is one of your customers; an actor is one of their agents. Both use your own ids, created on first use. #### POST /v1/tenants/{tenant} Create or rename a tenant. 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). Body (optional): - `name` string 1-200 chars Answer 201: object with `tenant`, `created`. Error codes: BAD_ID, RESERVED_ID. ```bash curl -X POST "https://programmable.dev/v1/tenants/acme" \ -H "Authorization: Bearer $PD_APP_KEY" \ -H "Content-Type: application/json" \ -d '{"name":"Acme Inc"}' ``` ```ts await pd.upsertTenant("acme", {"name":"Acme Inc"}); ``` ```python pd.upsert_tenant("acme", {"name":"Acme Inc"}) ``` #### DELETE /v1/tenants/{tenant} Delete a tenant. 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. Answer 200: object with `ok`, `deleted`. 204: No such tenant for this app (already deleted, or never was). ```bash curl -X DELETE "https://programmable.dev/v1/tenants/acme" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.deleteTenant("acme"); ``` ```python pd.delete_tenant("acme") ``` #### POST /v1/tenants/{tenant}/actors/{actor} Create or relabel an actor. An actor is one agent inside a tenant. 201 when new, 200 when it existed. Body (optional): - `label` string 1-200 chars Answer 201: object with `actor`, `created`. Error codes: NO_TENANT, BAD_ID, RESERVED_ID. ```bash curl -X POST "https://programmable.dev/v1/tenants/acme/actors/support-bot" \ -H "Authorization: Bearer $PD_APP_KEY" \ -H "Content-Type: application/json" \ -d '{"label":"Support bot"}' ``` ```ts await pd.upsertActor("acme", "support-bot", {"label":"Support bot"}); ``` ```python pd.upsert_actor("acme", "support-bot", {"label":"Support bot"}) ``` #### DELETE /v1/tenants/{tenant}/actors/{actor} Delete an actor. 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. Answer 200: object with `ok`, `deleted`. 204: No such tenant or actor (already deleted, or never was). ```bash curl -X DELETE "https://programmable.dev/v1/tenants/acme/actors/support-bot" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.deleteActor("acme", "support-bot"); ``` ```python pd.delete_actor("acme", "support-bot") ``` #### POST /v1/tenants/{tenant}/actors/{actor}/tokens Mint an MCP token for an actor. 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. Body (optional): - `ttl_seconds` integer 60-900 Answer 201: object with `token`, `expires_at`, `mcp_url`. Error codes: NO_TENANT, NO_ACTOR. ```bash curl -X POST "https://programmable.dev/v1/tenants/acme/actors/support-bot/tokens" \ -H "Authorization: Bearer $PD_APP_KEY" \ -H "Content-Type: application/json" \ -d '{"ttl_seconds":900}' ``` ```ts await pd.createActorToken("acme", "support-bot", {"ttl_seconds":900}); ``` ```python pd.create_actor_token("acme", "support-bot", {"ttl_seconds":900}) ``` ### Connections A tenant's accounts at other services. People connect through a hosted page; keys never pass through your app. #### POST /v1/tenants/{tenant}/connect-sessions Start a hosted connect session. 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=` and, on failure, `error=` (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. Body: - `source` "mcp" | "builtin" | "composio" | "record" - `provider` string 1-120 chars - `label` string 1-120 chars - `config` object (map) - `return_url` string ≤ 2048 chars, required - `connection_id` string (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` string (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` boolean - `expected_email` string (email) ≤ 254 chars: 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` integer 300-3600: 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. - `add_scopes` (string 1-300 chars)[] (≤ 50) - `metadata` object (map): 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. Answer 201: object with `id`, `url`, `expires_at`. 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. ```bash curl -X POST "https://programmable.dev/v1/tenants/acme/connect-sessions" \ -H "Authorization: Bearer $PD_APP_KEY" \ -H "Content-Type: application/json" \ -d '{"source":"record","provider":"github","return_url":"https://app.example.com/connected"}' ``` ```ts await pd.createConnectSession("acme", {"source":"record","provider":"github","return_url":"https://app.example.com/connected"}); ``` ```python pd.create_connect_session("acme", {"source":"record","provider":"github","return_url":"https://app.example.com/connected"}) ``` #### GET /v1/tenants/{tenant}/connect-sessions/{session} Get a connect session's status. 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. Answer 200: object with `connect_session`. Error codes: NO_TENANT, NO_CONNECT_SESSION. ```bash curl "https://programmable.dev/v1/tenants/acme/connect-sessions/session" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getConnectSession("acme", "session"); ``` ```python pd.get_connect_session("acme", "session") ``` #### DELETE /v1/tenants/{tenant}/connect-sessions/{session} Cancel a connect session. 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. Answer 200: object with `connect_session`, `cancelled`. Error codes: NO_TENANT, NO_CONNECT_SESSION, SESSION_COMPLETED, SESSION_FINISHING. ```bash curl -X DELETE "https://programmable.dev/v1/tenants/acme/connect-sessions/session" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.cancelConnectSession("acme", "session"); ``` ```python pd.cancel_connect_session("acme", "session") ``` #### GET /v1/tenants/{tenant}/connections List a tenant's connections. 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. - query `metadata` object (map): Only connections whose metadata has every one of these pairs (sent as metadata[key]=value; up to 5). Answer 200: object with `items`. Error codes: NO_TENANT, BAD_FILTER. ```bash curl "https://programmable.dev/v1/tenants/acme/connections" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.listConnections("acme"); ``` ```python pd.list_connections("acme") ``` #### GET /v1/connections Search your app's connections. 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. - query `tenant` string: Only this tenant's connections (your tenant id). - query `provider` string 1-120 chars: Only this provider, as a connection shows it (`slack`, `github`, …). - query `source` "mcp" | "builtin" | "composio" | "record": Only connections of this kind. - query `status` "pending" | "connected" | "needs_reauth" | "failed" | "disabled": Only connections in this status. - query `account_fingerprint` string: Only connections signed in as this provider account (a connection's `account_fingerprint`): the same account connected more than once. - query `metadata` object (map): Only connections whose metadata has every one of these pairs (sent as metadata[key]=value; up to 5). - query `limit` integer 1-200: Default 50. - query `before` string: The `next` cursor from the previous page. Answer 200: object with `items`, `next`. Error codes: NO_TENANT, BAD_FILTER. ```bash curl "https://programmable.dev/v1/connections" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.searchConnections(); ``` ```python pd.search_connections() ``` #### POST /v1/tenants/{tenant}/connections Create a connection without a person. 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`. Body: - `source` "mcp" | "builtin", required - `provider` string 1-120 chars - `label` string 1-120 chars - `config` object (map) - `secret` string ≤ 4096 chars - `metadata` object (map): 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. Answer 201: object with `connection`. Error codes: NO_TENANT, BAD_CONFIG, SECRET_REQUIRED, NEEDS_SESSION, CONNECTION_LIMIT, CREDENTIAL_STORE_UNAVAILABLE. ```bash curl -X POST "https://programmable.dev/v1/tenants/acme/connections" \ -H "Authorization: Bearer $PD_APP_KEY" \ -H "Content-Type: application/json" \ -d '{"source":"builtin","provider":"web_search","config":{"engine":"brave"},"secret":"BRAVE_KEY"}' ``` ```ts await pd.createConnection("acme", {"source":"builtin","provider":"web_search","config":{"engine":"brave"},"secret":"BRAVE_KEY"}); ``` ```python pd.create_connection("acme", {"source":"builtin","provider":"web_search","config":{"engine":"brave"},"secret":"BRAVE_KEY"}) ``` #### POST /v1/tenants/{tenant}/connections/import Import an existing OAuth grant. 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. Body: - `provider` string, required: pattern ^[a-z0-9_]{1,64}$ - `refresh_token` string 1-4096 chars, required: pattern ^\S+$ - `scope` string ≤ 2000 chars - `label` string 1-120 chars - `imported_from` string 1-40 chars Answer 201: object with `connection`, `imported`. 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. ```bash curl -X POST "https://programmable.dev/v1/tenants/acme/connections/import" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.importConnection("acme", {}); ``` ```python pd.import_connection("acme", {}) ``` #### GET /v1/tenants/{tenant}/connections/{connection} Get a connection. One connection. Another tenant's or app's id is a 404, like an unknown one. Answer 200: object with `connection`. Error codes: NO_TENANT, NO_CONNECTION. ```bash curl "https://programmable.dev/v1/tenants/acme/connections/$CONNECTION_ID" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getConnection("acme", connectionId); ``` ```python pd.get_connection("acme", connection_id) ``` #### PATCH /v1/tenants/{tenant}/connections/{connection} Rename a connection or change its metadata. 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. Body: - `label` string 1-120 chars: A new label (what people see). The connection's tool names stay as they are. - `metadata` object (map): Keys to set (strings) or, in merge mode, delete (null). - `metadata_mode` "merge" | "replace": merge (default) or replace. Answer 200: object with `connection`. Error codes: NO_TENANT, NO_CONNECTION, BAD_CONFIG, METADATA_LIMIT. ```bash curl -X PATCH "https://programmable.dev/v1/tenants/acme/connections/$CONNECTION_ID" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.updateConnection("acme", connectionId, {}); ``` ```python pd.update_connection("acme", connection_id, {}) ``` #### DELETE /v1/tenants/{tenant}/connections/{connection} Delete a connection. Revokes it at the provider (best effort), then deletes it with its tokens. Sends connection.revoked. Answer 200: object with `ok`, `revoked_remote`. Error codes: NO_TENANT, NO_CONNECTION. ```bash curl -X DELETE "https://programmable.dev/v1/tenants/acme/connections/$CONNECTION_ID" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.deleteConnection("acme", connectionId); ``` ```python pd.delete_connection("acme", connection_id) ``` #### GET /v1/tenants/{tenant}/connections/{connection}/health How a connection is doing. Computed status (ok, expiring, needs_reauth, error), last refresh and use, last error, scopes, expiry and the background refresh's attempts. Never a token. Answer 200: object with `health`. Error codes: NO_TENANT, NO_CONNECTION. ```bash curl "https://programmable.dev/v1/tenants/acme/connections/$CONNECTION_ID/health" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getConnectionHealth("acme", connectionId); ``` ```python pd.get_connection_health("acme", connection_id) ``` #### POST /v1/tenants/{tenant}/connections/{connection}/test Check a connection now. 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`). Answer 200: object with `ok`, `steps`, `health`. Error codes: NO_TENANT, NO_CONNECTION, RATE_LIMITED. ```bash curl -X POST "https://programmable.dev/v1/tenants/acme/connections/$CONNECTION_ID/test" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.testConnection("acme", connectionId); ``` ```python pd.test_connection("acme", connection_id) ``` #### GET /v1/tenants/{tenant}/connections/{connection}/tool-changes What changed in a connection's tool definitions. 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. Answer 200: ToolChangeReview. Error codes: NO_TENANT, NO_CONNECTION, NOT_CONNECTED, UNAVAILABLE, RATE_LIMITED. ```bash curl "https://programmable.dev/v1/tenants/acme/connections/$CONNECTION_ID/tool-changes" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.reviewToolChanges("acme", connectionId); ``` ```python pd.review_tool_changes("acme", connection_id) ``` #### POST /v1/tenants/{tenant}/connections/{connection}/tool-changes Accept changed tool definitions. 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. Body: - `tools` object[] (≤ 400), required - `tools[].tool` string 1-200 chars, required - `tools[].fingerprint` string, required: pattern ^[0-9a-f]{64}$ Answer 200: object with . Error codes: NO_TENANT, NO_CONNECTION, NOT_PINNED, BAD_REQUEST, NOT_CONNECTED, UNAVAILABLE, TOOL_CHANGED_AGAIN, RATE_LIMITED. ```bash curl -X POST "https://programmable.dev/v1/tenants/acme/connections/$CONNECTION_ID/tool-changes" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.acceptToolChanges("acme", connectionId, {}); ``` ```python pd.accept_tool_changes("acme", connection_id, {}) ``` #### GET /v1/tenants/{tenant}/connections/{connection}/events Which provider events a connection forwards. The provider event types this connection sends you as `provider.event` webhooks. Off by default. Answer 200: object with `events`. Error codes: NO_TENANT, NO_CONNECTION. ```bash curl "https://programmable.dev/v1/tenants/acme/connections/$CONNECTION_ID/events" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getConnectionEvents("acme", connectionId); ``` ```python pd.get_connection_events("acme", connection_id) ``` #### PUT /v1/tenants/{tenant}/connections/{connection}/events Choose the provider events a connection forwards. 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. Body: - `types` string[] (≤ 50), required - `sync_reply` boolean Answer 200: object with `events`. Error codes: NO_TENANT, NO_CONNECTION, NOT_SUPPORTED. ```bash curl -X PUT "https://programmable.dev/v1/tenants/acme/connections/$CONNECTION_ID/events" \ -H "Authorization: Bearer $PD_APP_KEY" \ -H "Content-Type: application/json" \ -d '{"types":["message"]}' ``` ```ts await pd.setConnectionEvents("acme", connectionId, {"types":["message"]}); ``` ```python pd.set_connection_events("acme", connection_id, {"types":["message"]}) ``` ### Providers The services your users can connect, and the hosts the proxy may call. #### GET /v1/providers List the providers your users can connect. 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`. Answer 200: object with `items`. 304: Not modified since the ETag you sent. ```bash curl "https://programmable.dev/v1/providers" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.listProviders(); ``` ```python pd.list_providers() ``` #### GET /v1/providers/{provider} Get one provider. One live provider record. 404 for an unknown id or a record that is not live. Answer 200: object with `provider`. Error codes: NO_PROVIDER. ```bash curl "https://programmable.dev/v1/providers/github" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getProvider("github"); ``` ```python pd.get_provider("github") ``` ### Rate limits Optional calls-a-minute ceilings for your app and its tenants. A call over a ceiling is refused at once and is not charged. #### GET /v1/app/rate-limits Your app's calls-a-minute ceilings. Your own numbers, what is in force, and the platform's ceiling. Answer 200: object with `rate_limits`. ```bash curl "https://programmable.dev/v1/app/rate-limits" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getRateLimits(); ``` ```python pd.get_rate_limits() ``` #### PUT /v1/app/rate-limits Set calls-a-minute ceilings. 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. Body: - `tool_calls_per_minute` integer 1-100000 or any or null: Tool calls a minute for the whole app (MCP and REST). null = the platform's ceiling. - `proxy_calls_per_minute` integer 1-100000 or any or null: Proxy calls a minute for the whole app. null = the platform's ceiling. - `tenant_tool_calls_per_minute` integer 1-100000 or any or null: Tool calls a minute for each tenant. null = no per-tenant ceiling. - `tenant_proxy_calls_per_minute` integer 1-100000 or any or null: Proxy calls a minute for each tenant. null = no per-tenant ceiling. Answer 200: object with `rate_limits`. Error codes: TEST_KEY. ```bash curl -X PUT "https://programmable.dev/v1/app/rate-limits" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.setRateLimits({}); ``` ```python pd.set_rate_limits({}) ``` #### GET /v1/tenants/{tenant}/rate-limits One tenant's ceilings. The tenant's own numbers and what is in force for it. Answer 200: object with `rate_limits`. Error codes: NO_TENANT. ```bash curl "https://programmable.dev/v1/tenants/acme/rate-limits" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getTenantRateLimits("acme"); ``` ```python pd.get_tenant_rate_limits("acme") ``` #### PUT /v1/tenants/{tenant}/rate-limits Give one tenant its own ceilings. Instead of your per-tenant numbers. null goes back to them. Never above your app's ceiling. Body: - `tool_calls_per_minute` integer 1-100000 or any or null: null = the app's per-tenant ceiling. - `proxy_calls_per_minute` integer 1-100000 or any or null: null = the app's per-tenant ceiling. Answer 200: object with `rate_limits`. Error codes: NO_TENANT. ```bash curl -X PUT "https://programmable.dev/v1/tenants/acme/rate-limits" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.setTenantRateLimits("acme", {}); ``` ```python pd.set_tenant_rate_limits("acme", {}) ``` ### Proxy Your own server calls a provider's API through a connection. We add the credential; you never see it. #### GET /v1/app/proxy Is the proxy on for your app. The proxy is off until you turn it on. `admin_locked`: a platform admin turned it off and only they can turn it on. Answer 200: object with `proxy`. ```bash curl "https://programmable.dev/v1/app/proxy" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getProxySettings(); ``` ```python pd.get_proxy_settings() ``` #### PUT /v1/app/proxy Turn the proxy on or off. Also sets the default daily cap per connection (default 1000). Body: - `enabled` boolean - `daily_call_cap` integer 0-100000 Answer 200: object with `proxy`. Error codes: PROXY_LOCKED. ```bash curl -X PUT "https://programmable.dev/v1/app/proxy" \ -H "Authorization: Bearer $PD_APP_KEY" \ -H "Content-Type: application/json" \ -d '{"enabled":true}' ``` ```ts await pd.setProxySettings({"enabled":true}); ``` ```python pd.set_proxy_settings({"enabled":True}) ``` #### GET /v1/tenants/{tenant}/connections/{connection}/proxy/rules A connection's proxy rules. The paths the proxy may call on this connection, and its own daily cap. Answer 200: object with `rules`. Error codes: NO_TENANT, NO_CONNECTION, NOT_RECORD_CONNECTION. ```bash curl "https://programmable.dev/v1/tenants/acme/connections/$CONNECTION_ID/proxy/rules" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getProxyRules("acme", connectionId); ``` ```python pd.get_proxy_rules("acme", connection_id) ``` #### PUT /v1/tenants/{tenant}/connections/{connection}/proxy/rules Narrow the proxy on a connection. `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. Body: - `allow` (string ≤ 2010 chars)[] (≤ 50) or any or null, required - `daily_call_cap` integer 0-100000 or any or null Answer 200: object with `rules`. Error codes: NO_TENANT, NO_CONNECTION, NOT_RECORD_CONNECTION, BAD_RULE, PROXY_LOCKED. ```bash curl -X PUT "https://programmable.dev/v1/tenants/acme/connections/$CONNECTION_ID/proxy/rules" \ -H "Authorization: Bearer $PD_APP_KEY" \ -H "Content-Type: application/json" \ -d '{"allow":["GET /repos/"]}' ``` ```ts await pd.setProxyRules("acme", connectionId, {"allow":["GET /repos/"]}); ``` ```python pd.set_proxy_rules("acme", connection_id, {"allow":["GET /repos/"]}) ``` #### POST /v1/tenants/{tenant}/connections/{connection}/proxy Call a provider's API through a connection. 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. Body: - `method` "GET" | "POST" | "PUT" | "PATCH" | "DELETE", required - `path` string ≤ 2000 chars, required - `query` object (map) - `headers` object (map) - `body` string - `body_encoding` "utf8" | "base64" Answer 200: ProxyResult. 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. ```bash curl -X POST "https://programmable.dev/v1/tenants/acme/connections/$CONNECTION_ID/proxy" \ -H "Authorization: Bearer $PD_APP_KEY" \ -H "Content-Type: application/json" \ -d '{"method":"GET","path":"/user"}' ``` ```ts await pd.proxyRequest("acme", connectionId, {"method":"GET","path":"/user"}); ``` ```python pd.proxy_request("acme", connection_id, {"method":"GET","path":"/user"}) ``` ### Call history Each call a tenant's agents and your proxy made, one at a time. #### GET /v1/app/history How much of each call your app keeps, and for how long. The default is `summary` for 90 days. Answer 200: object with `history`. ```bash curl "https://programmable.dev/v1/app/history" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getHistorySettings(); ``` ```python pd.get_history_settings() ``` #### PUT /v1/app/history Choose how much of each call to keep, and for how long. `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. Body: - `keep` "summary" | "full" - `days` integer 30-400 Answer 200: object with `history`. ```bash curl -X PUT "https://programmable.dev/v1/app/history" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.setHistorySettings({}); ``` ```python pd.set_history_settings({}) ``` #### GET /v1/tenants/{tenant}/calls A tenant's calls. 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). - query `actor` string: Only this actor's calls (your actor id). - query `outcome` "running" | "ok" | "tool_error" | "error" | "timed_out" | "cancelled" | "blocked" | "needs_approval" | "dry_run": Only calls with this outcome. - query `channel` "mcp" | "rest" | "approval" | "proxy": Only calls made this way. - query `tool` string 1-200 chars: Only calls to this tool. - query `cost_label` string: Only calls with this cost label. - query `limit` integer 1-200: Default 50. - query `before` string: The `next` cursor from the previous page. Answer 200: object with `items`, `next`. Error codes: NO_TENANT, BAD_FILTER. ```bash curl "https://programmable.dev/v1/tenants/acme/calls" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.listCalls("acme"); ``` ```python pd.list_calls("acme") ``` #### GET /v1/calls/{call} One call. 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. - query `tenant` string: Your tenant id; when sent, the call must be in it. Answer 200: object with `call`. Error codes: NO_CALL. ```bash curl "https://programmable.dev/v1/calls/call" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getCall("call"); ``` ```python pd.get_call("call") ``` ### Grants and tools Which tools each agent may use, with daily caps and approvals; call them over REST or MCP. #### GET /v1/app/default-grants Your app's default grant policy. Off until you turn it on. Answer 200: object with `default_grants`. ```bash curl "https://programmable.dev/v1/app/default-grants" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getDefaultGrants(); ``` ```python pd.get_default_grants() ``` #### PUT /v1/app/default-grants Give every actor a default grant on every connection of its tenant. 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. Body: - `policy` object or any or null, required - `policy.kind_policy` object, required - `policy.daily_call_cap` integer 0-100000 - `policy.daily_spend_cap_usd` number 0-100000 or any or null - `policy.payload` "full" | "result_only" | "none" Answer 200: object with `default_grants`. Error codes: UNSAFE_DEFAULT. ```bash curl -X PUT "https://programmable.dev/v1/app/default-grants" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.setDefaultGrants({}); ``` ```python pd.set_default_grants({}) ``` #### GET /v1/tenants/{tenant}/default-grants A tenant's default grant policy, and what is in force. `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. Answer 200: object with `default_grants`. Error codes: NO_TENANT. ```bash curl "https://programmable.dev/v1/tenants/acme/default-grants" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getTenantDefaultGrants("acme"); ``` ```python pd.get_tenant_default_grants("acme") ``` #### PUT /v1/tenants/{tenant}/default-grants Set a tenant's own default grant policy, under your app's. 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`). Body: - `policy` object or any or null, required - `policy.kind_policy` object, required - `policy.daily_call_cap` integer 0-100000 - `policy.daily_spend_cap_usd` number 0-100000 or any or null - `policy.payload` "full" | "result_only" | "none" Answer 200: object with `default_grants`. Error codes: NO_TENANT, KEY_SCOPED, UNSAFE_DEFAULT, ABOVE_APP_DEFAULT, DEFAULTS_OFF. ```bash curl -X PUT "https://programmable.dev/v1/tenants/acme/default-grants" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.setTenantDefaultGrants("acme", {}); ``` ```python pd.set_tenant_default_grants("acme", {}) ``` #### GET /v1/tenants/{tenant}/actors/{actor}/grants An actor's grants. Which connections (and which of their tools) this agent may use, with caps and approval settings. Answer 200: object with `grants`. Error codes: NO_TENANT, NO_ACTOR. ```bash curl "https://programmable.dev/v1/tenants/acme/actors/support-bot/grants" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.listGrants("acme", "support-bot"); ``` ```python pd.list_grants("acme", "support-bot") ``` #### PUT /v1/tenants/{tenant}/actors/{actor}/grants Replace an actor's grants. 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). Body: - `grants` object[] (≤ 200), required - `grants[].connection_id` string (uuid), required: 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)$ - `grants[].tools` (string 1-200 chars)[] (≤ 100) or any or null - `grants[].daily_call_cap` integer 0-100000 - `grants[].requires_approval` boolean - `grants[].approve_by_link` object or any or null - `grants[].kind_policy` object or any or null - `grants[].trust_read_hints` boolean - `grants[].tool_rules` object (map) or any or null - `grants[].resources` object (map) or any or null - `grants[].resources_strict` boolean - `grants[].daily_spend_cap_usd` number 0-100000 or any or null - `grants[].payload` "full" | "result_only" | "none" - `grants[].mcp_resources` boolean - `grants[].mcp_prompts` boolean - `grants[].mcp_ui` boolean - `grants[].expires_at` string (date-time) or any or null - `grants[].on_tool_change` "hold" | "ask" | "allow" or any or null Answer 200: object with `grants`. Error codes: NO_TENANT, NO_ACTOR, NO_CONNECTION, DUPLICATE, TOO_MANY, BAD_ID, BAD_GRANT, LINK_OFF, BAD_LINK, LINK_NOT_ALLOWED. ```bash curl -X PUT "https://programmable.dev/v1/tenants/acme/actors/support-bot/grants" \ -H "Authorization: Bearer $PD_APP_KEY" \ -H "Content-Type: application/json" \ -d '{"grants":[{"connection_id":"$CONNECTION_ID","daily_call_cap":50,"requires_approval":true}]}' ``` ```ts await pd.setGrants("acme", "support-bot", {"grants":[{"connection_id":"$CONNECTION_ID","daily_call_cap":50,"requires_approval":true}]}); ``` ```python pd.set_grants("acme", "support-bot", {"grants":[{"connection_id":"$CONNECTION_ID","daily_call_cap":50,"requires_approval":True}]}) ``` #### GET /v1/tenants/{tenant}/actors/{actor}/tools An actor's tools. 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`. - query `view` "agent" | "all": `agent` (the default): what the agent is listed. `all`: every definition, also in discovery mode. Answer 200: object with `tools`, `held`, `discovery`. Error codes: NO_TENANT, NO_ACTOR, BAD_FILTER. ```bash curl "https://programmable.dev/v1/tenants/acme/actors/support-bot/tools" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.listTools("acme", "support-bot"); ``` ```python pd.list_tools("acme", "support-bot") ``` #### GET /v1/tenants/{tenant}/actors/{actor}/tool-discovery How an actor's tools are offered. The actor's tool discovery setting. `off` until you set it. Answer 200: object with `tool_discovery`. Error codes: NO_TENANT, NO_ACTOR. ```bash curl "https://programmable.dev/v1/tenants/acme/actors/support-bot/tool-discovery" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getToolDiscovery("acme", "support-bot"); ``` ```python pd.get_tool_discovery("acme", "support-bot") ``` #### PUT /v1/tenants/{tenant}/actors/{actor}/tool-discovery Turn tool discovery on or off for an actor. 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. Body: - `mode` "off" | "on" | "auto", required - `threshold` integer 1-10000 Answer 200: object with `tool_discovery`. Error codes: NO_TENANT, NO_ACTOR. ```bash curl -X PUT "https://programmable.dev/v1/tenants/acme/actors/support-bot/tool-discovery" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.setToolDiscovery("acme", "support-bot", {}); ``` ```python pd.set_tool_discovery("acme", "support-bot", {}) ``` #### GET /v1/tenants/{tenant}/actors/{actor}/tools/search Search an actor's tools. 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. - query `q` string ≤ 200 chars: Words about what the tool should do, or part of its name. Left out: every tool, in list order. - query `kind` "read" | "write" | "destructive": Only tools of this kind. - query `connection` string: Only one connection's tools: its id, its tool-name prefix or its provider. - query `limit` integer 1-25: Default 10. - query `cursor` string: `next_cursor` from the page before, with the same filters. Answer 200: object with `results`, `total`, `next_cursor`, `unavailable`. Error codes: NO_TENANT, NO_ACTOR, BAD_FILTER. ```bash curl "https://programmable.dev/v1/tenants/acme/actors/support-bot/tools/search" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.searchTools("acme", "support-bot"); ``` ```python pd.search_tools("acme", "support-bot") ``` #### GET /v1/tenants/{tenant}/actors/{actor}/tools/describe One tool's definition. 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. - query `name` string 1-200 chars: The tool's name. Required. Answer 200: object with `status`, `tool`, `held`, `connection`. Error codes: NO_TENANT, NO_ACTOR, BAD_FILTER, UNKNOWN_TOOL. ```bash curl "https://programmable.dev/v1/tenants/acme/actors/support-bot/tools/describe" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.describeTool("acme", "support-bot"); ``` ```python pd.describe_tool("acme", "support-bot") ``` #### POST /v1/tenants/{tenant}/actors/{actor}/tools/call Call a tool. 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`. Body: - `name` string 1-200 chars, required - `input` object (map) - `dry_run` boolean - `cost_label` string: pattern ^[A-Za-z0-9._:-]{1,64}$ Answer 200: CallResult. Error codes: NO_TENANT, NO_ACTOR, UNKNOWN_TOOL, BILLING_REQUIRED, BAD_TOOL_CALL. ```bash curl -X POST "https://programmable.dev/v1/tenants/acme/actors/support-bot/tools/call" \ -H "Authorization: Bearer $PD_APP_KEY" \ -H "Content-Type: application/json" \ -d '{"name":"github__list_issues","input":{"repo":"acme/web"}}' ``` ```ts await pd.callTool("acme", "support-bot", {"name":"github__list_issues","input":{"repo":"acme/web"}}); ``` ```python pd.call_tool("acme", "support-bot", {"name":"github__list_issues","input":{"repo":"acme/web"}}) ``` ### Token read Your server holds a connection's OAuth access token itself. Off until you turn it on. #### GET /v1/app/token-read Is token read on for your app. Token read is off until you turn it on. Answer 200: object with `token_read`. ```bash curl "https://programmable.dev/v1/app/token-read" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getTokenReadSettings(); ``` ```python pd.get_token_read_settings() ``` #### PUT /v1/app/token-read Turn token read on or off. 403 TOKEN_READ_LOCKED while a platform admin's "off" stands. Body: - `enabled` boolean, required Answer 200: object with `token_read`. Error codes: TOKEN_READ_LOCKED. ```bash curl -X PUT "https://programmable.dev/v1/app/token-read" \ -H "Authorization: Bearer $PD_APP_KEY" \ -H "Content-Type: application/json" \ -d '{"enabled":true}' ``` ```ts await pd.setTokenReadSettings({"enabled":true}); ``` ```python pd.set_token_read_settings({"enabled":True}) ``` #### POST /v1/tenants/{tenant}/connections/{connection}/token Read a connection's OAuth access token. 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. Body (optional): - `force_refresh` boolean Answer 200: AccessToken. 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. ```bash curl -X POST "https://programmable.dev/v1/tenants/acme/connections/$CONNECTION_ID/token" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.readAccessToken("acme", connectionId); ``` ```python pd.read_access_token("acme", connection_id) ``` ### Approvals Calls waiting for a person to say yes. #### GET /v1/tenants/{tenant}/approvals A tenant's approvals. Pending ones oldest first, otherwise newest first. Pending approvals expire after 24 hours. - query `status` "pending" | "approved" | "rejected" | "expired" | "all": Default pending. - query `limit` integer 1-200: Default 100. Answer 200: object with `items`. Error codes: NO_TENANT. ```bash curl "https://programmable.dev/v1/tenants/acme/approvals" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.listApprovals("acme"); ``` ```python pd.list_approvals("acme") ``` #### POST /v1/approvals/{approval}/decide Approve or reject a call. 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. Body: - `decision` "approve" | "reject", required - `digest` string: pattern ^[0-9a-f]{64}$ - `input` object (map) - `tenant` string 1-128 chars - `decided_by` string 1-128 chars - `note` string ≤ 500 chars Answer 200: object with `approval`. Error codes: NO_APPROVAL, NO_DIGEST, DIGEST_MISMATCH, DECIDED, EXPIRED, APP_DISABLED, BAD_EDIT, NOT_EDITABLE, APPROVAL_KEY. ```bash curl -X POST "https://programmable.dev/v1/approvals/$APPROVAL_ID/decide" \ -H "Authorization: Bearer $PD_APP_KEY" \ -H "Content-Type: application/json" \ -d '{"decision":"approve","digest":"$DIGEST"}' ``` ```ts await pd.decideApproval(approvalId, {"decision":"approve","digest":"$DIGEST"}); ``` ```python pd.decide_approval(approval_id, {"decision":"approve","digest":"$DIGEST"}) ``` #### GET /v1/approvals Your app's approvals, across tenants. 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. - query `status` "pending" | "approved" | "rejected" | "expired" | "all": Default pending. - query `tenant` string: Your tenant id, to list one tenant only. - query `limit` integer 1-200: Default 100. Answer 200: object with `items`. Error codes: NO_TENANT, APPROVAL_KEY. ```bash curl "https://programmable.dev/v1/approvals" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.listAppApprovals(); ``` ```python pd.list_app_approvals() ``` #### POST /v1/tenants/{tenant}/approvals Ask a person before an action. 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. Body: - `actor` string 1-128 chars, required - `action` "send" | "spend" | "delete" | "change" | "other", required - `title` string 1-200 chars, required - `details` object (map) Answer 201: object with `approval`. Error codes: NO_TENANT, NO_ACTOR, DETAILS_TOO_LONG, APP_DISABLED, REQUEST_QUEUE_FULL. ```bash curl -X POST "https://programmable.dev/v1/tenants/acme/approvals" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.createApprovalRequest("acme", {}); ``` ```python pd.create_approval_request("acme", {}) ``` #### GET /v1/approvals/{approval} One approval. 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. - query `tenant` string: Your tenant id; when sent, the approval must be in it. Answer 200: object with `approval`. Error codes: NO_APPROVAL. ```bash curl "https://programmable.dev/v1/approvals/$APPROVAL_ID" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getApproval(approvalId); ``` ```python pd.get_approval(approval_id) ``` #### POST /v1/approvals/{approval}/use Spend an approved request. 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. Body: - `digest` string, required: pattern ^[0-9a-f]{64}$ - `tenant` string 1-128 chars Answer 200: object with `approval`. Error codes: NO_APPROVAL, NOT_APPROVED, ALREADY_USED, USE_EXPIRED, DIGEST_MISMATCH, NOT_A_REQUEST, APP_DISABLED. ```bash curl -X POST "https://programmable.dev/v1/approvals/$APPROVAL_ID/use" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.useApproval(approvalId, {}); ``` ```python pd.use_approval(approval_id, {}) ``` ### Usage Calls, outcomes and cost; spending limits per app, tenant and actor. #### GET /v1/tenants/{tenant}/usage Calls and cost. Calls, outcomes and cost by UTC day, connection, actor and your own cost label (`by_label`). - query `days` integer 1-400: Default 30. Answer 200: Usage. Error codes: NO_TENANT. ```bash curl "https://programmable.dev/v1/tenants/acme/usage" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getUsage("acme"); ``` ```python pd.get_usage("acme") ``` #### GET /v1/tenants/{tenant}/usage.csv The tenant's calls as a CSV file. 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. - query `from` string ≤ 40 chars: Start, inclusive: YYYY-MM-DD (UTC) or a date-time with a zone. Default 30 days before `to`. - query `to` string ≤ 40 chars: End, exclusive: YYYY-MM-DD (the end of that UTC day) or a date-time with a zone. Default now. - query `before` string: The X-Export-Next-Before cursor of the previous, cut file. Answer 200: a text/csv file. The SDKs return `{ csv, truncated, next_before }`. Error codes: NO_TENANT, BAD_FILTER, RATE_LIMITED. ```bash curl "https://programmable.dev/v1/tenants/acme/usage.csv" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.exportUsageCsv("acme"); ``` ```python pd.export_usage_csv("acme") ``` #### GET /v1/app/spend-limits Your app's monthly spending limit. 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. Answer 200: object with `spend_limits`. ```bash curl "https://programmable.dev/v1/app/spend-limits" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getAppSpendLimits(); ``` ```python pd.get_app_spend_limits() ``` #### PUT /v1/app/spend-limits Set your app's monthly spending limit. `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. Body: - `monthly` object or any or null, required - `monthly.cap_usd` number 0-100000, required - `monthly.warn_percent` integer 1-99 or any or null Answer 200: object with `spend_limits`. Error codes: TEST_KEY. ```bash curl -X PUT "https://programmable.dev/v1/app/spend-limits" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.setAppSpendLimits({}); ``` ```python pd.set_app_spend_limits({}) ``` #### GET /v1/tenants/{tenant}/spend-limits A tenant's spending limits. 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. Answer 200: object with `spend_limits`. Error codes: NO_TENANT. ```bash curl "https://programmable.dev/v1/tenants/acme/spend-limits" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getTenantSpendLimits("acme"); ``` ```python pd.get_tenant_spend_limits("acme") ``` #### PUT /v1/tenants/{tenant}/spend-limits Set a tenant's spending limits. "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. Body: - `daily` object or any or null - `daily.cap_usd` number 0-100000, required - `daily.warn_percent` integer 1-99 or any or null - `monthly` object or any or null - `monthly.cap_usd` number 0-100000, required - `monthly.warn_percent` integer 1-99 or any or null Answer 200: object with `spend_limits`. Error codes: NO_TENANT, KEY_SCOPED. ```bash curl -X PUT "https://programmable.dev/v1/tenants/acme/spend-limits" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.setTenantSpendLimits("acme", {}); ``` ```python pd.set_tenant_spend_limits("acme", {}) ``` #### GET /v1/tenants/{tenant}/actors/{actor}/spend-limits An actor's monthly spending limit. The most this one actor may spend on tool calls in a UTC calendar month, over every connection. Null until set. Answer 200: object with `spend_limits`. Error codes: NO_TENANT, NO_ACTOR. ```bash curl "https://programmable.dev/v1/tenants/acme/actors/support-bot/spend-limits" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getActorSpendLimits("acme", "support-bot"); ``` ```python pd.get_actor_spend_limits("acme", "support-bot") ``` #### PUT /v1/tenants/{tenant}/actors/{actor}/spend-limits Set an actor's monthly spending limit. `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. Body: - `monthly` object or any or null, required - `monthly.cap_usd` number 0-100000, required - `monthly.warn_percent` integer 1-99 or any or null Answer 200: object with `spend_limits`. Error codes: NO_TENANT, NO_ACTOR, KEY_SCOPED. ```bash curl -X PUT "https://programmable.dev/v1/tenants/acme/actors/support-bot/spend-limits" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.setActorSpendLimits("acme", "support-bot", {}); ``` ```python pd.set_actor_spend_limits("acme", "support-bot", {}) ``` ### Webhooks Events sent to your server, signed with your secret. #### GET /v1/app/webhook Where your events go. Your webhook URL, event filter and signature format. Never the secret. Answer 200: object with `webhook`. ```bash curl "https://programmable.dev/v1/app/webhook" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getWebhook(); ``` ```python pd.get_webhook() ``` #### PUT /v1/app/webhook Set your webhook URL. 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. Body: - `url` string (uri) ≤ 2000 chars or any or null, required - `rotate_secret` boolean - `events` (string ≤ 100 chars)[] (≤ 40) or any or null: 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. - `signature_format` "legacy" | "suite": What the X-Programmable-Signature header carries: suite = t=,v1=.")> (the Programmable suite's format, and what a newly registered app starts with), legacy = sha256= (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. Answer 200: object with `webhook`, `secret`. Error codes: BAD_URL, BAD_EVENT_TYPES. ```bash curl -X PUT "https://programmable.dev/v1/app/webhook" \ -H "Authorization: Bearer $PD_APP_KEY" \ -H "Content-Type: application/json" \ -d '{"url":"https://app.example.com/hooks/programmable"}' ``` ```ts await pd.setWebhook({"url":"https://app.example.com/hooks/programmable"}); ``` ```python pd.set_webhook({"url":"https://app.example.com/hooks/programmable"}) ``` #### GET /v1/app/webhooks/stats Provider webhook counts. Provider webhooks routed to your own connections: matched, not subscribed, and forwarded as provider.event. Counts only. - query `days` integer 1-400: Default 30. Answer 200: WebhookStats. ```bash curl "https://programmable.dev/v1/app/webhooks/stats" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getWebhookStats(); ``` ```python pd.get_webhook_stats() ``` ### Your OAuth clients Register your own OAuth client so the consent screen names your app. #### GET /v1/app/providers Your own OAuth clients. OAuth clients you registered so the provider's consent screen names your app. Never a secret. Answer 200: AppClients. ```bash curl "https://programmable.dev/v1/app/providers" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.listAppClients(); ``` ```python pd.list_app_clients() ``` #### PATCH /v1/app/providers Require your own OAuth clients. With `require_own_client`, a connect for a provider where you have no client is refused (409 OWN_CLIENT_REQUIRED) instead of using ours. Body: - `require_own_client` boolean, required Answer 200: AppClients. ```bash curl -X PATCH "https://programmable.dev/v1/app/providers" \ -H "Authorization: Bearer $PD_APP_KEY" \ -H "Content-Type: application/json" \ -d '{"require_own_client":true}' ``` ```ts await pd.setRequireOwnClient({"require_own_client":true}); ``` ```python pd.set_require_own_client({"require_own_client":True}) ``` #### GET /v1/app/providers/{provider}/client Your OAuth client for a provider. Includes the redirect URI to register at the provider. Answer 200: object with `client`. Error codes: NO_CLIENT. ```bash curl "https://programmable.dev/v1/app/providers/github/client" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getAppClient("github"); ``` ```python pd.get_app_client("github") ``` #### PUT /v1/app/providers/{provider}/client Register your OAuth client for a provider. 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. Body: - `client_id` string 1-512 chars, required - `client_secret` string 1-4096 chars - `webhook_secret` string 8-4096 chars - `clear_webhook_secret` boolean - `private_key` string 1-8192 chars - `private_key_id` string: pattern ^[A-Za-z0-9._:+/=-]{1,200}$ - `clear_private_key` boolean - `app_token` string 8-4096 chars - `clear_app_token` boolean - `install_slug` string or any or null Answer 200: object with `client`. Error codes: NO_PROVIDER, UNSUPPORTED, TOO_MANY_CLIENTS, BAD_PRIVATE_KEY, REDIRECT_MISMATCH. ```bash curl -X PUT "https://programmable.dev/v1/app/providers/github/client" \ -H "Authorization: Bearer $PD_APP_KEY" \ -H "Content-Type: application/json" \ -d '{"client_id":"Iv1.abc123","client_secret":"…"}' ``` ```ts await pd.setAppClient("github", {"client_id":"Iv1.abc123","client_secret":"…"}); ``` ```python pd.set_app_client("github", {"client_id":"Iv1.abc123","client_secret":"…"}) ``` #### DELETE /v1/app/providers/{provider}/client Remove your OAuth client for a provider. 409 CLIENT_IN_USE while connections were signed in with it; `force=true` marks them needs_reauth instead. - query `force` "true": Remove it even while connections use it. Answer 200: object with `deleted`, `needs_reauth`. Error codes: NO_CLIENT, CLIENT_IN_USE. ```bash curl -X DELETE "https://programmable.dev/v1/app/providers/github/client" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.deleteAppClient("github"); ``` ```python pd.delete_app_client("github") ``` ### MCP sign-in Let the person your app names connect a stock MCP client (Claude, n8n) to their agent by signing in, instead of pasting a token. #### GET /v1/tenants/{tenant}/mcp-oauth-email Is an address bound for MCP sign-in. 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. Answer 200: object with `mcp_oauth_email`. Error codes: NO_TENANT. ```bash curl "https://programmable.dev/v1/tenants/acme/mcp-oauth-email" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getMcpOauthEmail("acme"); ``` ```python pd.get_mcp_oauth_email("acme") ``` #### PUT /v1/tenants/{tenant}/mcp-oauth-email Bind the address that may authorize MCP clients. 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:///mcp///`, 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). Body: - `email` string 3-254 chars, required - `actors` string[] (≤ 20), required Answer 200: object with `mcp_oauth_email`. Error codes: NO_TENANT, BAD_EMAIL, BAD_ACTORS, MCP_OAUTH_LIVE_ONLY, MCP_OAUTH_TEST_ACCOUNT. ```bash curl -X PUT "https://programmable.dev/v1/tenants/acme/mcp-oauth-email" \ -H "Authorization: Bearer $PD_APP_KEY" \ -H "Content-Type: application/json" \ -d '{"email":"person@example.com","actors":["support-bot"]}' ``` ```ts await pd.setMcpOauthEmail("acme", {"email":"person@example.com","actors":["support-bot"]}); ``` ```python pd.set_mcp_oauth_email("acme", {"email":"person@example.com","actors":["support-bot"]}) ``` #### DELETE /v1/tenants/{tenant}/mcp-oauth-email Unbind the address. Every MCP client the address authorized for this tenant stops at its next request. Sends `mcp_oauth.email_unbound`. Answer 200: object with `deleted`. Error codes: NO_TENANT. ```bash curl -X DELETE "https://programmable.dev/v1/tenants/acme/mcp-oauth-email" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.deleteMcpOauthEmail("acme"); ``` ```python pd.delete_mcp_oauth_email("acme") ``` ### Access requests Let an agent ask your server for a tool it doesn't have. #### GET /v1/app/access-requests Can your agents ask for access. Whether your actors get the built-in tool request_access, over MCP and in listTools / callTool. Off by default. Answer 200: object with `access_requests`. ```bash curl "https://programmable.dev/v1/app/access-requests" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getAccessRequests(); ``` ```python pd.get_access_requests() ``` #### PUT /v1/app/access-requests Let your agents ask for access. Needs a webhook (409 NO_WEBHOOK): each request arrives as an access.requested event. Nothing is connected or granted; your server decides. Body: - `enabled` boolean, required Answer 200: object with `access_requests`. Error codes: NO_WEBHOOK. ```bash curl -X PUT "https://programmable.dev/v1/app/access-requests" \ -H "Authorization: Bearer $PD_APP_KEY" \ -H "Content-Type: application/json" \ -d '{"enabled":true}' ``` ```ts await pd.setAccessRequests({"enabled":true}); ``` ```python pd.set_access_requests({"enabled":True}) ``` ### MCP server catalogue Remote MCP servers your users can connect. #### GET /v1/catalog/search Search MCP servers. Remote MCP servers your users can connect (with a connect session's catalog_entry_id). Vendor-official servers first. - query `q` string ≤ 200 chars: Search text. - query `provider` string ≤ 120 chars: Only this provider. - query `official_only` "true" | "1": Only servers run by the service's own vendor. - query `remote_only` "true" | "1": Only servers with a remote URL. - query `limit` integer 1-50: Default 20. Answer 200: object with `items`. ```bash curl "https://programmable.dev/v1/catalog/search" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.searchCatalog(); ``` ```python pd.search_catalog() ``` #### GET /v1/catalog/servers/{slug} Get one MCP server. One server with every listing of the same endpoint. Answer 200: object with `server`, `listings`. Error codes: NO_SERVER. ```bash curl "https://programmable.dev/v1/catalog/servers/linear" \ -H "Authorization: Bearer $PD_APP_KEY" ``` ```ts await pd.getCatalogServer("linear"); ``` ```python pd.get_catalog_server("linear") ``` ## Error catalogue | Code | Status | Where | Meaning | | --- | --- | --- | --- | | ABOVE_APP_DEFAULT | 400 | app API | Above app default. | | ALREADY_USED | 409 | app API | That approval was already used. | | APP_DISABLED | 403, 409 | app API | The app is turned off (by its owners or by Programmable). 403: every key and token of it is refused until it is turned back on; the message says who turned it off and where it is turned back on. 409: it can't ask for, act on or approve approvals meanwhile. | | APP_MOVED | 409 | app API | This app moved to another workspace; its owners start its plan there. | | APP_NOT_BILLED_HERE | 409 | app API | This app's billing can only be cancelled now. | | APPROVAL_KEY | 403 | app API | An approval key lists pending approvals only; use an app key for the others. | | BAD_ACTORS | 400 | app API | Actors: 1-… of your actor ids (A-Z a-z 0-9 . _ : -). | | BAD_BODY | 400 | app API | The proxy body or an OAuth client's fields don't fit together (for example base64 that does not decode, or a secret sent with its clear flag). | | BAD_CONFIG | 400 | app API | The connection's source, provider or config is missing or not valid. | | BAD_CREDENTIALS | 400 | connect page | The pasted credentials don't fit the provider's fields. | | BAD_EDIT | 400 | app API | Edited input goes with an approval; a rejection takes none. | | BAD_EMAIL | 400 | app API | Email: not an email address. | | BAD_EVENT_TYPES | 400 | app API | Events: a list of at most … event types, or null for every type. | | BAD_FILTER | 400 | app API | A query filter is not valid: a tool search's filter (kind, limit, cursor, a describe without a name, a view that is not agent or all), a call-history or usage filter (outcome, tool, date range, cursor), or a metadata filter that is not metadata[key]=value with a valid key and value, names a key twice, or is one of more than 5. | | BAD_GRANT | 400 | app API | Mcp_ui can be on for one connection of an actor at most. | | BAD_HEADER | 400 | app API | A proxied request header is not allowed or contains control characters. | | BAD_ID | 400 | app API | A tenant, actor or connection id is not in the allowed form (1-128 of A-Z a-z 0-9 . _ : -, or a uuid). | | BAD_IDEMPOTENCY_KEY | 400 | app API | …. | | BAD_INPUT | 400, 502 | connect page | A typed value (for example a site name) doesn't look right. | | BAD_INSTALL_SLUG | 409 | connect page | The app's OAuth client has no matching install page. | | BAD_LIMIT | 400 | app API | The limit must be a whole number of dollars from 0 to 100,000. | | BAD_LINK | 400 | app API | Approve_by_link needs requires_approval and an email address or mobile number. | | BAD_MODE | 400 | app API | Mode: live or test. | | BAD_PATH | 400 | app API | The proxied path is refused: it must start with /, stay under the provider's base path and carry no //, . or .. segments, encoded slashes, ? or #. | | BAD_PRIVATE_KEY | 400 | app API | The private key is not an unencrypted PEM key of a supported kind (RSA 2048 or more, or EC P-256). | | BAD_REQUEST | 400 | app API | The proxy body is not valid JSON of the expected shape. | | BAD_RETURN | 400 | app API | X-Dev-Return-To must be a known name and X-Dev-Return-Id a uuid. | | BAD_RETURN_URL | 400 | app API | Return_url's origin is not one of your app's return origins. | | BAD_RULE | 400 | app API | A proxy rule is not "METHOD /prefix", or there are more than 50. | | BAD_SCOPES | 400 | app API | Add_scopes asks for a scope the provider record does not allow, or is used without a signed-in provider connection. | | BAD_TOOL_CALL | 400 | app API | Call_tool's input is not `{ name, input }`: the tool to call and that tool's own input. Nothing was called. | | BAD_URL | 400 | app API | The webhook URL is not a public http(s) address (https in production). | | BILLING_REQUIRED | 402 | app API | Your app's trial is used up or its plan has ended; nothing was sent. The answer carries billing_url. | | BODY_TOO_LARGE | 413 | app API | The request is too large. | | CAPTURE_NOT_VERIFIED | 403 | connect page | The provider did not confirm the account the sign-in came back with. | | CHANGED | 409 | app API | What this approval would run no longer matches what was shown, so it was not run. | | CLIENT_ID_REQUIRED | 409 | connect page | The MCP server needs a client id pasted on the page. | | CLIENT_IN_USE | 409 | app API | … connection(s) were signed in with this client and refresh with it. Reconnect them first, or delete with force=true (they will need re-authorisation). | | COMMUNITY_NOT_ACCEPTED | 409 | app API | This is a community listing (…), not the vendor's own server: an admin must accept it explicitly (accept_community: true). | | COMPOSIO_FAILED | 502 | connect page | Composio could not start or finish the sign-in. | | COMPOSIO_OFF | 503 | app API | App connections through Composio are not switched on for this server. | | CONNECTION_LIMIT | 409 | app API | A tenant can have at most … connections; delete one first. | | CREDENTIAL_STORE_UNAVAILABLE | 503 | app API | The app's workspace keeps its credentials in its own secret store, and that store is not answering or is refusing us, so the credential was not stored anywhere. Try again when the store is back; a workspace owner sees its state on Settings > Workspace. | | CREDENTIALS_REFUSED | 400 | connect page | The provider refused the pasted credentials. | | CUSTOM_DOMAIN_LOOKUP_FAILED | 400 | connect page | A custom domain could not be mapped to the provider's own site. | | CUSTOMER_HOST_INVALID | 400 | connect page | The typed server address is not a public https name. | | CUSTOMER_HOST_TYPED | 400 | app API | Config.inputs.… is typed by the person on the hosted connect page (their own server's address), not sent by the app. | | CUSTOMER_HOST_UNREACHABLE | 502 | connect page | The typed server address does not resolve to a public address. | | DAILY_CAP | 429 | app API | This connection has reached its daily proxy cap (…). | | DECIDED | 409 | app API | That approval was already decided. | | DEFAULTS_OFF | 409 | app API | Default grants are off for this app; turn them on with PUT /v1/app/default-grants first. | | DELIVERY_PENDING | 409 | app API | This delivery is still waiting to be sent (or a redelivery of it is); nothing was queued. | | DETAILS_TOO_LONG | 400 | app API | Details: at most … characters as pretty JSON, so a person can read all of it. | | DIGEST_MISMATCH | 409 | app API | This is not the request the person approved; ask again. | | DISCOVERY_FAILED | 502 | connect page | The MCP server's OAuth settings could not be read. | | DUPLICATE | 400 | app API | Each connection may appear once. | | ENGINE | 500 | connect page | The sign-in lost a step it needed; start a new session. | | EXPIRED | 409 | app API | That approval expired before it was decided. | | FINGERPRINT_MISMATCH | 400 | connect page | The typed server is not the product the provider record is for. | | HOST_NOT_ALLOWED | 400 | app API | The request would go to a host that is not on the provider's allowed_hosts, so nothing was sent. | | IDEMPOTENCY_IN_FLIGHT | 409 | app API | The first request with this Idempotency-Key is still running; nothing was sent. Try again in … s. | | IDEMPOTENCY_KEY_REUSED | 409 | app API | This Idempotency-Key was already used on this connection with a different request (method, path, query or body). Use a new key for a new request. | | IDEMPOTENCY_OUTCOME_UNKNOWN | 409 | app API | The first request with this Idempotency-Key was sent, but its outcome was never recorded: it may have run. Nothing was sent now. Check at the provider, then use a new key if it must run again. | | IDEMPOTENCY_RESULT_TOO_LARGE | 409 | app API | The first request with this Idempotency-Key ran, and its answer was too large to keep for a replay; nothing was sent now. Read the result from the provider, or use a new key to run it again. | | IMPORT_DISABLED | 403 | app API | Importing connections is off on this service. | | IMPORT_NOT_ALLOWED | 403 | app API | Only the platform's own apps may import connections. | | IMPORT_REFRESH_REFUSED | 422 | app API | Import refresh refused. | | IMPORT_TRANSIENT | 502 | app API | The provider could not be reached to check the token; try again. | | IMPORT_UNSUPPORTED | 409 | app API | Only sign-in (authorization code) connections can be imported. | | INSECURE_URL | 502 | connect page | The MCP server's OAuth settings point at a non-https address. | | INVALID | 400 | connect page | A pasted client id or secret is too long. | | ISSUER_MISMATCH | 502 | connect page | The MCP server's OAuth issuer is not the one it named. | | KEY_SCOPED | 403 | app API | This key reaches one tenant (…) only; use an app key for this. | | LINK_NOT_ALLOWED | 403 | app API | Approving by link needs a platform admin to allow it for this app. | | LINK_OFF | 400 | app API | Approving by link isn't set up on this server. | | LOOKUP_FAILED | 502 | connect page | The provider's site lookup failed. | | LOOKUP_NO_MATCH | 403 | connect page | The provider's site lookup did not list exactly one site this sign-in can reach. | | MCP_OAUTH_LIVE_ONLY | 409 | app API | MCP sign-in reaches live tenants only; bind the address with a live key. | | MCP_OAUTH_TEST_ACCOUNT | 409 | app API | The dashboard's test tenant can't have a bound address; its developers sign in to it as members. | | METADATA_LIMIT | 400 | app API | After the change (a PATCH, or a connect session's metadata merged over the connection's) the metadata would hold more than 20 keys or 4096 bytes of JSON. | | METHOD_OVERRIDE | 400 | app API | A proxied request carries a method-override argument (_method, X-HTTP-Method-Override and the like) as a query key or a top-level body key. Send the method you mean instead. | | MISSING_INPUT | 400, 409 | connect page | The page needs a value the person has not entered. | | MODEL_PROVIDER | 409 | app API | … is an AI model provider. Model keys are kept in the platform's vault, not connected here, so this record can't go live. | | NEEDS_APPROVAL | 409 | app API | A person has to approve this request first. Send it again with X-Dev-Approval once they have. | | NEEDS_REAUTH | 409 | app API | This connection needs to be signed in again: …. | | NEEDS_SESSION | 400 | app API | An OAuth MCP server needs a person to sign in: use POST /v1/tenants/:t/connect-sessions. | | NEVER_A_READ | 422 | app API | Never a read. | | NEVER_APPROVED | 409 | app API | This record was never approved; there is nothing to restore. | | NO_ACTOR | 404 | app API | No such actor. | | NO_API_BASE | 409 | app API | This provider record has no api_base_url. | | NO_APPROVAL | 404 | app API | No such approval. | | NO_APPROVER | 409 | app API | This person has no programmable.dev profile to approve with. | | NO_CALL | 404 | app API | No such call. | | NO_CATALOG_ENTRY | 404 | app API | No such catalogue entry. | | NO_CLIENT | 404, 409 | app API | No OAuth client is available for that provider (yours, or ours for this provider). | | NO_CLIENT_KEY | 409 | app API | This provider authenticates the OAuth client with a private key (private_key_jwt), and none is stored with the client. | | NO_CONNECT_SESSION | 404 | app API | No such connect session. | | NO_CONNECTION | 404 | app API | No such connection. | | NO_DELIVERY | 404 | app API | No such delivery. | | NO_DIGEST | 400 | app API | Send the digest of the request as it was shown. | | NO_OAUTH | 502 | connect page | The MCP server offers no OAuth sign-in. | | NO_PKCE | 502 | connect page | The MCP server does not support PKCE. | | NO_PROVIDER | 404 | app API | No such provider is live. | | NO_SERVER | 404 | app API | No such server in the catalogue. | | NO_SNAPSHOT | 409 | app API | The approved version is not in the history any more. Review the record by hand. | | NO_TENANT | 404 | app API | No such tenant. Create it with POST /v1/tenants/:t first. | | NO_WEBHOOK | 409 | app API | Set the app's webhook first: access requests are sent there as access.requested events. | | NOT_A_REQUEST | 409 | app API | That approval is a tool call; approving it already ran it. | | NOT_APPROVED | 409 | app API | The approval is not approved: it is still pending, or it was rejected or expired. Do not act. | | NOT_CANONICAL_HOST | 400 | app API | A pasted cloud address is not under the provider's own domain; send the canonical site name. | | NOT_CHANGED | 409 | app API | The record already matches what was approved. | | NOT_CONNECTABLE | 422 | app API | That catalogue server can't be connected (no usable remote endpoint). | | NOT_CONNECTED | 409 | app API | The connection is not signed in (status is not connected). | | NOT_EDITABLE | 409 | app API | A request is your app's own action; it can be approved or rejected, not edited. | | NOT_OAUTH | 409 | app API | This connection uses pasted credentials, which are never handed out; call the provider through the proxy instead. | | NOT_PINNED | 400 | app API | This connection's tools are not from an outside server, so there is nothing to accept. | | NOT_RECORD_CONNECTION | 409 | app API | The proxy works only with provider-record connections. | | NOT_REMOTE | 422 | app API | That catalogue server runs only on a local machine (no remote URL). | | NOT_SUPPORTED | 400, 422 | app API | The connection or server does not support this (for example provider events on a non-provider connection, or an SSE-only MCP server). | | OWN_CLIENT_REQUIRED | 409 | app API | This app requires its own OAuth client for this provider and has none registered (PUT /v1/app/providers/:provider/client). | | PATH_NOT_ALLOWED | 403 | app API | … … is not allowed by this connection's proxy rules. | | PLATFORM_CLIENT | 409 | app API | This connection's token is issued to Programmable's own client, the same identity for every tenant, so it is never handed out; call the provider through the proxy instead. | | PLATFORM_KEYS_LOCKED | 402 | app API | Composio connections need your app on the paid plan (or a platform admin's allowance); nothing was sent. | | POLICY_BLOCKED | 403 | app API | This person's settings block … calls by their agents. | | PROVIDER_UNAVAILABLE | 503 | app API | Provider unavailable. | | PROXY_DISABLED | 403 | app API | The proxy is off for this app. Turn it on with PUT /v1/app/proxy { enabled: true }. | | PROXY_LOCKED | 403 | app API | A platform admin turned the proxy off for this app; ask them to turn it on. | | RATE_LIMITED | 429 | app API | Too many requests right now (per connection: proxy 120 a minute, token read 60, connection tests 6; per tenant: 6 usage CSV exports a minute); wait and try again. | | RECORD_CHANGED | 409 | connect page | The provider record changed while the person was on the page; start a new session. | | RECORD_NOT_LIVE | 409 | app API | That provider is not available to connect yet. | | REDIRECT_MISMATCH | 400, 409 | app API | The registered redirect URI (…) is not this service's callback (…); update the registration. | | REFRESH_FAILED | 503 | app API | The provider could not be reached to refresh the token; try again shortly. | | REGISTRATION_FAILED | 502 | connect page | The MCP server refused our client registration. | | REQUEST_QUEUE_FULL | 429 | app API | This tenant already has … requests waiting. Wait for a decision or an expiry. | | RESERVED_ID | 400 | app API | Ids starting with dashboard- are kept for the dashboard's test account; pick another id. | | RESOURCE_MISMATCH | 502 | connect page | The MCP server's OAuth metadata names another resource. | | SECRET_REQUIRED | 400 | app API | Secret is required for this provider. | | SESSION_COMPLETED | 409 | app API | This connect session has already ended (…). | | SESSION_FINISHING | 409 | app API | This connect session is finishing right now (the person's key is being saved). Ask again in a moment. | | SNAPSHOT_INVALID | 409 | app API | The approved version no longer passes today's checks (…). Review the record by hand. | | SOURCE_MISMATCH | 400 | app API | Connection_id names a connection of a different source than the session asks for. | | TEST_KEY | 403 | app API | Test keys can read app-wide settings but not change them; use a live key. | | TOKEN_READ_DISABLED | 403 | app API | Token read is off for this app. Turn it on with PUT /v1/app/token-read { enabled: true }. | | TOKEN_READ_LOCKED | 403 | app API | A platform admin turned token read off for this app; ask them to turn it on. | | TOKEN_REFUSED | 502 | connect page | The provider refused the token request. | | TOKEN_TRANSPORT | 502 | connect page | The provider's token endpoint could not be reached. | | TOO_MANY | 400 | app API | Too many items in one request (for example over 200 grants per actor). | | TOO_MANY_CLIENTS | 409 | app API | Too many earlier clients are still in use for this provider (…); reconnect or delete their connections first. | | TOOL_CHANGED_AGAIN | 409 | app API | … changed again since you looked (or … no longer listed). Nothing was accepted. Look at the changes again. | | UNAVAILABLE | 409 | app API | The provider record behind the connection is not available right now (not live, or changed since approval). | | UNKNOWN_TOOL | 404 | app API | The actor is not offered a tool by that name (re-list its tools). The answer to a call carries call_id and status: blocked. | | UNSAFE_DEFAULT | 400 | app API | Unsafe default. | | UNSAFE_URL | 422 | app API | … does not resolve to a public address. | | UNSUPPORTED | 400, 409, 502 | app API | The provider does not support this (for example an app's own OAuth client for a provider without a browser sign-in). | | UPSTREAM_FAILED | 502 | app API | The provider could not be reached; nothing more is known. | | UPSTREAM_TIMEOUT | 504 | app API | The provider did not answer within 25 seconds. The request may have reached it. | | USE_EXPIRED | 409 | app API | That approval was not used within 24 hours of the decision; ask again. | | VERIFY_FAILED | 502 | connect page | The provider could not be reached to check the credentials. | 80 endpoints.