Skip to main content
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.
string
Your Layers storefront access token. Required if ?token= is not used.
string
Same token, passed via query string. Use this form when calling from navigator.sendBeacon, which can’t set custom headers.

Headers

string
default:"application/json"
required
string
default:"application/json"
required
string
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
required
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 Created with a JSON null body on success.
  • Returns 401 if no valid token is provided.
  • Returns 422 with a { errors: [...] } body if the top-level request shape is wrong (missing events, 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 from User-Agent).
    • shopping_channel (web or app, 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

For higher throughput, batch events on the client (e.g., flush every 2 seconds or every 20 events) and send multiple requests rather than one giant one.

Request

Example request

Responses

Next steps