Developer API
Authenticated REST API for managing sites, categories, and consent events.
All /api/v1/* endpoints require an API key via the x-api-key header. API keys are managed in the dashboard and use the ck_ prefix.
Sites
List Sites
GET /api/v1/sitesReturns all sites belonging to the authenticated user:
{ "sites": [ { "id": "...", "name": "...", "domain": "...", "status": "active", "publicToken": "ct_...", "config": {} } ] }Create Site
POST /api/v1/sites{
"name": "My Website",
"domain": "example.com",
"config": {}
}Automatically seeds three default categories: Necessary, Analytics, Marketing.
Returns the created site:
{ "site": { "id": "...", "name": "My Website", "domain": "example.com", "status": "active", "publicToken": "ct_...", "config": {} } }publicToken is the opaque token used by the widget's token-mode snippet (data-token) and the /api/gateway endpoints.
Get Site
GET /api/v1/sites/:siteIdReturns site details and consent categories:
{
"site": { "id": "...", "name": "...", "domain": "...", "status": "active", "config": {} },
"categories": [...]
}Update Site
PATCH /api/v1/sites/:siteId{
"name": "Updated Name",
"domain": "new-domain.com",
"config": {},
"status": "active"
}All fields are optional. At least one must be provided.
Delete Site (Soft)
DELETE /api/v1/sites/:siteIdSets site status to deleted.
Categories
List Categories
GET /api/v1/sites/:siteId/categoriesReturns categories ordered by sortOrder.
Create Category
POST /api/v1/sites/:siteId/categories{
"key": "preferences",
"nameEn": "Preferences",
"descriptionEn": "Remember your settings and preferences.",
"isRequired": false,
"isDefault": true
}Key must match pattern /^[a-z0-9_]{1,50}$/ and be unique within the site.
Update Category
PATCH /api/v1/sites/:siteId/categories/:categoryId{
"nameEn": "Updated Name",
"descriptionEn": "Updated description.",
"isDefault": false
}Delete Category
DELETE /api/v1/sites/:siteId/categories/:categoryIdFails if the category is marked as required.
Reorder Categories
PUT /api/v1/sites/:siteId/categories/reorder{
"order": [
{ "id": "cat-1", "sortOrder": 0 },
{ "id": "cat-2", "sortOrder": 1 },
{ "id": "cat-3", "sortOrder": 2 }
]
}Consent Events
List Consent Events
GET /api/v1/consent/events/:siteId?limit=50&offset=0Pro plan only - free-plan keys get 403 with code UPGRADE_REQUIRED.
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 50 | Results per page |
offset | number | 0 | Pagination offset |
Record Consent Event
POST /api/v1/consent/eventsSame body as the widget events endpoint, but requires API key auth and site ownership verification.
Export Consent Events (CSV)
GET /api/v1/consent/events/:siteId/export?period=30dReturns a CSV attachment of consent events rather than JSON. Pro plan only —
free-plan keys get 403.
| Parameter | Type | Default | Description |
|---|---|---|---|
period | string | 30d | Look-back window, <n>d format (e.g. 7d, 90d). Capped at 90 days, or at the site's retention window when one is configured. |
Columns: consentId, action, source (gpc for signal-derived decisions,
empty for banner interactions), categories, policyVersion, visitorHash,
ipHash, country, userAgent, consentedAt.
Responds with Content-Type: text/csv; charset=utf-8 and a
Content-Disposition: attachment filename of
consent-logs-<siteId>-<YYYY-MM-DD>.csv.
Consent Config
Get Site Config
GET /api/v1/consent/config/:siteIdThe authenticated equivalent of the widget config
endpoint. Same
response body, but resolved via API key and site ownership instead of an
Origin check, so it works from a server or a script with no browser origin.