POST https://ingest.datalyr.com/track accepts one event from your server. Use it when
no Datalyr SDK fits your language or runtime.
/v1 API. This endpoint writes. It reads nothing back.
Before you start
You must have the write key from Settings → API. It starts withdk_, and it
selects the workspace on its own.
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 withproperties..
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 inproperties, 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
Sendevent_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 theUser-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
A200 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
- Run the
curlexample above with your own write key. - Confirm the response reads
"success": true. - Open Events in Datalyr.
- Confirm a
purchaserow arrives within 30 seconds.
When it doesn’t work
Next
- Node.js SDK: the same contract, with retries handled for you.
- Errors and limits: the
/v1limits alongside these. - Agent access: what an agent can read once events land.