A token for a cross-domain link
GET
/v1/decorate
const url = 'https://stitch-collector-dev.magic-blocks.workers.dev/v1/decorate?to=example';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://stitch-collector-dev.magic-blocks.workers.dev/v1/decorate?to=example'Mints a signed, short-lived token from the _bid cookie so a link from one of our domains to another carries the visitor across. The SDK calls it when decorating a link; the anonymous id itself never reaches page JavaScript.
Parameters
Section titled “ Parameters ”Query Parameters
Section titled “Query Parameters ” to
required
string
The destination host. Must be one of our registered domains.
Responses
Section titled “ Responses ”The token to append to the link.
Media type application/json
object
token
required
string
Example generated
{ "token": "example"}No _bid cookie: nothing to carry.
to is missing or not one of our domains.
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"}