Record a consent choice
const url = 'https://stitch-collector-dev.magic-blocks.workers.dev/v1/consent';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"consent":{"advertising":false}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://stitch-collector-dev.magic-blocks.workers.dev/v1/consent \ --header 'Content-Type: application/json' \ --data '{ "consent": { "advertising": false } }'What a “Do Not Sell or Share My Personal Information” link posts to, and what a CMP calls when someone changes their mind; the SDK’s stitch.consent({...}) calls it. Stitch is not the banner. A post is a deliberate act and replaces the record, which is what lets a preference centre opt someone back in; a Global Privacy Control refusal keeps its credit. Sets the _bid cookie like /v1/collect; cross-origin calls are allowed only from registered domains.
Request Body required
Section titled “Request Body required ”object
Two flags. analytics refused: the visit is counted, no touchpoint is created, no credit is earned. advertising refused: nothing about the person goes to an ad platform.
object
Example
{ "consent": { "advertising": false }}Responses
Section titled “ Responses ”What was recorded.
object
gpc when the browser’s Global Privacy Control did the refusing; a later post cannot overwrite that credit.
Example
{ "analytics": true, "advertising": false, "source": "request"}Malformed JSON or a payload missing what the endpoint needs. The body says which.
object
What was wrong, in a sentence. A 401 carries unauthorized and nothing more.
Example generated
{ "error": "example"}Only the method shown is served.