Skip to content

Record a consent choice

POST
/v1/consent
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.

Media type application/json
object
consent

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
analytics
boolean
advertising
boolean
Example
{
"consent": {
"advertising": false
}
}

What was recorded.

Media type application/json
object
analytics
required
boolean
advertising
required
boolean
source
required

gpc when the browser’s Global Privacy Control did the refusing; a later post cannot overwrite that credit.

string
Allowed values: request gpc default
Example
{
"analytics": true,
"advertising": false,
"source": "request"
}

Malformed JSON or a payload missing what the endpoint needs. The body says which.

Media type application/json
object
error
required

What was wrong, in a sentence. A 401 carries unauthorized and nothing more.

string
Example generated
{
"error": "example"
}

Only the method shown is served.