Beta. consent-kit is at 0.x: expect breaking changes between releases, and treat everything it generates as a draft. Report a problem or share feedback.
Consent receipts
A consent receipt is the record a site keeps of one decision a visitor made in the banner. This page explains what is sent, what is stored, and what a stored receipt does and does not prove.
Why receipts exist
Section titled “Why receipts exist”The consent cookie that CookieConsent writes is the working copy of a visitor’s choice. It lives in their browser: the visitor can delete it, and you cannot produce it later.
A controller that relies on consent has to be able to demonstrate that it was given. A receipt is the copy the site keeps for that: one record per decision, naming exactly which policy and which version of each purpose the decision was about.
A registry that asks for consent therefore has to say where receipts go, or say that it keeps none and why. consent-kit refuses to build it otherwise (receipts/not-stated).
receipts: endpoint: /consent-receipts # a site-relative path, or an https URLOne receipt per decision
Section titled “One receipt per decision”sequenceDiagram participant V as Visitor's browser participant E as Receipt endpoint participant D as Storage V->>V: clicks "Accept all" (CookieConsent writes cc_cookie) V->>E: POST receipt (sendBeacon) E->>E: check against the receipt manifest E->>E: replace consentId with HMAC(key, consentId) E->>D: append one row E-->>V: 204
A receipt is sent for the first decision and for every later change, including a withdrawal and a rejection of everything. A “no” is recorded as carefully as a “yes”.
{ "consentId": "6f1c2a5e-8b0d-4d6e-9f3a-2c7b1e0d4a91", "event": "first", "accepted": [{ "purpose": "analytics", "version": 1 }], "rejected": [{ "purpose": "media", "version": 1 }], "policyHash": "83918475460fd5695e91e9f178a4cd8a529ff1c26ee03856c9429305e9d0330d", "revision": 1, "timestamp": "2026-11-28T09:30:00.000Z"}Every consent purpose appears in exactly one of the two lists, with its version. The policy hash is the same one printed at the foot of the generated privacy documents, so a receipt points at the exact text the visitor could read.
Nothing else is in the body: no user agent, no page URL, no other cookie content. The receipt is sent by the generated CookieConsent module; your code does nothing.
What the receiving end does
Section titled “What the receiving end does”@consent-kit/server is the receiving end. It is a Fetch API handler with a storage adapter for Cloudflare D1.
It checks the receipt against the build. consent-kit build writes a receipt manifest: the policy the build sends, and every policy released before it. The handler accepts a receipt only if it matches one of those policies exactly: every consent purpose once, each at that policy’s version. A receipt that names an unknown policy, leaves a purpose out, or mixes one policy’s hash with another’s versions is refused. The server never stores a claim about a policy it cannot produce.
It does not store the consent id. The consentId identifies one browser’s consent. In its place the handler stores HMAC-SHA-256 of it under a secret key. With the key, you can find a visitor’s rows when they present their consent id (for an access or erasure request). Without the key, the stored value cannot be linked back to a browser.
It stores nothing else about the request. No IP address, no user agent, no headers, no URL, no raw body.
It only appends. The storage interface has one method, append. The D1 table has a trigger that refuses every UPDATE.
A site with its own endpoint must do the same two things: hash the consent id before storing it, and keep the IP address out of the record.
Old pages still send receipts
Section titled “Old pages still send receipts”A visitor may have a page open, or served from a cache, that was built before your latest release. A choice made there is a real decision about the policy that page showed.
That is why the manifest lists every released policy, taken from the release history in privacy.lock.json, and why the handler checks each receipt against the versions of its own policy rather than the newest. It is also why the receiving end has to be rebuilt and redeployed with every release: the new manifest is what makes it accept the new policy.
What a receipt proves
Section titled “What a receipt proves”A stored row shows that the endpoint received a well-formed statement that a browser with a certain consent id decided a certain way, on a policy that the site really released, with purposes at the versions that policy really had, at a time recorded by the server’s own clock.
Together with the lock file’s history and the generated documents (which carry the same policy hash), that lets you reconstruct what the visitor was shown and what they chose.
What a receipt does not prove
Section titled “What a receipt does not prove”Be precise about this when you rely on the record.
- It does not prove who sent it. The endpoint is unauthenticated by nature. Anyone can POST a well-formed receipt with a made-up consent id. The
Origincheck stops other sites’ pages from posting from visitors’ browsers; it is not authentication, because a non-browser client can send anyOrigin. - It does not identify a person. A consent id identifies a browser’s consent cookie, not a human. Clearing cookies produces a new one.
- It does not prove the banner was shown correctly. It records the outcome, not the rendering. The audit’s banner checks cover that, on the day they run.
- The timestamp in the body is a claim. It comes from the visitor’s clock. The server stores it as
client_timestampand uses its ownreceived_atas the time of record. A receipt more than a day off is refused by default. - It is not guaranteed to exist for every decision. There are no retries. A receipt lost to a network error is not sent again; the consent cookie in the browser still holds the decision, and the site still honours it.
- No receipt is sent under Global Privacy Control. The visitor made no choice in the banner. See Global Privacy Control.
What is left to you
Section titled “What is left to you”- Rate limiting. The handler has none. Put a rate limiting rule or WAF in front of the route.
- Retention. No sweep is built. The table has an index on
received_atfor one. - Access and erasure requests. No tooling is built. Hash the consent id the visitor presents with the same key and query by
subject_hash. - The key. Keep it as long as the receipts. A lost or rotated key makes the existing rows unreachable by consent id.
Opting out
Section titled “Opting out”A site can declare that it keeps no receipts:
receipts: optOut: reason: Decisions are recorded by the parent site's consent service (PRIV-12).The opt-out is never silent. check and build print it as a warning on every run, the audit report states it before any check, and switching to it after a release needs a person’s confirmation in privacy.review.json. What it costs is in opt out of receipts.