← Help center

Server-side events API

POST /api/v1/events with Authorization: Bearer <key> and a JSON body: one event, or {"events": [...]} with up to 100.

{
  "site_id": "st_…",               // required
  "type": "conversion",            // or "identify"
  "name": "purchase",
  "value": "49.90",                // major units, as string or number
  "currency": "USD",
  "idempotency_key": "order-1001", // required for conversions; repeats are ignored
  "occurred_at": "2026-01-15T12:00:00Z", // optional, up to 90 days back
  "anonymous_id": "…",             // from sourcetrail('id') in the browser
  "user_id": "123",                // optional, hashed
  "email": "a@example.com"         // optional, hashed (SHA-256); or "email_sha256"
}

Provide at least one of anonymous_id, user_id or email. An identify event links a visitor id to a user so later conversions sent with only the user id or email still find the visits. The response lists each event as accepted, duplicate or rejected with a reason.

To pass the visitor id to your backend, read it in the browser with sourcetrail('id') (e.g. into a hidden checkout field).