Add an AI account from a pasted key, for the workspace or for yourself
POST /connections/ai-accounts/connect
Constraints not expressible in JSON Schema, enforced at runtime:
- An engine-account label must not begin or end with whitespace and must contain no control characters (U+0000–U+001F, U+007F).
May require, depending on the request: connections.write, connections.org.write
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Header Parameters
Section titled “Header Parameters ”Org scope: me or an org slug. Absent means the caller’s active/personal org. It selects the workspace used for permission checks and for most resource filters; operation-specific access rules still apply.
Request Body required
Section titled “Request Body required ”object
org: the workspace’s accounts, used by every member’s tasks; me: the caller’s own, in this workspace.
The pasted key or token. Write-only.
Sign in again to this existing account instead of adding one.
object
org: the workspace’s accounts, used by every member’s tasks; me: the caller’s own, in this workspace.
openrouter: an OpenRouter key; bedrock: an Amazon Bedrock API key; custom: any endpoint that speaks the engine’s protocol.
Claude Code or Codex. One connection serves one engine.
custom only: the https base URL as the engine’s CLI means it (Claude: the API root, no /v1; Codex: the root /responses is appended to). No userinfo, query or fragment. An internal connection may use http.
Bedrock only: one AWS region id.
Bedrock only: runtime (Claude Code, Codex) or mantle (Codex only).
custom only: “Internal network”, an endpoint reachable only inside your own network (a LAN or private-network gateway). Workspace connections only (scope: "org", added by someone holding connections.org.write). Saved by hand: nothing calls it at save, models are typed, and it runs only on an owned runner serving the workspace. Can’t change on a reconnect.
The provider key. Write-only.
The full chosen model list. Required for a new connection; a reconnect keeps the list when omitted.
The ids Find models returned, to mark which ids were discovered.
Reconnect this connection with a new key. Its URL, engine, provider type, region, transport and internal flag never change.
Internal Claude Code connections only: the header the key is sent in (default bearer). Codex always uses Bearer; any other connection finds it out when the box tests the key.
Responses
Section titled “ Responses ”Server-sent event stream for a pasted key’s connect. A custom connection (mode: "custom") answers with JSON instead: { ok: true, accountId } (201) or { ok: false, reason } (422) with a reason code.
BAD_JSON — the body is not valid JSON, or INVALID_REQUEST — the decoded body does not match the route’s request schema.
object
object
Stable, machine-readable error code
Human-readable explanation
Present on 403 — the permission the caller lacked
Present on 402 — gated feature
Present on 402 — the plan’s cap
Present on 402 — the current plan
UNAUTHORIZED — missing or invalid token, or an org-scoped API key (only user-scoped keys are accepted).
object
object
Stable, machine-readable error code
Human-readable explanation
Present on 403 — the permission the caller lacked
Present on 402 — gated feature
Present on 402 — the plan’s cap
Present on 402 — the current plan
PLAN_LIMIT — the workspace’s plan does not include API access. Every API-key call can return this; session-token calls never do.
object
object
Stable, machine-readable error code
Human-readable explanation
Present on 403 — the permission the caller lacked
Present on 402 — gated feature
Present on 402 — the plan’s cap
Present on 402 — the current plan
FORBIDDEN (lacking the required permission) or SCOPE_REQUIRED (no workspace, or a membership change in progress).
object
object
Stable, machine-readable error code
Human-readable explanation
Present on 403 — the permission the caller lacked
Present on 402 — gated feature
Present on 402 — the plan’s cap
Present on 402 — the current plan
SCOPE_REQUIRED — the x-uai-org scope names a workspace that does not exist, or one the caller is not a member of. The two are deliberately indistinguishable: a 403 would confirm the workspace exists.
object
object
Stable, machine-readable error code
Human-readable explanation
Present on 403 — the permission the caller lacked
Present on 402 — gated feature
Present on 402 — the plan’s cap
Present on 402 — the current plan
PAYLOAD_TOO_LARGE — the request body exceeds 16384 bytes.
object
object
Stable, machine-readable error code
Human-readable explanation
Present on 403 — the permission the caller lacked
Present on 402 — gated feature
Present on 402 — the plan’s cap
Present on 402 — the current plan
SCOPE_REQUIRED — membership reconciliation required, or membership verification unavailable.
object
object
Stable, machine-readable error code
Human-readable explanation
Present on 403 — the permission the caller lacked
Present on 402 — gated feature
Present on 402 — the plan’s cap
Present on 402 — the current plan