Skip to main content
CrispStats authenticates REST API requests with a secret API key that starts with cs_sk_. Send it in the Authorization header as a bearer token on every request. The same key works for the MCP server, and a key with the Events, Write or Admin scope also sends server-side events to the collector.

Create a key

1

Open the API keys settings

In the dashboard, open the workspace page (Workspace in the account menu, or Team and API keys below a site’s settings tabs) and find API keys. Only owners and admins of the workspace can create, revoke or delete keys; other members see a note to ask one of them.
2

Name the key and pick scopes

Select Create key, give it a name that says what uses it (for example Production backend), and keep the Read scope. The REST API and the MCP server accept a key that has Read or Admin.
3

Choose which sites it can read

Under Access, choose Every site in your workspace, or Only the current site. A key always belongs to one workspace.
4

Copy the key

The full key is shown once, right after you create it. CrispStats keeps only a hash, so it cannot show it again. Store it in a secret manager or an environment variable such as CRISPSTATS_API_KEY. If you lose it, revoke it and create a new one.
Keep secret keys on a server. The API allows requests from any origin, so a key in browser code works for anyone who reads your page source, until you revoke it.

Scopes

A key carries one or more scopes. Only Read and Admin matter to the REST API and the MCP server. A valid key without Read or Admin gets 403 forbidden on every API request. The raw events endpoint needs Admin: a key with only Read gets 403 forbidden there.

Send the key

Use the exact form Authorization: Bearer <key>. The scheme name is case-insensitive.
A header that is present but wrong is always an error. CrispStats never falls back to anonymous access when a key is malformed, revoked or expired, even on the demo site.

Which sites a key can read

GET /sites lists exactly the sites the key can read: all sites of the workspace (up to 200, oldest first), or the single site of a site-restricted key. Without a key it lists only demo.

Requests without a key

Without an Authorization header you can read the public demo site only:
  • GET /sites returns the demo site.
  • GET /sites/demo/… works on every endpoint.
  • Any other site returns 401 unauthorized with the message “Without a key only the demo site (demo) can be read.”
Anonymous requests have a lower rate limit: 500 a day and 10 every 10 seconds.

Authentication errors

A 401 response carries WWW-Authenticate: Bearer realm="api". All errors use the error envelope.

Revoke or delete a key

Under API keys on the workspace page, select Revoke to stop a key at once while keeping it in the list as a record, or Delete to stop it and remove it from the list. Requests with a revoked or deleted key return 401 unauthorized. The list shows each key’s prefix, scopes, which sites it covers, and when it was created and last used.

Next steps

Manage API keys

Create, review and revoke keys in the dashboard.

Rate limits

How many requests each key can make per day and per 10 seconds, and the ceiling all keys of a workspace share.

Errors

Every error code and how to handle it.
Last modified on November 25, 2026