Bearer token
All routes require a bearer token. Send it in theAuthorization header:
Organization context
Requests are scoped to the organization your API key belongs to. There is nothing extra to send — the key already identifies the org.Which credential does each endpoint take?
Every reference page states what it accepts under Authorization. There are three classes:User identity
User identity travels in the session token: your backend mints one for an end user, and every request made with it is that user — from a browser or from a server. User-scoped resources resolve to{orgId}_{userId}. Nothing else is sent to identify the user, and
organization-scoped endpoints don’t need an identity at all.
Session tokens (for browsers)
A session token lets client-side code call the chat endpoints without holding your API key. Your backend vouches once for who the end user is, which group they bill to, and which tool credentials they may use; the browser gets back a token that carries all of that without being able to change any of it.1. Mint a token on your server
user_id is required. An omitted group_id bills the session to the
user’s current group — whatever a previous mint, chat call, or
PATCH /v1/users/{userId} set — falling
back to your organization’s Default group. The mint takes ids only: display
names for users and groups are set on the update routes. Send only
access_token to the browser if it has no need to refresh, or both if it
does.
2. Call the chat endpoints from the browser
3. Refresh when the access token expires
What a session token can reach
Session tokens are scoped to the chat runtime:POST /v1/chat · GET|DELETE /v1/chat/stream · GET /v1/threads ·
POST /v1/threads/{id}/read · GET /v1/messages · POST /v1/vote ·
POST /v1/agents/{id}/run · POST /v1/copilots/{id}/run ·
POST /v1/workflows/{id}/run · POST /v1/tools/{toolId}/execute ·
GET /v1/copilots/{id} · GET /v1/agents · GET /v1/agents/{id} ·
GET /v1/tools · the user’s own workflow schedules and runs
(/v1/workflow-schedules…, /v1/workflow-runs…)
Everything else — creating or editing agents, workflows, prompt blocks and tool
providers — returns 403 and requires the API key from your backend. There is no
token that grants write access to your organization’s configuration.
Tool credentials (tools_auth)
tools_auth is a map keyed by tool provider id, each entry carrying the
provider’s credentials (plus an optional base_url override):
null
entry to PATCH /v1/users/{userId}
(e.g. when the user disconnects an integration).
GET /v1/tools-auth lists your organization’s providers and the credential
fields each one expects — call it when building the map. Runtime auth is
organization-scoped, so the list is the same for every copilot (the
GET /v1/copilots/{id} read also bundles it as runtimeAuthProviders).
Lifetimes and revocation
Revoking the API key that minted a session ends that session immediately, along
with every other session minted from that key. Stored tool credentials outlive
sessions — remove them with
null entries on PATCH /v1/users/{userId} when a
user offboards or disconnects an integration.
Credentials in
tools_auth are encrypted at rest and injected server-side when
the agent calls a tool. They are never returned by any endpoint, never logged,
and never used as part of a cache key — including by the endpoints that accept
them.Updating a user without re-minting
Everything the mint call vouches for can be changed later, from your backend, while the browser keeps the session token it already holds:PATCH /v1/users/{userId} updates the user’s display name,
their per-provider tool credentials, and/or their group.
Users can also be created ahead of use with POST /v1/users — same fields
plus the id — so their group, name and credentials are in place before
their first session. Like groups, creating explicitly is optional: a mint
with an unseen user_id provisions the user automatically.
null entry deletes that
provider’s stored credentials.
This is the endpoint to reach for when an end user’s upstream token is
short-lived, when they move teams, when they disconnect an integration, or
when their scheduled workflows should keep running with fresh credentials
between logins. Like the mint call, it takes the org API key and must be
called from your backend — a session token cannot call it.
Groups
A group is the unit users belong to — today it is what billing and spend caps attach to. Create one ahead of use withPOST /v1/groups, so its cap is in
place before the first user references it:
PATCH /v1/groups/{groupId} renames a group or changes its cap
later:
null removes it.