Workspaces and API keys

Every resource in the API — channels, contacts, messages, campaigns — lives inside a workspace. A workspace is the primary isolation boundary: data from one workspace is never visible to another. API keys are workspace-scoped. A key can only access resources belonging to the workspace it was created in. Organisation-wide keys — one key for several workspaces — are coming soon; until then, use one key per workspace (see Manage multiple brands and agents). The dashboard lets you switch between workspaces; each workspace has its own set of API keys.

Scheme

All /v1 routes expect:

What the server derives

From a valid key the gateway resolves:
  • Workspace for tenancy and policy (and, through it, the organisation whose balance a send draws on).
  • Rate limit bucket for the key.
  • Permissions of the key — see Permissions.
The organisation’s money — billing:read and billing:write — is a special case: only an owner or admin of the organisation can put these permissions on a key, and they work only while that person still is one (see Billing — who can call what). usage:read gives a key its workspace’s own usage and costs.

Permissions

A key can call a route only when it carries the permission the route needs. Without it the answer is 403 forbidden whose message names the missing permission, for example This API key lacks the `messages:send` permission. (DELETE /v1/contacts/{id} answers “Manager role required to delete contacts.”). Permissions are chosen when the key is created and cannot be changed afterwards: create a new key instead. GET /v1/openapi.json needs no key. In the API reference every route also names its permission (x-scope in the OpenAPI document).

Ready-made sets in the dashboard

The Create key dialog offers three sets. Each one works for its first call; the individual permissions stay available under Individual permissions. Add events:write for a shop that reports orders, webhooks:manage for an integration that registers its own webhook endpoint.

Roles and keys

Keys carry permissions, not roles. Roles decide what a person can do in the dashboard — including who may create keys: Billing permissions (billing:read, billing:write) additionally need the key’s creator to be an owner or admin of the organisation at the moment of each request. A key with campaigns:write can trigger a campaign no matter who built it — with one exception: if the content was last changed by someone with the role Build drafts and that version isn’t approved, POST /v1/campaigns/{id}/trigger answers 409 approval_required. The approval belongs to the content version: any later change needs a new one.

Best practices

  • Storage — Keep keys in a secrets manager or environment variables; never commit them or expose them in browsers.
  • End date — A key can get an optional Valid until date when it is created (at most three years out). It works through the end of that day (UTC); after that every request answers 401 key_expired with expired_at. Without a date the key works until it is revoked. The date can’t be changed later — create a new key instead.
  • Rotation — A workspace can have several active keys. To rotate without downtime: create the new key, deploy it, then revoke the old one in Settings → API & webhooks. A revoked key fails immediately with 401 unauthorized.
  • Overview — Settings → API & webhooks lists every key with its first characters, when it was created and by whom, when it was last used (updated at most once a minute) and its end date. Keys are managed there only; there is no API to create or list keys.
  • Environments — Prefer separate keys for staging and production to limit blast radius.

Errors

401 / 403 — response fields

string
Machine-readable error code. See Errors for the full list.
string
Human-readable detail safe to log (avoid echoing secrets).
See Errors. For product-level auth concepts, see Authentication guide.