Skip to documentation content
CookieBeam

Banners

List your team's consent banners and create new ones with the CookieBeam REST API, using an API key or a dashboard session.

Last updated:

The banners endpoints list your team's banners and create new ones. Both also accept a dashboard session instead of an API key — that is how the CookieBeam dashboard calls them — but integrations should use a key.

To read and change a banner's themes and design settings, use the banner design endpoints under /api/v1/banners/{bannerId}/design/....

List banners

GET /api/v1/banners

Requires the banners:read scope. Test keys work. Returns every banner on the key's team (only the allowed banners for a banner-restricted key). The list is not paginated.

curl https://cookiebeam.com/api/v1/banners \
 -H "Authorization: Bearer $COOKIEBEAM_API_KEY"
{
 "data": {
 "banners": [
 {
 "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
 "name": "Main site",
 "domain": "https://example.com",
 "isActive": true,
 "configuration": {
 "layout": "banner",
 "position": "bottom",
 "primaryColor": "#000000",
 "secondaryColor": "#ffffff",
 "textColor": "#333333",
 "accentColor": "#007bff"
 },
 "compliance": {
 "gdpr": true,
 "ccpa": false,
 "lgpd": false
 },
 "createdAt": "2026年08月01日T12:00:00.000Z",
 "updatedAt": "2026年08月01日T12:00:00.000Z"
 }
 ]
 },
 "version": "v1"
}
FieldTypeNotes
idstring (UUID)The banner's internal ID. Use it for the banner design endpoints and for POST /api/v1/consent/log
namestring
domainstringThe banner's primary domain as an https:// URL
isActiveboolean
configurationobjectBasic appearance fields stored on the banner record. Detailed design settings live in the banner's themes; read them with the banner design endpoints
complianceobjectWhich legal-framework flags are switched on: gdpr, ccpa, lgpd
createdAt, updatedAtstring (ISO 8601)

The public Banner ID that appears in the loader script URL is a different value. The cross-device consent and form consent endpoints take the public ID; each page says which one it needs.

Create a banner

POST /api/v1/banners

Requires the banners:write scope and a live key (test keys are read-only), on a key that is not restricted to specific banners. Accepts an Idempotency-Key. The body:

FieldTypeRequiredNotes
namestringyes1–255 characters
domainstringyesThe site's address: a bare hostname or a pasted URL. The banner stores https://<host>, lower case, without a path, query or port, and with an international domain in its xn-- form. It must be a public domain (a name under a public suffix, such as example.com or shop.example.co.uk) or a public IP address. Email addresses, user names before an @, ports other than the default, schemes other than http and https, localhost, private and link-local IP addresses and local-only names such as .local or .internal are refused with 400 invalid_request. Add local or intranet hosts as extra domains in the dashboard
configurationobjectyesStored on the banner record and returned as sent. These fields don't change the published banner: its look comes from the default theme the banner is created with. Change that theme with the banner design endpoints. Every field inside has a default
configuration.layoutstringnobanner (default), modal, or inline
configuration.positionstringnotop, bottom (default), or center
configuration.primaryColorstringnoDefault #000000
configuration.secondaryColorstringnoDefault #ffffff
configuration.textColorstringnoDefault #333333
configuration.accentColorstringnoDefault #007bff
gdprEnabledbooleannoDefault true
ccpaEnabledbooleannoDefault false
lgpdEnabledbooleannoDefault false
curl -X POST https://cookiebeam.com/api/v1/banners \
 -H "Authorization: Bearer $COOKIEBEAM_API_KEY" \
 -H "Content-Type: application/json" \
 -H "Idempotency-Key: $(uuidgen)" \
 -d '{
 "name": "Main site",
 "domain": "example.com",
 "configuration": { "layout": "banner", "position": "bottom" },
 "gdprEnabled": true
 }'

A successful create returns HTTP 201 with the new banner in the same shape as the list above:

{
 "data": {
 "banner": {
 "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
 "name": "Main site",
 "domain": "https://example.com",
 "isActive": true,
 "configuration": {
 "layout": "banner",
 "position": "bottom",
 "primaryColor": "#000000",
 "secondaryColor": "#ffffff",
 "textColor": "#333333",
 "accentColor": "#007bff"
 },
 "compliance": { "gdpr": true, "ccpa": false, "lgpd": false },
 "createdAt": "2026年08月13日T12:00:00.000Z",
 "updatedAt": "2026年08月13日T12:00:00.000Z"
 }
 },
 "version": "v1"
}

Creation also registers the domain for consent collection and prepares the banner's production environment, in the same transaction, so a banner created through the API is ready for the same publish and install flow as one created in the dashboard. A team that has reached its plan's banner limit gets HTTP 403 plan_required.

Errors

HTTP statusCodeCause
400invalid_requestValidation failed. details lists each invalid field
401unauthorized, invalid_key, revoked_key, expired_keyNo API key and no dashboard session, or an invalid key
403plan_requiredThe plan does not include API access, or the banner limit is reached (create)
403missing_scope, test_key_read_only, key_restrictedSee Authentication
405method_not_allowedThe endpoint does not support the HTTP method used
409, 422idempotency_in_progress, idempotency_key_reusedSee Safe retries
429rate_limitedSee Rate limits

A validation failure looks like this:

{
 "data": {
 "error": "Validation failed",
 "code": "invalid_request",
 "details": [
 { "message": "That looks like an email address. Enter your website address." }
 ],
 "requestId": "9b2e5f0c-8d7a-4e0b-9c1d-2f3a4b5c6d7e"
 },
 "version": "v1"
}

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