Send events
Reference
Send events
POST a batch of storefront events to the Layers Tracking API. Up to 100 events per request, validated individually, dispatched to your configured pipelines.
POST
Send events
POST /beacon is the single ingestion endpoint for the Tracking API. It accepts a batch of up to 100 events per request and routes each event to the store pipelines configured to receive that event type.
Authorization
The token can be passed as a header or as a?token= query parameter — see Authentication for the full discussion.
Your Layers storefront access token. Required if
?token= is not used.Same token, passed via query string. Use this form when calling from
navigator.sendBeacon, which can’t set custom headers.Headers
Optional. If the value contains
tapcart or fuego (case-insensitive), the request is tagged as shopping_channel: "app". Otherwise the channel is inferred from User-Agent and defaults to "web".Body
Array of 1–100 event objects. Each event is validated independently against the schema for its
event_type. Events that fail validation are dropped without failing the batch.See Event types for the per-event schema and the Payload examples page for full request bodies.Behavior
- Returns
201 Createdwith a JSONnullbody on success. - Returns
401if no valid token is provided. - Returns
422with a{ errors: [...] }body if the top-level request shape is wrong (missingevents, empty array, more than 100 entries). - Per-event validation errors do not fail the batch. Invalid events are silently dropped. Valid events continue to dispatch.
- Each accepted event is enriched server-side with:
geo_country,geo_state,geo_city(from Cloudflare edge geo).device_type,browser,os(parsed fromUser-Agent).shopping_channel(weborapp, inferred unless the event already specifies it).
- Events are routed to your store’s configured pipelines based on
event_type. Routing is fire-and-forget — pipeline delivery failures are logged but do not affect the HTTP response.
Limits
| Limit | Value |
|---|---|
| Max events per request | 100 |
| Min events per request | 1 |
| Recommended max request body | 64 KB (the sendBeacon browser limit) |
Request
Example request
Responses
Next steps
- Event types — the schema for every supported
event_type. - Payload examples — copy-pasteable bodies for the most common scenarios.
- Sending events with
navigator.sendBeacon— the recommended browser pattern.