Authentication

API keys

Every request uses a bearer token:

Authorization: Bearer amb_live_...

A key belongs to one workspace and carries a fixed set of scopes. The dashboard shows the token once; the API stores only a hash.

curl "$AMB_API/v1/me" \
  -H "Authorization: Bearer $AMB_KEY"

GET /v1/me returns the workspace, subject, scopes, and expiry. Call it before a long-running integration to confirm the key is the one you expect.

Scopes

Scopes narrow what a key can do. A key without a scope receives 403 permission_denied, not 401; the credential is valid, the action is not.

Create keys with only the scopes the integration needs:

Scope family Grants
inbox:read, inbox:write list and manage inboxes
message:read, message:write read messages, send and reply
thread:read read threads and history
domain:read, domain:write manage and verify domains
webhook:read, webhook:write manage endpoints and replay deliveries
channel:read, channel:write connect and revoke channels

The exact list is in the API reference and in the contract’s security schemes.

Key management

Method Path
GET /v1/api-keys
POST /v1/api-keys
DELETE /v1/api-keys/{id}

Revoke a key when a device or integration goes away. Revocation is immediate; requests already in flight may still complete.

MCP

The MCP server uses OAuth 2.1 with PKCE. The access token is audience-bound to the MCP endpoint and expires quickly, so a leaked token has a short life and cannot be replayed against the HTTP API.

Agent clients discover the authorization server from the MCP endpoint metadata, complete the browser consent, and store the resulting token. The same workspace scopes apply.

Errors

Status Code Meaning
401 authentication_failed missing, malformed, or expired credential
403 permission_denied valid credential without the required scope
429 rate_limited too many requests for the current window

See Errors for the envelope and the full code list.