Errors and rate limits
Error codes, HTTP statuses, request ids, rate-limit tiers, body limits and retry guidance for the CookieBeam REST API.
Last updated:
Error envelope
Errors use the same envelope as successful responses. The data object carries a human-readable error message, a machine-readable code, an optional details value, and the requestId of the call:
{
"data": {
"error": "API key is missing required scope(s): banners:write",
"code": "missing_scope",
"requestId": "9b2e5f0c-8d7a-4e0b-9c1d-2f3a4b5c6d7e"
},
"version": "v1"
}
Match on code; the wording of error may change. Some endpoints add their own fields next to code: a consent state conflict returns current, a form consent quota refusal returns resetAt, and an unsupported version returns supportedVersions.
Validation errors
A request that fails validation returns HTTP 400 invalid_request. On most endpoints details.issues lists each problem with the path of the field:
{
"data": {
"error": "Invalid request data",
"code": "invalid_request",
"details": {
"issues": [
{ "path": "subject.value", "message": "Invalid input: expected string, received undefined", "code": "invalid_type" }
]
},
"requestId": "9b2e5f0c-8d7a-4e0b-9c1d-2f3a4b5c6d7e"
},
"version": "v1"
}
A few older endpoints keep the shape their first clients parse: POST /api/v1/consent/log returns details as an array of { "field", "message" }, and POST /api/v1/banners returns the list of validation issues itself as details, each with a message and usually a path. On the banner design endpoints, paths start with params. or body. to say where the field was. Path and query parameters elsewhere are prefixed with params. or query..
Request ids
Every /api/v1 response carries an X-Request-Id header, and every error repeats it as data.requestId. Send your own X-Request-Id (a UUID) to correlate a call with your logs; any other value is ignored and a new id is generated. Quote the id when you contact support.
Machine-readable description
The OpenAPI 3.1 document at /api/v1/openapi.json is generated from the same contracts the endpoints validate against. It lists every operation with its scopes, request and response schemas, and the error codes each status can carry.
Error codes
| HTTP status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | The body, query or path failed validation, the JSON is malformed, or a pagination cursor is invalid |
| 400 | unsupported_version | The requested API version is not supported; supportedVersions lists the ones that are |
| 401 | invalid_key | The API key is malformed, unknown, or has the wrong environment prefix |
| 401 | revoked_key | The API key has been revoked, or its team was deleted |
| 401 | expired_key | The API key has expired |
| 401 | unauthorized | The endpoint requires an API key and none was sent |
| 401 | invalid_token | /api/mcp only: a sign-in (OAuth) access token was sent but is invalid, expired or revoked. The response carries WWW-Authenticate: Bearer with error="invalid_token" and the resource_metadata URL, so the assistant can ask you to sign in again |
| 403 | plan_required | The team's plan does not include the feature, or a plan limit was reached. On banner design endpoints details.feature names the feature |
| 403 | feature_unavailable | The account does not include the capability (for example publishing the cookie policy). Nothing was changed |
| 403 | plan_limit | A limit of the account stops the call and nothing was changed: the scan quota for the period is used up (details.resetsAt says when it resets), the account's billing does not allow the change, the account cannot add another site, or adding the site would change the subscription (MCP create_banner; add the site from the dashboard instead) |
| 403 | missing_scope | The key lacks a required scope; the message names it |
| 403 | test_key_read_only | A test key was used for a write, publish, erase or admin operation |
| 403 | test_key_production_forbidden | A test key was used for a banner design operation that test keys may not run |
| 403 | key_owner_inactive | Banner design endpoints: the member who created the key is no longer an active member of the team |
| 403 | insufficient_permission | The member who created the key (banner design endpoints), or the signed-in user (dashboard sessions), lacks the permission the operation needs. details names the required and held levels |
| 403 | key_restricted | A key restricted to specific banners was used to create a banner, to record a form consent proof without one of its banners, or to erase form consent proofs. Also returned, with details.environment: "production", when a call that changes what runs in production (publishing, deleting a banner, turning it on or off, creating one through MCP, publishing the cookie policy) uses a key whose environment allow-list leaves production out |
| 403 | publishable_key_not_allowed | A publishable cb_pub_ key was sent to an operation that needs a secret key |
| 403 | origin_not_allowed | The request's Origin is not one of the publishable key's allowed origins |
| 403 | two_factor_required | Dashboard sessions only: the team requires two-factor authentication and the session has not completed it |
| 403 | email_verification_required | Dashboard sessions only: the signed-in user has not verified their e-mail address |
| 404 | not_found | The resource does not exist, belongs to another team, is inactive, or is outside the key's banner restriction |
| 405 | method_not_allowed | The path exists but not for this HTTP method |
| 409 | version_conflict | A consent state write carried a stale baseVersion; the response includes current |
| 409 | conflict | The write conflicts with the current state. On a versioned write, details.currentEtag is the version to re-read and retry with. On a publish, details.reason is lock_busy or pointer_changed: this call did not publish, but another publish of the banner may have, so preview again before retrying. Starting a scan while one runs for the banner returns details.scanId |
| 409 | confirmation_stale | The publish confirmation no longer matches the draft, the live version or the account's features, or this publish already went through. Nothing was published; preview again and use the new confirmation |
| 409 | resource_locked | The resource is locked by another feature, for example a theme used by an active A/B test. details says by what |
| 409 | idempotency_in_progress | A request with the same Idempotency-Key is still running; retry after Retry-After seconds |
| 413 | payload_too_large | The request body is larger than the endpoint accepts (see Body limits) |
| 413 | invalid_request | The body exceeded 20,000 bytes on a cross-device consent subject endpoint |
| 422 | idempotency_key_reused | The Idempotency-Key was already used with a different request |
| 428 | precondition_required | A versioned write was sent without If-Match |
| 429 | rate_limited | A rate limit was exhausted; see below |
| 429 | quota_exceeded | The plan's monthly form consent quota is used up; resetAt says when it resets. Nothing was stored |
| 500 | internal_error | Unexpected server error. The message is masked; quote requestId |
| 503 | identity_unavailable | Subject identity hashing is temporarily unavailable; retry later |
| 503 | session_unavailable | Dashboard sessions only: session verification is temporarily unavailable |
| 503 | service_unavailable | A dependency is temporarily unavailable, or a short-lived lock is held (for example another scan for the team is being started). Retry after Retry-After seconds when it is sent |
Rate limits for API keys
API-key requests are limited per key over a fixed 15-minute window. The limit depends on the team's plan:
| Plan | Requests per 15 minutes |
|---|---|
| Free | 50 |
| Starter | 200 |
| Professional | 500 |
| Business | 2,000 |
| Enterprise | 5,000 |
A plan the server cannot map to a tier falls back to the Free limit.
Responses that pass key authentication and reach the rate limiter carry these headers:
X-RateLimit-Limit— the key's limit for the window.X-RateLimit-Remaining— requests left in the current window.X-RateLimit-Reset— when the window resets, as a Unix timestamp in milliseconds.RateLimit— the same state as an IETF structured field:"default";r=<remaining>;t=<seconds until reset>.RateLimit-Policy— the quota and window:"default";q=<limit>;w=<window seconds>.
This includes HTTP 429 rejections. It does not include requests rejected before rate limiting runs — entitlement, scope, and test-key failures (and malformed, revoked, or expired keys) return without these headers — and some server-error paths also skip them. Treat the headers as present on rate-limiter outcomes, not as a universal invariant.
When the limit is exhausted the API returns HTTP 429:
{
"data": {
"error": "Rate limit exceeded",
"code": "rate_limited",
"requestId": "9b2e5f0c-8d7a-4e0b-9c1d-2f3a4b5c6d7e"
},
"version": "v1"
}
The response includes a Retry-After header with the number of seconds to wait before the next request.
Extra limits on banner design operations
The banner design endpoints count against the per-key limit above, and two kinds of operation have a second limit of their own:
- Writes (theme and design changes, logo uploads, preset and proposal applies): 120 per minute per key.
- Operations that fetch from the internet or run a style match (logo import from a URL, site capture, style match and refine): 20 per hour per banner.
- Publishing (publishing a banner, and creating a banner through MCP, which publishes its first version): 10 per 15 minutes per key, counted together.
- Starting a scan: 5 per 15 minutes per key.
Past either limit the call returns HTTP 429 rate_limited with Retry-After and details.retryAfter / details.limit.
Other rate limits
These limits apply independently of the per-key tiers:
- Requests to the banner endpoints that arrive without an API key (dashboard sessions and other browser traffic) are limited to 100 requests per 15 minutes per client IP.
- Publishable keys: 600 requests per minute per key, and 30 requests per minute per key from one client IP.
POST /api/consent/log(the unversioned banner ingestion route) is limited to 1,000 requests per minute per client IP.GET /api/v1/mobile/configis limited per client IP, like the CDN script routes.- Failed authentication attempts are limited to 10 per minute per client IP; beyond that, further attempts return HTTP 429 with
rate_limitedand aRetry-Afterheader.
Changes
November 2026:
- New codes:
plan_limit(403),confirmation_stale(409),feature_unavailable(403) and, on/api/mcp,invalid_token(401). conflict(409) on a publish now carriesdetails.reason(lock_busyorpointer_changed), andkey_restricted(403) is also returned withdetails.environmentfor calls that change what runs in production.- Plan-related refusal messages on the banner endpoints under
/api/v1/banners/{bannerId}/(design, publish, scanning, settings and policy) were reworded so they read well inside an AI assistant: they say what the account doesn't include and point to the dashboard, without naming plans or prices. The codes anddetailsare unchanged; match oncode, not on the message. - Publishing and starting a scan have their own per-key limits (see Extra limits).
Body limits
| Endpoint | Largest body |
|---|---|
| Most endpoints | 64 KB |
POST /api/v1/consent/log | 64,000 characters |
| Cross-device consent subject endpoints | 20,000 bytes (413 invalid_request) |
POST /api/v1/banners/{bannerId}/design/logo/upload | 512 KB |
POST /api/mcp | 4 MiB, at most 4 JSON-RPC messages per batch |
Retry guidance
- On HTTP 429, wait at least the number of seconds in
Retry-Afterbefore retrying. Do not retry in a tight loop — repeated bursts just consume the next window. - On HTTP 5xx, retry with exponential backoff.
- Reads (
GET, and thePOSTlookups that keep identifiers out of URLs) are safe to retry as-is. - For writes, send an
Idempotency-Keywhere the endpoint accepts one, and reuse it on the retry. - For consent state writes, retry a 409
version_conflictby re-reading the subject, merging against the returnedcurrentsnapshot, and writing again with the newversionasbaseVersion. - For banner design writes, retry a 409
conflictby reading the resource again, re-applying your change, and sending the newETagasIf-Match.