Authenticate with one key
Every request to Cadreen is authenticated via a scoped API key. This page covers how keys work, how to manage them, how workspace isolation is enforced, and what errors to expect.
Authenticate with one key
Two commands. Create a key, then use it.
/api/v1/maas/) for programmatic key management. All other Cadreen operations use the /api/v1/cadreen/ prefix.curl -X POST https://api.cadreen.com/api/v1/maas/workspaces/{workspace_id}/api-keys \
-H "Authorization: Bearer $YOUR_SIGN_IN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "production"}'curl https://api.cadreen.com/api/v1/cadreen/health \
-H "Authorization: Bearer $CADREEN_API_KEY"How API keys work
sk_cadreen_Authorization header403 api_key_write_required before it runs, and nothing is changed or charged. Read-only means read-only, and a scope never widens it: a key that lists read and also holds a scope such as policies.write can't use the scope. A key that lists permissions needs read (or write, admin, destructive or *) to read anything: a list with none of them is refused every GET, HEAD and lookup with 403 api_key_read_required. A key that lists nothing, which is every key made today, is asked nothing.policies.write to change rules (create, edit, confirm and delete them), routing.setup to set up routing jobs, connections.write to connect a service to the workspace, support.read to read support tickets, and support.write to work them (open, change, hand out and answer them). Neither includes the other, and claiming a ticket stays a signed-in person's. No other permission includes them. Without the scope, the key gets 403 scope_required. Rotating a key keeps its scopes. Use separate workspaces to isolate everything else.These calls only look something up, so a read-only key can make them. The same calls are also served under /cadreen, without /api/v1.
| Method | Path | What it does |
|---|---|---|
| POST | /api/v1/cadreen/agents/{agentID}/knowledge/search | Searches what an agent knows |
| POST | /api/v1/cadreen/policies/evaluate | Asks whether an action would be allowed |
| POST | /api/v1/cadreen/policies/simulate | The same question as a what-if |
| POST | /api/v1/cadreen/routing/dryRunByName | Says which provider a routing job would use, by its name, without sending anything |
| POST | /api/v1/cadreen/routing/groups/{id}/dry-run | The same, by the group's id |
| POST | /api/v1/cadreen/mcp/message | The MCP endpoint. Each tool checks its own level, so a read-only key reaches only the tools that read |
These look like reads, but each runs a model and your workspace is charged for it, so a read-only key can't make them either. The same goes for the cadreen_intent tool of the MCP endpoint: it runs a model, so it needs write permission, as cadreen_responses_create does.
| Method | Path | What it does |
|---|---|---|
| GET | /api/v1/cadreen/learning/episodes | Finds past executions like the query you send |
| GET | /api/v1/cadreen/learning/patterns | Groups recent executions into patterns |
| GET | /api/v1/cadreen/learning/suggestions | Ranks knowledge packs for the query you send |
| GET | /api/v1/cadreen/routing/groups/{id}/discover | Finds the tools that match a routing group |
A key that can only read changes nothing in your data and spends nothing. Cadreen still keeps its own record of what it was asked: when the key was last used, a trace of each search, policy check or routing dry run that answers with a result, and a row in its error log for a call that fails after reaching its route. A POST sent with an Idempotency-Key header also has its answer kept for 24 hours, so that sending it again returns the same answer (a cache of the answer, not your data). The trace and the row say which key made the call (the log keeps a limited number an hour for each key).
A few reads are not pure reads: the first time they are used they set something up, which is a cache or a registration and not something you stored. A read-only key can make them.
| Method | Path | What it sets up |
|---|---|---|
| GET | /api/v1/cadreen/devices/Every GET under it except /api/v1/cadreen/devices/mission/{missionId} | The first time a workspace uses any of them, sets up the workspace's device files (the map, the sync queue and the blackboard) |
| MCP | cadreen_devices_The tools of that name that only look something up | The same set-up as the device GET calls: the workspace's device files, the first time a workspace uses any of them |
Key lifecycle
Four operations. Create gives you a plaintext key. Rotate creates a new key and puts the old one in "rotating" status. Revoke soft-deletes. List shows all keys with status.
/api/v1/maas/ workspace admin prefix. For interactive key management, use the dashboard. All runtime Cadreen operations (/intent, /setup, /connections, etc.) use the /api/v1/cadreen/ prefix.Create
curl -X POST https://api.cadreen.com/api/v1/maas/workspaces/{workspace_id}/api-keys \
-H "Authorization: Bearer $YOUR_SIGN_IN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "rules-sync", "scopes": ["policies.write"]}'{
"api_key": {
"id": "key_01abc",
"name": "rules-sync",
"key_prefix": "sk_cadreen_",
"scopes": ["policies.write"],
"status": "active",
"created_at": "2026-06-03T12:00:00Z"
},
"full_key": "sk_cadreen_xxxxxxxxxxxxxxxx"
}Rotate
curl -X POST https://api.cadreen.com/api/v1/maas/workspaces/{workspace_id}/api-keys/{key_id}/rotate \
-H "Authorization: Bearer $YOUR_SIGN_IN_TOKEN"{
"id": "key_01def",
"key_prefix": "sk_cadreen_",
"name": "rules-sync",
"plaintext": "sk_cadreen_new_key_value_here",
"scopes": ["policies.write"],
"rotated_from": "key_01abc"
}Revoke
curl -X DELETE https://api.cadreen.com/api/v1/maas/workspaces/{workspace_id}/api-keys/{key_id} \
-H "Authorization: Bearer $YOUR_SIGN_IN_TOKEN"204 No ContentList
curl https://api.cadreen.com/api/v1/maas/workspaces/{workspace_id}/api-keys \
-H "Authorization: Bearer $CADREEN_API_KEY"{
"api_keys": [
{
"id": "key_01abc",
"name": "rules-sync",
"prefix": "sk_cadreen_",
"scopes": ["policies.write"],
"status": "active",
"created_at": "2026-06-03T12:00:00Z"
},
{
"id": "key_02def",
"name": "staging",
"prefix": "sk_cadreen_",
"scopes": [],
"status": "active",
"created_at": "2026-05-01T08:00:00Z"
}
],
"count": 2
}Workspace isolation
Authentication errors
All auth errors return a JSON body with code and message. The code is stable — program against it, not the message text.
| HTTP | Code | Meaning |
|---|---|---|
| 401 | missing_authorization_header | No Authorization header provided |
| 401 | invalid_authorization_header_format | The header isn't Bearer <key> |
| 401 | invalid_api_key | The key is not valid |
| 401 | api_key_expired | The key has expired |
| 401 | api_key_revoked | The key was revoked, or replaced when you rotated it — use the new key |
| 404 | workspace_not_found | The workspace in the URL isn't this key's workspace |
| 403 | scope_required | This key needs a scope it doesn't have, such as policies.write to change rules |
| 403 | api_key_write_required | This key can only read, and this call changes something or runs a model that's charged, so it wasn't run. Nothing was changed. Use a key with write permission |
| 403 | api_key_read_required | This key lists permissions but none of them is read or above, so it can't read: every GET, every HEAD and every lookup is refused, including the GETs that run a model. Nothing was changed. Use a key that lists read (or write), or one that lists nothing |
| 403 | api_key_permissions_unreadable | This key's permissions can't be read, so every call is refused, a GET or a HEAD included. Create a new key |
| 400 | unknown_scope | A new key asked for a scope that doesn't exist. The scopes are policies.write, routing.setup, connections.write, support.read and support.write |
| 429 | rate_limited | Too many requests — retry after Retry-After header |
{
"error": {
"type": "authentication_error",
"code": "api_key_revoked",
"message": "The provided API key has been revoked.",
"doc_url": "https://cadreen.com/docs?section=errors-section&code=api_key_revoked"
}
}