Persists a consent record asynchronously. Ledger is append-only: records can never be edited or deleted.
This API does not support CORS. So writes from the browser are send-and-forget, use navigator.sendBeacon or fetch with the mode: "no-cors" option.
To change a user's consent, post a new ConsentState for the same metadata.user to this API.
This is a non-local record of consent. Consent will always need to be stored for decisions related to behavior of the application or website.
The "categories" field is deduplicated, meaning that sending "categories": ["analytics", "necessary", "analytics"] will be persisted as "categories": ["analytics", "necessary"] when it is read back.
Support for custom surface metadata and custom non-surface metadata are supported under the fields .metadata.custom and .surface.metadata.custom, these fields must be objects but can contain any information.
All unknown fields will be stripped before being persisted.
Path parameters
Name | Type | Notes |
| UUID string | Your ledger UUID. Must name an existing ledger. Repeated in the body as |
Authentication: none. A public write endpoint by design (browser beacon / agent use); no Authorization header is needed.
Request body - a ConsentState. Pre-stringified JSON. The server ignores Content-Type - from a browser send text/plain so the request needs no CORS preflight, but the charset part of Content-Type is honored, defaults to utf-8.
Responses
Status | Body | Meaning |
|
| Durably queued. |
|
| The body is invalid, including when its |
|
| No ledger with this |
|
| Body size is > 64KiB. (This is the same limit as |
|
| Declared charset is unknown |
|
| Other client errors (see "Errors"). |
Example (with minimal metadata)
POST https://ledger.enzuzo.com/consent/v1/5ae66dc4-2a1a-4c84-b559-c7959100bb24/state
{
"ledgerId": "5ae66dc4-2a1a-4c84-b559-c7959100bb24",
"surface": {
"kind": "web"
},
"categories": ["necessary", "analytics"],
"action": "accept"
}Example (with maximal metadata)
POST https://ledger.enzuzo.com/consent/v1/5ae66dc4-2a1a-4c84-b559-c7959100bb24/state
{
"ledgerId": "5ae66dc4-2a1a-4c84-b559-c7959100bb24",
"surface": {
"kind": "web",
"metadata": {
"scroll": { "x": 0, "y": 420 },
"screen": {
"actual": { "height": 1080, "width": 1920 },
"available": { "height": 1040, "width": 1920 },
"colorDepth": 24, "pixelDepth": 24,
"orientation": { "type": "landscape-primary", "angle": 0 },
"isFullscreen": false
},
"globalPrivacyControl": false,
"location": "https://www.example.com/pricing",
"referrer": "https://www.google.com/",
"languages": ["en-CA", "en"],
"platform": "MacIntel",
"textDirection": "ltr",
"visibilityState": "visible",
"characterSet": "UTF-8",
"contentType": "text/html",
"title": "Pricing - Example",
"custom": { "some-custom-field": 10 }
}
},
"categories": ["necessary", "analytics"],
"action": "accept",
"metadata": {
"user": "u_7f3a9c",
"settings": "3b9c1f…",
"consentSignal": { "kind": "tcf", "value": "CQ…" },
"custom": { "some-custom-field": 10 }
}
}Example (response):
HTTP/1.1 202 Accepted
{
"apiVersion": "v1",
"kind": "RecordConsentStateResponse",
"metadata": {
"ledgerId": "5ae66dc4-2a1a-4c84-b559-c7959100bb24",
"recordedAt": "2026-10-20T17:22:05Z",
"id": "353fabdf-d4fc-4c7d-9e00-ff0c54879f2e"
}
}For an AI-agent surface send something like "surface": { "kind": "ai-chat", "metadata": { ... } } with whatever context/metadata that is relevant. Currently web is the only known surface. Unknown surface kinds are accepted with free-form metadata.
