Search documentation

On this page

API

Authenticated endpoints require the API key as a Bearer token: Authorization: Bearer <api-key>. The X-Api-Key header is accepted as an alternative. The OpenAPI reference is available on the admin port (ADMIN_PORT).

Generate tokens ​

POST /api/tokens/generate creates consent records and returns one signed token per item.

bash
curl -X POST http://localhost:5000/api/tokens/generate \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '[{
    "bucket": "q1-campaign",
    "email": "user@example.com",
    "name": "Jane Doe",
    "permissions": { "newsletter": true, "marketing": false }
  }]'

Response: [{"token":"<signed_token>","doubleOptIn":false}].

Optional fields:

Field Purpose
customFields Key-value pairs stored with the record, e.g. externalId
allowReplay If false: the token link is single-use
expiryDays Token validity in days. Defaults to TOKEN_EXPIRY_DAYS (30)
language Preference page language: en (default), de, fr, nl, pl, es, it, pt, ja
skipPermissionUpdate If true: existing permissions are not overwritten

GET /u/{token} opens the preference page. Newsletters and notifications include the link:

txt
https://beacon.example.com/u/v1.eyJiIjoicTEtY2FtcGFpZ24iLCJlIjoia...

POST /api/consent/check returns the consent status of one permission. Call the endpoint before a send.

bash
curl -X POST http://localhost:5000/api/consent/check \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"bucket": "q1-campaign", "email": "user@example.com", "permission": "newsletter"}'

POST /api/consent/override sets the consent status of one permission.

bash
curl -X POST http://localhost:5000/api/consent/override \
  -H "Authorization: Bearer your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"bucket": "q1-campaign", "email": "user@example.com", "permission": "newsletter", "status": "OptedIn"}'

Delete a bucket ​

DELETE /api/admin/buckets/{bucket} deletes a bucket.

bash
curl -X DELETE http://localhost:5000/api/admin/buckets/q1-campaign \
  -H "Authorization: Bearer your-api-key"
Last updated: 2026-11-13