Skip to main content
POST https://ingest.datalyr.com/track accepts one event from your server. Use it when no Datalyr SDK fits your language or runtime.
Ingest is a different host and a different credential from the /v1 API. This endpoint writes. It reads nothing back.

Before you start

You must have the write key from Settings → API. It starts with dk_, and it selects the workspace on its own.
Keep the write key on your server. Anyone holding it can write events into your workspace. Never ship it in a browser bundle or a mobile binary.

Request

Headers

Send X-API-Key or Authorization, not both. X-API-Key wins when both arrive. The workspace comes from the key. Do not put a workspace ID in the body, because /track ignores it.

Body fields

Every field below sits at the top level of the JSON object, except where the name starts with properties.. Two rules catch most integrations. A timestamp before 2020-01-01 falls back to receipt time, and a timestamp in the future is clamped to now. Attribution belongs inside properties, so a top-level utm_source is dropped.

Attribution properties

These go in properties, and each one lands in its own column. clickIdType accepts fbclid, gclid, ttclid, gbraid, wbraid, msclkid, li_fat_id, epik, twclid, dclid, sclid, oppref, rdt_cid, obclid, irclid, irclickid, and ko_click_id. Datalyr drops any other type.

Example

Batching

/track takes one event per request. There is no batch array on this endpoint, so {"events": [ ... ]} posted here returns 400. The Web SDK batches on its own transport, which carries the public workspace ID rather than a write key. Use the Web SDK for browser traffic, and one /track request per event from a server.

Duplicates

Send event_id on every request, and a retry cannot double-count.
Branch on the success field, not on the status code. A duplicate is a 200.

Source detection

Datalyr reads the User-Agent header to record which transport the event arrived on. Geo columns and device fingerprints are recorded for mobile_app events. An api event carries the ip you send, and no geo.

Responses

A 200 with "success": true means Datalyr accepted the event and queued it.

Limits

CORS

/track answers OPTIONS with 204 and Access-Control-Allow-Origin: *. It allows Content-Type, X-API-Key, and Authorization. It sets no Access-Control-Allow-Credentials, so a browser request with credentials: 'include' fails. This endpoint is built for server calls.

Verify

  1. Run the curl example above with your own write key.
  2. Confirm the response reads "success": true.
  3. Open Events in Datalyr.
  4. Confirm a purchase row arrives within 30 seconds.

When it doesn’t work

Next