Skip to main content
When a CrispStats API request fails, the response has a 4xx or 5xx status and a JSON body with one shape on every endpoint. Branch on error.code, which never changes; show or log error.message, which names the cause and the fix. Validation errors add a fields object that maps each bad parameter to its problem.

The error envelope

object
required

Error codes

Handle each error

400 invalid_request

The request will fail the same way until you change it. Read fields to find the parameter. Common causes:When several parameter values are invalid, message names them all, for example 2 parameters are not valid: range, limit., and fields has one entry for each. When several parameters are unknown, message names the first and fields lists every one. Do not retry a 400 unchanged.
The response also carries WWW-Authenticate: Bearer realm="api". Check that the header reads Authorization: Bearer cs_sk_… and that the key has not been revoked. A malformed or revoked key is refused even on the demo site; CrispStats never falls back to anonymous access. Create a new key under Settings, API keys if needed. See authentication.
The API does not answer for one of two reasons. The workspace is in its trial and has reached the trial’s 25,000 events for the calendar month (UTC), so it is paused: access returns when an owner picks a plan, or at 00:00 UTC on the first day of the next month. Or the workspace has no paid plan because its trial ended or its plan was cancelled or left unpaid, so it is locked: access returns when an owner picks a plan. Nothing recorded before is lost, unless a locked workspace’s sites reached their deletion 30 days after the lock. See when the trial reaches its event limit and when the trial or a plan ends.
The key is valid but cannot do this. Either it has neither the Read nor the Admin scope, or it was created for one site and you asked for another. Use a key with Read that covers the site.
The message says what was not found: “That site was not found, or this key does not have access to it.” The same answer covers a site that does not exist and a site of another workspace. A funnel id from another site, an unknown visitor id and a path under /api/v1 that is not an endpoint also return 404. List what exists with GET /sites and GET /sites/{siteId}/funnels.
The API only reads. POST, PUT, PATCH and DELETE on /api/v1/sites, every endpoint under it and any unknown path under /api/v1 return this code with Allow: GET, OPTIONS. To send events, use the collector.
Wait the number of seconds in the Retry-After header, then retry. The message says whether you hit the burst limit or used up the daily allowance, which resets at midnight UTC. See rate limits.
The message is usually “Something went wrong on our side. Try again in a moment.” and never includes internal details. Retry with exponential backoff, for example after 1, 2 and 4 seconds. If it keeps failing, contact support with the time and the request path.

Retry rules

The MCP server reports the same codes differently: a failed tool call returns this envelope as the tool result with isError: true, and failures before a message is handled are JSON-RPC errors.

Next steps

Query parameters

Valid values for every parameter that can cause a 400.

Authentication

Fix 401 and 403 responses.

Rate limits

Avoid and handle 429 responses.
Last modified on November 27, 2026