Publishing API

Publishing compiles your consent configuration into a production-ready script and deploys it to the CDN.

POST /api/v1/sites/:siteId/publish Publish changes

Triggers a new publish. The configuration is compiled into a JavaScript bundle and deployed to the CDN. Publishing is asynchronous — the response returns immediately with the new version number. The script URL never changes between publishes.

Response

{
"message": "Publishing in progress",
"version": 4,
"scriptUrl": "https://cdn.cookieboss.io/scripts/01HXYZ.../consent.js"
}
GET /api/v1/sites/:siteId/publish/status Check publish status

Returns the current publish state. isPublished indicates whether the latest configuration has been published. When isPublished is false, there are unpublished changes.

Response

{
"scriptVersion": 4,
"lastPublishedAt": "2026-02-15T10:30:00.000Z",
"isPublished": true,
"configVersion": 4,
"scriptUrl": "https://cdn.cookieboss.io/scripts/01HXYZ.../consent.js"
}

Publish workflow

  1. Make changes to your configuration via the API (config, texts, cookies)
  2. Each change marks the config as “unpublished”
  3. Call POST /publish when you’re ready to go live
  4. The compiler Worker builds a new script version
  5. The script is uploaded to R2 and served via the CDN
  6. Visitors automatically get the new version (same URL, cache-busted by version)

Script URL is stable

The script URL https://cdn.cookieboss.io/scripts/{siteId}/consent.js never changes. You only need to add it to your site once. Every publish updates the script content behind the same URL.

Example: full configuration and publish

bash
# 1. Update banner config
curl -X PUT https://api.cookieboss.io/api/v1/sites/$SITE_ID/config \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"bannerLayout":"modal","gcmEnabled":true}'

# 2. Update English text
curl -X PUT https://api.cookieboss.io/api/v1/sites/$SITE_ID/config/texts/en \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"headline":"Cookie Preferences","body":"We use cookies..."}'

# 3. Publish
curl -X POST https://api.cookieboss.io/api/v1/sites/$SITE_ID/publish \
-H "Authorization: Bearer $TOKEN"

# 4. Check status
curl https://api.cookieboss.io/api/v1/sites/$SITE_ID/publish/status \
-H "Authorization: Bearer $TOKEN"