Skip to documentation content
CookieBeam

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, currently v1.

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

MethodPathScopePage
GET/api/v1/bannersbanners:readBanners
POST/api/v1/bannersbanners:writeBanners
various/api/v1/banners/{bannerId}/design/... (37 operations)banners.design:read, banners.design:write, banners:adminBanner design
POST/api/v1/consent/logconsent:writeConsent
POST/api/v1/consent/subjects/resolveconsent:readConsent
PUT, DELETE/api/v1/consent/subjects/stateconsent:writeConsent
POST, GET/api/v1/consent/formsconsent:forms:write, consent:forms:readForm consent
GET/api/v1/consent/forms/{id}consent:forms:readForm consent
GET/api/v1/consent/forms/exportconsent:forms:exportForm consent
POST/api/v1/consent/forms/searchconsent:forms:readForm consent
POST/api/v1/consent/forms/subjects/stateconsent:forms:readForm consent
DELETE/api/v1/consent/forms/subjectsconsent:forms:eraseForm consent
GET, PUT/api/v1/preferences/topicspreferences:read, preferences:writeMarketing preferences
POST, PUT, DELETE/api/v1/preferences/subjects/statepreferences:read, preferences:write, preferences:eraseMarketing preferences
POST/api/v1/preferences/linkspreferences:writeMarketing preferences
GET/api/v1/mobile/confignoneMobile config
GET/api/v1/healthnoneHealth check
GET/api/v1/openapi.jsonnoneOpenAPI document
POST/api/mcpper toolMCP 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.

  • limit sets the page size, from 1 to 200. The default is 50.
  • The response carries items and nextCursor. Pass nextCursor as cursor to get the next page; it is null on 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-Match applies the write and returns the new ETag.
  • If-Match: * overwrites whatever is stored.
  • A missing If-Match returns HTTP 428 precondition_required.
  • A stale If-Match returns HTTP 409 conflict with details.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/banners
  • POST /api/v1/consent/log
  • PUT /api/v1/consent/subjects/state
  • POST /api/v1/consent/forms
  • PUT /api/v1/preferences/topics
  • PUT /api/v1/preferences/subjects/state
  • every POST operation 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 422 idempotency_key_reused.
  • If the first request is still running, a retry waits up to 5 seconds, then returns 409 idempotency_in_progress with Retry-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.CookieBeam runtime 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.

AltStyle によって変換されたページ (->オリジナル) /