An API key is a server credential sent in Authorization: Bearer. App keys start with scapp_ and belong to one app. Workspace keys start with scworks_ and belong to a workspace. See Authentication.
Returned by the app key endpoints under /v1/apps/:app_id/api_keys and the workspace key endpoints under /v1/workspaces/:workspace_id/api_keys. See App keys.
| Field | Type | Description |
|---|---|---|
| id | integer | Id of the key. |
| nickname | string | Name given to the key. |
| bearer_id | string | UUID of the app or workspace the key belongs to. |
| token_preview | string | First 6 and last 4 characters of the key, with the middle masked. |
| token_digest | string | The full key. Only in the create and rotate responses. |
| last_used_at | string | Last use, updated at most every 5 minutes. null when never used. |
| expires_at | string | When the key stops working, or null for no end. |
| rotated_from_id | integer | Id of the key this one replaced in a rotation, or null. |
| created_at | string | ISO 8601 time. |
{ "api_key": { "id": 4821, "nickname": "Production server", "bearer_id": "0193f8aa-5555-7666-8777-888888888888", "token_digest": "scapp_xxxxxxxxxxxxxxxxxxxxx", "token_preview": "scapp_••••••xxxx", "last_used_at": null, "expires_at": null, "rotated_from_id": null, "created_at": "2026-11-18T10:00:00.000Z" }}The full key is in token_digest once, in the create or rotate response. Lists and reads return token_preview only. A lost key cannot be read again: rotate it or create a new one.
Rotation#
A rotate call creates a new key with the same bearer and nickname and returns it in api_key, with the old key in old_api_key. The old key keeps working until it is deleted, or until the end set by old_key_expires_in: now, 1h, 24h, 7d or 30d. A key past its expires_at is refused with 401.