API referenceSections

POST /api/v1/tenants/{tid}/api-keys

Generated from the OpenAPI contract. Sessions send the CSRF header on writes; API keys use a Bearer token. Authentication

POST /api/v1/tenants/{tid}/api-keys

Authentication: session cookie __Host-panel_session (contract default; see Authentication).

Parameters

NameInTypeRequiredDescription
tidpathstringrequired
X-CSRF-Tokenheaderstringoptional

Required on unsafe requests authenticated by session cookie; API keys do not use it.

Request body

required

Content type: application/json

object
  • no other properties
  • name string required
  • permissions array<string> required
  • ttl_hours integer required
    • minimum 1
    • maximum 8760
Example
{
  "name": "string",
  "permissions": [
    "string"
  ],
  "ttl_hours": 1
}

Responses

201 API key and its one-time token

Content type: application/json

  • api_key APIKey required
    • id string required
    • tenant_id string required
    • owner_user_id string required
    • name string required
    • created_at string (date-time) required
    • expires_at string (date-time) required
    • last_used_at string (date-time) | null required
    • mfa_backed boolean required

      The session that made the key had passed two-step verification (ADR 0103).

    • refused_for_mfa boolean required

      The key does not authenticate now because its owner's role requires two-step verification and the key was made without it, or the owner has no factor (API_KEY_MFA_REQUIRED).

  • token string required
Example
{
  "api_key": {
    "id": "string",
    "tenant_id": "string",
    "owner_user_id": "string",
    "name": "string",
    "created_at": "2026-01-01T00:00:00Z",
    "expires_at": "2026-01-01T00:00:00Z",
    "last_used_at": "2026-01-01T00:00:00Z",
    "mfa_backed": true,
    "refused_for_mfa": true
  },
  "token": "string"
}

default Error

Content type: application/json

  • code string required
  • message string required
  • details_redacted boolean required
  • correlation_id string required
  • retryable boolean required