Skip to content

Authentication

The External API accepts two credential types, both sent as a Bearer token:

CredentialPrefixFor
Personal Access Token (PAT)csm_pat_Scripts and integrations acting as you
OAuth access tokencsm_oat_Third-party apps acting on behalf of a user

Sessions created in the Consortium app use a separate, device-keypair-based scheme — that surface is not part of the External API.

Create a PAT in the app under Settings → Developer → External API, or programmatically with a signed-in device token:

POST /v1/account/external-tokens
Authorization: Bearer <device token>
  • Expiry is optional: 1–3650 days, or non-expiring if unset.
  • Scopes are least-privilege — grant only what the caller needs.
  • Machine-scoped credentials (daemons, VPS hosts) cannot mint PATs.

Validate your wiring by calling /me:

Terminal window
curl https://api.consortium.dev/external/v1/me \
-H "Authorization: Bearer $CONSORTIUM_PAT"

/me returns the token’s scopes, the account, plan limits, and any active deprecation notices — call it first to validate wiring.

ScopeGrantsNotes
sessions:readList sessions and message metadata
sessions:writeSend messages into active sessionsRelay, blocks up to 30 s
sessions:contentRead message contentRequires a key grant
machines:readList machines and their state
machines:invokeRun commands on a machinePAT-only — never grantable to OAuth apps
machines:invoke:verifiedReserved; no endpoint yet
artifacts:readList artifacts
artifacts:contentRead artifact contentRequires a key grant
artifacts:writeReserved; no endpoint yet
webhooks:manageCreate and revoke webhook subscriptions
usage:readRead API usage counts
profile:readRead identity for the principal

Register an app under Settings → Developer (or POST /v1/developer/apps). You get a csm_oapp_… client ID and a client secret (shown once, rotatable).

The only supported flow is authorization code with PKCE (S256)plain challenges, implicit, and client-credentials grants are rejected.

  1. Send the user to GET /external/v1/oauth/authorize with client_id, redirect_uri, scope, state, code_challenge.
  2. The user approves on the Consortium consent screen, which lists the requested scopes.
  3. Exchange the code at POST /external/v1/oauth/token (client authentication via HTTP Basic or body parameters).

Token response:

{
"access_token": "csm_oat_...",
"refresh_token": "csm_ort_...",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "sessions:read profile:read"
}
  • Access tokens live 1 hour; refresh tokens 30 days.
  • POST /external/v1/oauth/revoke (RFC 7009) and POST /external/v1/oauth/introspect (RFC 7662) are available with client credentials.
  • OAuth apps can request most scopes, but machines:invoke and machines:invoke:verified are PAT-only by design.

Missing or bad credentials return 401 missing_token / 401 invalid_token; a valid token without the needed scope returns 403 insufficient_scope with a required array. See Errors for the full catalogue.