Agent Tokens
How to create and use agent tokens for programmatic API access.
Agent tokens are scoped bearer tokens for programmatic access. Use them in scripts, CI jobs, and AI agents instead of a user session. The token is only shown once on creation — store it in a secret manager immediately.
Create a token
POST /agent-tokens
Authorization: Bearer <existing-token-or-session-cookie>
Content-Type: application/json
{
"name": "production-pipeline",
"scopes": ["briefs:read", "decisions:write"],
"expiresAt": "2027-01-01T00:00:00Z"
}| Field | Type | Required | Notes |
|---|---|---|---|
name | string | Yes | Human-readable label (max 255 chars) |
scopes | string[] | Yes | At least one scope — free-form strings |
expiresAt | ISO 8601 | No | Token never expires if omitted |
Response
{
"token": "a1b2c3d4e5f6...",
"id": "3fa85f64-...",
"orgId": "7c9b1234-...",
"name": "production-pipeline",
"scopes": ["briefs:read", "decisions:write"],
"lastUsedAt": null,
"expiresAt": "2027-01-01T00:00:00.000Z",
"createdAt": "2026-04-30T10:00:00.000Z"
}The token field is the plain-text value and is returned once only. The server stores only a SHA-256 hash — it cannot be retrieved later. Copy it to your secret manager before closing this response.
Use a token
Include the token in the Authorization header on every request:
GET /entities
Authorization: Bearer a1b2c3d4e5f6...List tokens
Returns all active (non-revoked) tokens for your organisation. The plain token value is never included.
GET /agent-tokens
Authorization: Bearer <token>{
"tokens": [
{
"id": "3fa85f64-...",
"orgId": "7c9b1234-...",
"name": "production-pipeline",
"scopes": ["briefs:read", "decisions:write"],
"lastUsedAt": "2026-04-29T14:22:00.000Z",
"expiresAt": "2027-01-01T00:00:00.000Z",
"createdAt": "2026-04-30T10:00:00.000Z"
}
]
}Revoke a token
Revocation is a soft delete. Any in-flight request using the token will fail immediately on its next auth check.
DELETE /agent-tokens/{id}
Authorization: Bearer <token>Returns 204 No Content on success. Returns 404 if the token does not exist or belongs to another org.
Read-only until your organisation allows changes
AI tools connected through the MCP server with a token can only read by default: write actions are left out of the tools they are offered, and a write call is refused with MCP_WRITES_DISABLED. An administrator turns changes on with Connected AI tools may make changes at the top of Settings › Agent tokens (the setting mcp.writes_enabled). Writes then run with the permissions of the person who created the token, narrowed by the token's scopes, and important actions still pause for approval. The assistant inside the console is not affected by this switch.
Security notes
- Tokens are stored as SHA-256 hashes — a database breach does not expose plain token values.
- Set an
expiresAtfor tokens used in temporary pipelines or CI jobs. - Revoke tokens that are no longer needed. There is no cost to creating new ones.
- Scopes are stored as free-form strings. The server does not currently enforce scope-level access control — all valid (non-revoked, non-expired) tokens have full access to org resources. Scopes are reserved for future fine-grained enforcement.