API Keys

Create Api Key

Create a personal access token (`ro_pat_...`) for this workspace. It acts as you, capped by your current role and by its scopes; send it as `Authorization: Bearer <key>` (no `X-Workspace-Id` needed). The key is in the response only once. Granting `admin` needs the admin role; at most `API_KEY_MAX_PER_WORKSPACE` (default 50) active keys per workspace.

API key access

Not available to API keys or connected apps: only a signed-in person can call this route.
POST/api/v1/workspaces/current/api-keys
AuthorizationBearer <token>

Access token from /api/v1/auth/login, or an API key (ro_pat_..., RO-176) from /api/v1/workspaces/current/api-keys: the key implies its workspace and needs the route's scope. MCP connectors (/api/v1/mcp only) may use an OAuth access token (ro_oat_..., RO-284).

In: header

Header Parameters

X-Workspace-Id?string | null

Id of the workspace to act on (must be a member).

namestring
Length1 <= length <= 100
scopesarray<string>

Scopes to grant, e.g. leads:read, sequences:* (<resource>:* = read and write). admin needs the admin role.

Items1 <= items <= 40
expires_in_days?integer | null

Days until the key expires; null or absent: never.

Formatint64
Range1 <= value <= 3650

Response Body

curl -X POST "http://localhost:8000/api/v1/workspaces/current/api-keys" \  -H "X-Workspace-Id: string" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "scopes": [      "string"    ]  }'
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "name": "string",
  "key_prefix": "string",
  "scopes": [
    "string"
  ],
  "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  "user_email": "string",
  "active": true,
  "created_at": "2019-08-24T14:15:22Z",
  "expires_at": "2019-08-24T14:15:22Z",
  "last_used_at": "2019-08-24T14:15:22Z",
  "revoked_at": "2019-08-24T14:15:22Z",
  "key": "ro_pat_Ab3dEfGhIjKlMnOpQrStUvWxYz0123456789abcdefg"
}
Empty
Empty
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}