Authentication

Create, store, rotate, and revoke the API keys that authenticate every request.

Every request to the moderation API is authenticated with a secret API key that belongs to your workspace.

Send the key

Send the key in the X-Api-Key header on every request:

POST /v1/moderations HTTP/1.1
Host: your-clusterbot-host
X-Api-Key: <your API key>
Content-Type: application/json

Send exactly one X-Api-Key header. Requests without a valid key receive 401 Unauthorized with a Problem Details body. Signing in to the portal does not grant API access: browser cookies are ignored by the API.

Key format

Keys start with cb_ followed by 64 lowercase hexadecimal characters (67 characters in total). The first 11 characters (cb_ and the next eight) are the display prefix shown in the portal so you can tell keys apart.

Clusterbot stores only a one-way hash of each key. Nobody — including Clusterbot administrators — can recover a lost secret. If you lose a key, revoke it and create a new one.

Create keys

Open Portal → API keys and select Create key:

  • Name — describe where the key is used, such as chat-service-production.
  • Expires — optional. After this time, the key stops working automatically.

Copy the secret when it is shown. It is displayed once.

Use a separate key per application and environment. All of a workspace's keys share the same credit allowance and rate limit, so separate keys help you trace usage and rotate safely, but don't add capacity.

Rotate and revoke keys

To rotate a key without downtime:

  1. Create a new key.
  2. Deploy it to your application's secret store.
  3. Confirm traffic uses the new key. Last used in Portal → API keys shows when each key last authenticated a request.
  4. Revoke the old key.

Revoking takes effect immediately. Requests with a revoked or expired key receive 401.

Access states

Situation Response
Missing, malformed, unknown, expired, or revoked key 401 — A valid API key is required.
Workspace suspended 401, or 403 with code customer_unavailable if the suspension happens mid-request
Valid key The request continues to validation, rate limiting, and credit checks

Security checklist

  • Store keys in environment variables or a secret manager, never in source control.
  • Call Clusterbot only from your servers. If browsers or mobile apps need moderation, route the request through your backend.
  • Never put keys in URLs, query strings, or logs. Redact the X-Api-Key header in HTTP client logging and error reports.
  • Turn on secret scanning in your repositories. The fixed cb_ prefix and length make leaked keys easy to detect.
  • Give each environment its own key and revoke keys you no longer use.
  • Rotate a key immediately if you suspect it has been exposed.
  • To try requests in the interactive reference, use a dedicated test key and revoke it when you're done. The reference doesn't save the key, but anything typed into a browser is more exposed than your server's secret store.

Webhook signing secrets for review callbacks are separate from API keys. Keep both independent.

Questions about this guide? Contact us or try requests in the playground.