Start here

Authentication

Five kinds of credential, one rule: each resolves to a single workspace and a set of permissions. Which one to use, how to get it, and what it can see.

Last updated

CredentialUse it whenGet itSees
API key (starts with kmk_)Your servers call Kommio.Settings, API keys, or POST /account/api-keys.The whole workspace, within the key's permissions.
App token (kap_)An app installed by an administrator calls back.Returned once when the app is installed.The whole workspace, within the approved scopes.
Bot token (kbt_)A bot that holds an inbox replies or hands off.Returned once when the bot is created.Only conversations it currently holds, only through /api/bot/*.
Visitor tokenThe chat widget, on behalf of one visitor.Issued by POST /api/widget/{key}/session.Their own conversations, through /api/widget/* and the socket.
Session cookiePeople in the browser.POST /api/auth/login; the agent app handles it.Their role's scope.

Creating and using an API key

# as an administrator (session cookie or a key with api_keys:manage)
curl -X POST "$KOMMIO_URL/account/api-keys" \
  -H "Authorization: Bearer $ADMIN_KEY" -H "Content-Type: application/json" \
  -d '{"name": "CRM sync", "permissions": ["conversations:read", "conversations:reply", "contacts:read", "contacts:write"], "expires_at": "2027-09-22T00:00:00Z"}'

# then, from the integration
curl "$KOMMIO_URL/auth/me" -H "Authorization: Bearer kmk_3f9aK2Lp8sQw1vN0zR4tY6uB2cD9eF"
Response 201 Created
{ "id": 4, "name": "CRM sync", "prefix": "kmk_3f9aK2Lp", "permissions": ["conversations:read", "conversations:reply", "contacts:read", "contacts:write"], "expires_at": "2027-09-22T00:00:00Z", "created_at": "2026-09-22T09:12:00Z", "key": "kmk_3f9aK2Lp8sQw1vN0zR4tY6uB2cD9eF" }

What every credential has in common

  • Send it as Authorization: Bearer <credential> (cookies for sessions).
  • Missing or invalid credentials answer 401; a valid credential lacking a permission answers 403 with the permission named in detail.
  • Rate limits apply per key, per workspace and per IP; see errors and limits.
  • Every write is recorded in the audit trail with the credential that made it.

Two-factor and SSO for people

Password sign-in asks for a second factor when the person turned it on (/auth/mfa/*), and OpenID Connect providers that an administrator adds under Settings, Single sign-on sign people in without a password. People can list their sessions and sign them out (/auth/sessions). Details are in the security model. None of this applies to keys, apps or bots, which is why they carry narrow permissions and can be revoked in one call.

Every claim on these pages is covered by a test in the repository, and the API reference is generated from the same contract every server serves at /api/openapi. Corrections to [email protected].