Skip to main content
Every API request authenticates as one of two principals. This page covers both modes, the scope model, and the key lifecycle.

Two principals

ai-cmo.dev has two mutually exclusive authentication modes.

API key format

A production key starts with gp_live_ followed by exactly 43 base64url characters:
The format is validated by the server. Keys that do not match the pattern are rejected with 401 invalid_key.

Scope matrix

Health and OpenAPI discovery are public (no auth required).

Session-only actions

These can never be performed with an API key:
  • Create a workspace
  • Create, deliver, rotate, confirm-rotation, acknowledge, or revoke API keys
  • Write or reveal stored connector credentials
  • Add mock top-up credit
  • Backfill AgentMail inboxes
  • Invite, change, or remove team members

Full scope list

API keys carry one or more of these scopes:
If no scopes are specified at creation, the key defaults to ["workspace:read"].

API key lifecycle

Creating a key

Use the dashboard (Workspace → API Keys) or POST /api/v1/workspaces/{workspace}/api-keys with a session cookie.
The response contains the secret. The server stores only an HMAC-SHA256 hash of it, so it cannot be recovered from storage — but while the delivery is still pending you can retrieve it again with resume-delivery (see below). Once the delivery is acknowledged or its 10-minute window expires, the plaintext is gone for good. Response:

Delivery window

The secret is available for 10 minutes via encrypted delivery. After that, delivery expires and you must create a new key. Use the acknowledge or resume-delivery actions on POST /api/v1/workspaces/{workspace}/api-keys/{keyId} to manage delivery.

Acknowledge

Acknowledging marks the key as active and clears the encrypted delivery ciphertext.

Rotating a key

A new key secret is returned as a pending replacement. The old key keeps working and only enters grace — a 15-minute window before it is revoked — once that replacement’s delivery is acknowledged. Call confirm-rotation on the new key to revoke the old one immediately.

Confirm rotation

This revokes the old key immediately. The replacement must be acknowledged first.

Revoke

CIDR restrictions

Keys can be restricted by client IP at creation time. Requests from outside the allowedCidrs range are rejected with 403 ip_forbidden.

Workspace binding

An API key is bound to exactly one workspace at creation. Using a path segment that differs from the bound workspace returns 404 workspace_not_found.

Device authorization

For agents and CLIs, ai-cmo.dev supports device authorization as an alternative to API keys. The ai-cmo-mcp package uses this flow: it opens a browser for login, and credentials are cached at ~/.ai-cmo/credentials.json (mode 0600). The flow uses POST /api/v1/device-authorizations (public), then polling at GET /api/v1/device-authorizations/{code} (session), and POST /api/v1/device-authorizations/{code}/token (public), which returns a real workspace-bound apiKey — not a short-lived token. Clients such as the MCP server persist it as their credential, so it is a way to provision an API key without copy-paste, not an alternative to API keys.

Anti-enumeration

Invalid, absent, unauthorized, and cross-workspace workspace identifiers all return 404 workspace_not_found. Do not use 404 responses to infer whether a workspace or resource exists.

Idempotency conventions