The Tracking API uses the same storefront access token as the rest of the Layers Storefront API. The token identifies which store the events belong to and which pipelines should receive them.Documentation Index
Fetch the complete documentation index at: https://docs.uselayers.com/llms.txt
Use this file to discover all available pages before exploring further.
Token sources
The worker accepts the token from either of these locations, in this order:X-Storefront-Access-Tokenheadertokenquery string parameter
401 Unauthenticated.
Header (preferred)
Use the header form whenever you control request headers — typically server-to-server calls, or browserfetch calls where you don’t need sendBeacon.
Query parameter (for navigator.sendBeacon)
navigator.sendBeacon does not let you set custom headers. Pass the token in the query string instead:
Errors
| Status | Body | Meaning |
|---|---|---|
401 | { "error": "Unauthenticated" } | Token missing or not recognized for any store. |
422 | { "errors": [ "..." ] } | Request body failed top-level validation (e.g., events is missing, empty, or longer than 100). |
422. Invalid events inside a valid batch are skipped silently so the rest of the batch still ingests.
CORS
The endpoint reflects the requestOrigin header and allows credentials, so it works from any browser origin you’ve authorized via your storefront token’s allowed domains.