Authentication and API keys

Bonga has two credential families. Dashboard users sign in with a session; integrations use scoped API keys. Agent keys are a third, deliberately narrow credential.

PrincipalCredentialUsed for
Person in the dashboardJWT session or Authorization: Bearer <jwt>Dashboard pages and /api/* dashboard routes
IntegrationAuthorization: Bearer <api key>/api/v1/* and /api/v2/*
AI agentAuthorization: Bearer bonga_agent_…/api/v1/agent/* and /api/mcp

Never send a dashboard JWT to an integration route, and never put any credential in a browser bundle, query string or mobile app.

Bonga documentation authentication page showing API keys, scopes and workspace selection

Create an API key

Open Dashboard → API keys, name the key, and select only the scopes the integration needs. The secret is shown once. Store it in your secret manager; Bonga keeps only a hash and a short hint.

Choose scopes by capability:

ScopeGrants
messages:readSender and connection discovery, message and scheduled-message status
messages:sendMessage submission and managed SMS scheduling
email:limits:readEmail plan sending limits
links:readList workspace short links
links:writeCreate, renew and disable short links
sms:readLegacy managed SMS logs, batches, campaign reports and catalog
sms:sendLegacy managed SMS send and quote
sms:cancelCancel an undispatched managed SMS

Scopes are exact. A v2 scope does not grant any v1 route, and a v1 scope does not grant a v2 route. Some scope groups appear only when their rollout flag is enabled.

Optional request limits

A key can carry a requests-per-minute limit and, for v2 messaging, an optional daily accepted-recipient quota. Both are recorded with the key and enforced before work starts. When either limit is reached the API returns 429 with Retry-After; the daily quota does not reset when a scheduled message is cancelled.

Use the key

curl 'https://api.bonga.africa/api/v2/senders?channel=email' \
  -H "Authorization: Bearer $BONGA_API_KEY"

Every successful response uses the envelope:

{
  "success": true,
  "message": "Senders discovered",
  "data": { "senders": [], "connections": [] }
}

Unwrap data. Do not parse message; it is human-facing and may change.

Workspace selection

A dashboard user can belong to more than one workspace. Any human route that depends on workspace data accepts the selector:

X-Workspace-ID: workspace:abc123

Send it as a header, not a query parameter. When both a header and a query selector are accepted, they must agree. The selector must name a workspace the authenticated actor can access; it never grants access by itself. API keys are already bound to one workspace and cannot switch workspaces.

Agent keys

An agent key is created for one agent in Dashboard → Agents, is scoped to that agent's inbox and sending policy, and cannot approve, manage members or keys, or read another inbox. It is not an API key with extra powers; it is a separate credential family with a separate route prefix. See AI agents.

Sessions and MFA

Dashboard sessions are HTTP-only cookies with a monotonic token version. Changing a password, resetting credentials or an administrative suspension invalidates existing sessions. The dashboard also supports login OTP; a suspended account is refused before any workspace data is read.

Rotation and revocation

  • Rotate an API key from the dashboard; the old key stops working immediately.
  • Revoke agent keys individually; deleting an agent revokes every key it holds and cancels its pending approvals.
  • Keys can expire. An expired, revoked or unknown credential always returns 401 and never falls back to a weaker authentication path.

Next