Skip to content
Back to the app

Authentication ​

API keys ​

For your own systems, use an API key.

  1. Sign in and open /developer, Your API Key.
  2. 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.
  3. Send it as Authorization: Bearer <key> or X-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": [...]}.

ScopeLets the keyDefault for a new key
execute:agentsRun agents (/api/agents) and workflows (/api/workflows)Yes
write:workflowsRun and change workflows and decide approvals (/api/workflows)Yes
inferenceCall self-hosted models (/api/v1); see Private Inference APINo
mcpUse the MCP server (/api/v1/mcp)No
a2aUse the A2A server (/api/v1/a2a)No
objectsRead the Object Graph (/api/v1/objects), read-onlyNo
actionsPropose changes through Governed actions (/api/v1/actions); a person approves eachNo

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_id is the part of the key between cgnt_sk_ and the dot.
  • client_secret is the part after the dot.
bash
curl -X POST https://changents.ai/api/oauth/token \
  -u "<clientId>:<secret>" \
  -d grant_type=client_credentials \
  -d "scope=execute:agents"
json
{ "access_token": "eyJ…", "token_type": "Bearer", "expires_in": 900, "scope": "execute:agents" }
  • You may send client_id and client_secret in the form body instead of HTTP Basic auth. JSON bodies are accepted too.
  • scope is optional and space-separated. Leave it out to get all of the key's scopes. Asking for a scope the key does not hold returns 400 invalid_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_in runs 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 (only client_credentials is supported), invalid_client (401, the same answer whatever was wrong) and invalid_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.

bash
curl -X POST https://changents.ai/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{ "email": "you@example.com", "password": "…" }'
json
{ "success": true, "token": "eyJ…", "expiresIn": 86400, "user": { "…": "…" } }
  • Send token as Authorization: Bearer <token>. It lasts 24 hours.
  • The refresh token is set as an HttpOnly cookie. POST /api/auth/token/refresh issues a new session token.
  • Login answers 403 until 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.

Served from this deployment. No page view leaves it.