Kabin

API keys

Every API call carries a key. Use narrow, expiring keys for agents and pipelines and keep the broad ones for yourself.

Key format and storage

  • Keys look like kbn_t<tenant>_<43 characters>. The secret is shown once, when you create or rotate a key. We store only a hash, a short prefix and the last four characters.
  • Send it as Authorization: Bearer <key>. Treat it like a password: environment variable or secret store, never in source control or client-side code.
  • Your first key is created in the dashboard. Keys with full access (restriction: "none") require the explicit admin preset; a misspelled scope can never produce a full-access key.

Scopes

A key's scope is {restriction, actions, sandboxes, environments, expiresAt}.

Actions
ActionAllows
sandbox.readGet and list sandboxes
sandbox.updateCreate, patch, resume, fork, delete
sandbox.stopStop sandboxes
execRun and manage commands
file.read, file.writeRead, list / write, delete files
sshInject SSH keys
snapshot.read, snapshot.writeList and read / save and delete saved snapshots
account.read/me, /limits
*All of the above (unrestricted keys only)

The catalog also lists actions of features that are planned (agent.prompt, desktop, host, environment.read, environment.values.read). They can be granted but do nothing yet. Webhook management and billing routes need an unrestricted key.

Presets: read-only (sandbox.read, file.read, snapshot.read, environment.read, account.read), full-sandbox, ci and admin. A call outside the key's actions answers 403 api_key_action_forbidden; a sandbox that is not on the key's allowlist (existing or not) answers 403 api_key_sandbox_forbidden.

Lifetime

ttl accepts 24h, 90d or seconds. The default is 90d, the maximum 365d, and never keeps the key until you revoke it. An expired key answers 401 and cannot be rotated (409 api_key_expired).

Routes

API key routes
RouteResult
GET /api-keysapi_key.list: apiKeys[] (metadata only) and catalog (actions, presets, defaultTtl, maxTtl)
POST /api-keys/scoped201 api_key.created: apiKey, secret (once), apiKeys[]. Body: name, ttl, and at least one of preset, actions, sandboxIds, environmentIds. Unknown fields and empty lists are rejected.
DELETE /api-keys/{apiKeyId}200 api_key.deleted: the remaining apiKeys[]
POST /api-keys/{apiKeyId}/rotateA new secret with the same scope and expiry; the old one stops working
GET /api-keys/{apiKeyId}/usageapi_key.usage: requests over the last 30 days and resources created by the key

Shell

curl -sS -X POST "$KABIN_API_URL/api/v1/api-keys/scoped" \
  -H "Authorization: Bearer $KABIN_API_KEY" -H "Content-Type: application/json" \
  -d '{"name":"ci-runner","preset":"ci","ttl":"30d"}'
  • A key can revoke or rotate itself, or a key it could have created (same or fewer actions, sandboxes and environments, no later expiry). Otherwise 403 api_key_action_forbidden.
  • Revoking works immediately for HTTP calls. Streaming command connections opened with the key end within 15 seconds. SSH keys already added to sandboxes stay.
  • A scoped key sees an empty apiKeys list; only unrestricted keys see the inventory.

Key management on the public API is rolled out together with the dashboard key page. If /api-keys answers 404 for you, it is not enabled on your account yet.