Connect accounts
Auth configs, the hosted connect page, connection statuses and automatic refresh.
Connect accounts lets the people who use your product authorize an app (GitHub, Slack, Linear and more) so your agents can act on their behalf. This page covers the moving parts and the HTTP calls.
Auth configs
An auth config tells a project how its users connect to one toolkit. Create one per toolkit and scheme in the dashboard (Auth configs) or through the API.
| Kind | Applies to | Who owns the OAuth app |
|---|---|---|
| Managed | OAuth 2.0 only | We do. Nothing to set up, users see our app name. |
| Custom | Any OAuth 2.0 | You do. Provide a client ID and a client secret. |
| Key | API key, bearer | The user pastes a key on the hosted connect page. |
| Fields | Credential fields | The user fills in one or more named values (key, subdomain). |
Managed apps exist only where the platform operator configured them, for native toolkits and most OAuth catalog apps alike (see Managed OAuth apps). Client secrets are stored encrypted and are never returned by the API. Register this redirect URI in your own OAuth app:
https://<your-host>/api/v1/connect/oauth/callbackThe exact value is shown on every OAuth auth config as redirect_uri.
Deleting an auth config that an MCP server pins returns 409 in_use with the servers in
details.mcp_servers. Unpin it from those servers first, then delete it.
curl -X POST https://<your-host>/api/v1/auth_configs \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{ "toolkit_slug": "github", "auth_scheme": "oauth2" }'Users
Every connection belongs to a user_id of your choosing (1 to 256 characters). It is your own
identifier for the end user. It is not shown to them and not required to be unique: a user can
connect several accounts, and each connection creates a new connected account.
Personal and shared accounts
A connected account has a scope:
| Scope | user_id | label | Who uses it |
|---|---|---|---|
personal | Your user_id | null | That user only (the default, and what every older call creates). |
shared | Always __shared__ | The team's name for it | Every member of the project, in Claude and in automations. |
Every response carries scope, label and connected_by_user_id (the member whose sign-in or key
the credentials hold; null when an API key connected it or the member was deleted).
__shared__ is reserved: personal accounts, MCP user URLs and automation owners cannot use it
(400 validation_error). Lists may include shared rows; filter with ?scope=personal or
?scope=shared. To execute with a shared account, pass its connected_account_id. A
user_id: "__shared__" on execute resolves the newest active shared account of the toolkit, which
is rarely what you want once a project shares several.
Share an account
Send scope: "shared" and no user_id. A project can share several accounts of one app (for
example "Sales inbox" and "Support inbox", both Gmail), each with its own name:
curl -X POST https://<your-host>/api/v1/connected_accounts \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{ "auth_config_id": "ac_...", "scope": "shared", "label": "Sales inbox" }'- Label rules: spaces are trimmed and collapsed, then 1 to 60 characters of letters, numbers,
spaces and
. - _ @ & ' ( ) + , /.personal(any case) is reserved. - Unique per app: two shared accounts of one app in a project cannot have the same label, in
any letter case (
409 label_taken, withdetails.fieldErrors.label). Failed connections free their label. Another project may use the same label. - No label: the account is named after the app ("Gmail", then "Gmail 2" ...) and, once
connected, after the account it signed in with, for example
Gmail (sales@acme.com). - Limit: at most 10 shared accounts per app and project, counting
initiated,active,expiredandrevokedones (409 shared_accounts_limit). - Who: owners, admins, developers and API keys. Viewers cannot share (
403).
Rename, reconnect and disconnect
Rename a shared account with PATCH:
curl -X PATCH https://<your-host>/api/v1/connected_accounts/ca_... \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{ "label": "Support inbox" }'Personal accounts have no name (400 not_shared). A rename never changes tool names or breaks
automations, which pin the account by id.
Renaming, reconnecting and deleting a shared account changes what the whole team acts as, so only
the member who connected it, an owner, an admin or an API key may do it. Anyone else with write
access gets 403 shared_connection_restricted. When no connector is on record (an API key
connected it, or the member was deleted), only owners, admins and keys can. A reconnect makes the
reconnecting member the new connector and keeps the label. Refresh and verify stay open to every
member with write access. Personal accounts keep the existing rules.
Creating, renaming, reconnecting and deleting shared accounts is also rate limited
(shared_connection: 5 at once, then 10 per 10 minutes, per user or per API key project), on top
of the usual write limit.
The hosted connect page
Create a connection and send the user to the returned redirect_url:
curl -X POST https://<your-host>/api/v1/connected_accounts \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"auth_config_id": "ac_...",
"user_id": "user-42",
"callback_url": "https://agent.example.com/connected"
}'The response is the connected account in the initiated state plus redirect_url and
redirect_expires_at. The link works once and expires after 15 minutes. The page shows who is
asking for access and which permissions are requested, then sends the user to the provider (OAuth)
or asks for a key (API key and bearer schemes) or for each credential field (fields scheme). If
you already hold a user's key, send "credentials": { "value": "..." } instead (or
"credentials": { "fields": { ... } } for a fields auth config) and the account is created
active with no redirect. The credentials are checked with a test call first: a provider that
rejects them gives 400 invalid_credentials and nothing is stored. Fields, their formats and
validation errors are described in
Catalog apps.
After the user finishes, the browser returns to your callback_url (or to a neutral result page)
with these query parameters. Existing parameters on your URL are kept.
| Parameter | Value |
|---|---|
status | success or failed |
connected_account_id | The ca_... id. |
error | On failure only: access_denied, token_exchange_failed, invalid_state, session_expired, user_cancelled. |
Treat the query as a hint and confirm by reading the account, which you can poll:
curl https://<your-host>/api/v1/connected_accounts/ca_... \
-H "Authorization: Bearer $API_KEY"Statuses
| Status | Meaning |
|---|---|
initiated | The link was created and the user has not finished. |
active | Credentials are stored and usable. |
expired | Refreshing failed or the token ran out. Reconnect the account. |
failed | The user denied access, cancelled, or the link expired. Start a new one. |
revoked | The provider rejected the credentials during a call. Reconnect it. |
status_reason explains the state in a short code, for example access_denied or
refresh_failed:invalid_grant. To fix an expired or failed account without losing its id, call
POST /api/v1/connected_accounts/{id}/reconnect and send the user to the new redirect_url. For
API key, bearer and fields accounts you can instead send new credentials in the reconnect body,
in the same shape as above; they are stored at once and redirect_url is null.
Automatic refresh
When a provider issues expiring tokens, a background worker refreshes them before they run out, so
agents never see an expired token. If the provider rejects the refresh token the account moves to
expired and the reason is recorded. You can retry with
POST /api/v1/connected_accounts/{id}/refresh (for example after a fixed client secret) and check
that a connection still works with POST /api/v1/connected_accounts/{id}/verify.

