Authentication
API keys
For your own systems, use an API key.
- Sign in and open
/developer, Your API Key. - Create a key. It has the form
cgnt_sk_<clientId>.<secret>and is shown once, when it is created or rotated; only a hash is stored. Keep it in your secret manager. - Send it as
Authorization: Bearer <key>orX-API-Key: <key>.
You can have up to 5 active keys. The icons beside each key rotate it (a new secret, shown once) or revoke it. A request made with a key acts as the key's owner, with the owner's quota, credits, organisation role and policies.
Scopes
A key reaches only the APIs its scopes allow. A key without the scope an API needs is refused with 403 and {"error": "insufficient_scope", "required": [...]}.
| Scope | Lets the key | Default for a new key |
|---|---|---|
execute:agents | Run agents (/api/agents) and workflows (/api/workflows) | Yes |
write:workflows | Run and change workflows and decide approvals (/api/workflows) | Yes |
inference | Call self-hosted models (/api/v1); see Private Inference API | No |
mcp | Use the MCP server (/api/v1/mcp) | No |
a2a | Use the A2A server (/api/v1/a2a) | No |
objects | Read the Object Graph (/api/v1/objects), read-only | No |
actions | Propose changes through Governed actions (/api/v1/actions); a person approves each | No |
A key made only for the Private Inference API cannot run agents or workflows. An MCP or A2A key reaches its own server and nothing else. An objects key reads the Object Graph and cannot change its mappings or link decisions: only a signed-in person can.
A sandbox key ("sandbox": true when you create it, or Create Sandbox Key on the Developer page) reads made-up records instead of your systems, and its approved changes write nothing. It can hold only the objects, actions and mcp scopes. See SDKs and CLI.
OAuth 2.0 client credentials
If your system expects OAuth 2.0 rather than a long-lived key, trade the key for a short-lived access token with the client-credentials grant. The client is the API key itself, so there is nothing new to register:
client_idis the part of the key betweencgnt_sk_and the dot.client_secretis the part after the dot.
curl -X POST https://changents.ai/api/oauth/token \
-u "<clientId>:<secret>" \
-d grant_type=client_credentials \
-d "scope=execute:agents"{ "access_token": "eyJ…", "token_type": "Bearer", "expires_in": 900, "scope": "execute:agents" }- You may send
client_idandclient_secretin the form body instead of HTTP Basic auth. JSON bodies are accepted too. scopeis optional and space-separated. Leave it out to get all of the key's scopes. Asking for a scope the key does not hold returns400invalid_scope.- Send the token as
Authorization: Bearer <access_token>wherever the key itself works:/api/agents,/api/workflows, the Private Inference API and the MCP and A2A servers. It acts as the key's owner and has only the scopes it was issued with. - Tokens last 15 minutes. Request a new one when
expires_inruns out; there is no refresh token. - Revoking or rotating the key ends its tokens at once, and a scope removed from the key stops working in tokens already issued.
- Errors are
{ "error": "...", "error_description": "..." }:invalid_request,unsupported_grant_type(onlyclient_credentialsis supported),invalid_client(401, the same answer whatever was wrong) andinvalid_scope. The endpoint allows 30 requests a minute per address.
The OpenAPI document does not list /api/oauth/token yet; this page is its reference.
Signed-in sessions
The web app uses a session token. A few account endpoints accept only a session, not a key: for example GET /api/credits/balance and /api/schedules.
curl -X POST https://changents.ai/api/auth/login \
-H "Content-Type: application/json" \
-d '{ "email": "you@example.com", "password": "…" }'{ "success": true, "token": "eyJ…", "expiresIn": 86400, "user": { "…": "…" } }- Send
tokenasAuthorization: Bearer <token>. It lasts 24 hours. - The refresh token is set as an HttpOnly cookie.
POST /api/auth/token/refreshissues a new session token. - Login answers
403until the email address is verified, and asks for a second factor when MFA is on for the account or the organisation.
Single sign-on is set up per organisation; see SSO & SCIM.