API overview
Base URL, versioning, response envelope, pagination, concurrency, idempotency and the full endpoint list of the CookieBeam REST API.
Last updated:
The CookieBeam REST API lets you manage banners and their designs, record consent, keep proofs of form consent, and manage marketing preferences from your own systems. The hosted service is at https://cookiebeam.com, and endpoints are served under a versioned path:
https://cookiebeam.com/api/v1/
Versioning
The API version lives in the URL path. Current endpoints are mounted at static /api/v1/... paths, and v1 is the only version that exists — there is no unversioned variant of these routes, so /api/banners returns HTTP 404, as does a path for a version that is not deployed, such as /api/v2/banners.
Do not send an api-version header: on the versioned paths it has no effect, because the path alone determines the version.
Within v1 only additive changes are made. A deprecation is announced at least 6 months ahead with Deprecation, Sunset and Link: <...>; rel="deprecation" response headers.
Response envelope
Successful responses wrap the payload in a data field and echo the version:
{
"data": {
"banners": []
},
"version": "v1"
}
The banner design endpoints may add a meta.warnings array next to data, for example when a setting was accepted but your plan does not apply it.
Responses produced by the versioned wrapper also carry two headers:
API-Version— the version that handled the request.API-Supported-Versions— the versions the server supports, currentlyv1.
Do not build monitoring that assumes these headers on every response: error responses built before the versioned wrapper runs (for example an uncaught handler error) do not carry them.
Authentication
Most endpoints authenticate with a secret API key sent as a bearer token:
Authorization: Bearer cb_live_your_key_here
Keys carry an explicit list of scopes and are limited by plan-based rate limits. See Authentication for key formats, scopes, test keys and publishable keys. The banner list and create endpoints also accept a dashboard session, which is how the CookieBeam dashboard itself calls them.
Endpoints
| Method | Path | Scope | Page |
|---|---|---|---|
GET | /api/v1/banners | banners:read | Banners |
POST | /api/v1/banners | banners:write | Banners |
| various | /api/v1/banners/{bannerId}/design/... (37 operations) | banners.design:read, banners.design:write, banners:admin | Banner design |
POST | /api/v1/consent/log | consent:write | Consent |
POST | /api/v1/consent/subjects/resolve | consent:read | Consent |
PUT, DELETE | /api/v1/consent/subjects/state | consent:write | Consent |
POST, GET | /api/v1/consent/forms | consent:forms:write, consent:forms:read | Form consent |
GET | /api/v1/consent/forms/{id} | consent:forms:read | Form consent |
GET | /api/v1/consent/forms/export | consent:forms:export | Form consent |
POST | /api/v1/consent/forms/search | consent:forms:read | Form consent |
POST | /api/v1/consent/forms/subjects/state | consent:forms:read | Form consent |
DELETE | /api/v1/consent/forms/subjects | consent:forms:erase | Form consent |
GET, PUT | /api/v1/preferences/topics | preferences:read, preferences:write | Marketing preferences |
POST, PUT, DELETE | /api/v1/preferences/subjects/state | preferences:read, preferences:write, preferences:erase | Marketing preferences |
POST | /api/v1/preferences/links | preferences:write | Marketing preferences |
GET | /api/v1/mobile/config | none | Mobile config |
GET | /api/v1/health | none | Health check |
GET | /api/v1/openapi.json | none | OpenAPI document |
POST | /api/mcp | per tool | MCP server |
Pagination
List endpoints that can grow without bound use cursor pagination: GET /api/v1/consent/forms, POST /api/v1/consent/forms/search and GET /api/v1/banners/{bannerId}/design/themes.
limitsets the page size, from 1 to 200. The default is 50.- The response carries
itemsandnextCursor. PassnextCursorascursorto get the next page; it isnullon the last page. - Items come newest first. Rows that share a timestamp are neither repeated nor skipped across pages.
- Treat the cursor as opaque; its format may change. A cursor that does not decode returns HTTP 400
invalid_request, never a silent first page.
curl "https://cookiebeam.com/api/v1/consent/forms?limit=100&cursor=WzEsIjIwMjYtMTAtMDFUMTI6MDA6MDAuMDAwWiIsIjNmYTg1ZjY0LTU3MTctNDU2Mi1iM2ZjLTJjOTYzZjY2YWZhNiJd" \
-H "Authorization: Bearer $COOKIEBEAM_API_KEY"
GET /api/v1/banners returns every banner of the team in one response and is not paginated.
Optimistic concurrency with ETag and If-Match
The banner design endpoints version every resource. A read returns an ETag header; a write that replaces or patches the resource must send it back as If-Match:
- A matching
If-Matchapplies the write and returns the newETag. If-Match: *overwrites whatever is stored.- A missing
If-Matchreturns HTTP 428precondition_required. - A stale
If-Matchreturns HTTP 409conflictwithdetails.currentEtag. Read the resource again, re-apply your change and retry.
See Banner design for an example. Cross-device consent state uses its own integer baseVersion instead; see Consent.
Safe retries with Idempotency-Key
These endpoints accept an optional Idempotency-Key header (1–255 printable ASCII characters, for example a UUID you generate per operation):
POST /api/v1/bannersPOST /api/v1/consent/logPUT /api/v1/consent/subjects/statePOST /api/v1/consent/formsPUT /api/v1/preferences/topicsPUT /api/v1/preferences/subjects/state- every
POSToperation under/api/v1/banners/{bannerId}/design/...
Send the same key when you retry after a timeout or network error:
- The first request runs. Its result is stored for 24 hours from that request.
- A retry with the same key and the same request (method, path and JSON body; key order in the body does not matter) does not run again. It returns the stored status and body with the header
Idempotent-Replayed: true. Authentication, scopes and rate limits are checked again on every retry. - The same key with a different request returns
422idempotency_key_reused. - If the first request is still running, a retry waits up to 5 seconds, then returns
409idempotency_in_progresswithRetry-After. - A request that fails with a 5xx error stores nothing, so a retry runs it again.
- A retry after the 24-hour window is treated as a new operation.
Keys are scoped to the API key that sent them. Requests without the header behave exactly as before.
Health check
GET /api/v1/health returns a minimal status payload without authentication:
{
"data": {
"status": "ok"
},
"version": "v1"
}
Use it to confirm reachability before diagnosing authentication or scope problems.
OpenAPI document
GET /api/v1/openapi.json returns the OpenAPI 3.1 description of the public API without authentication. It is generated from the same contracts the endpoints validate against and lists every operation with its scopes, request and response schemas, and the error codes each status can carry. It is cached for an hour.
curl https://cookiebeam.com/api/v1/openapi.json -o cookiebeam-openapi.json
Mobile config
GET /api/v1/mobile/config?bannerId=<public banner id>&env=production&lang=de returns the published banner configuration for native apps, without an API key. It serves only published data, never drafts. The response depends on the caller's region and language, so it is cached privately; revalidate with If-None-Match to get HTTP 304 when nothing changed. The response fields are described in Mobile apps.
In this section
- Authentication — keys, environments, scopes and publishable keys.
- Banners — list and create banners.
- Banner design — themes, layout, colours, typography, logo and site matching.
- Consent — record consent and sync consent state across devices.
- Form consent — proofs of consent from your own forms.
- Marketing preferences — topics, a person's subscriptions, and hosted preference links.
- Browser API — the
window.CookieBeamruntime API, events and data attributes. - Webhooks — event delivery to your endpoints and signature verification.
- MCP server — connect an AI assistant to your account.
- Errors and rate limits — error codes, 429 behavior, and retry guidance.