Authentication
Retries without duplicates
Add theIdempotency-Key header to POST /v1/events` and `POST /v1/events/bulk when you sync from your system. If the request fails on the network and you retry with the same key, you get the original response and nothing is written twice.
- Use one unique key per operation, up to 100 characters (for example, the order id or a uuid). You can also send it in the body as
idempotency_key. - The key lasts 24 hours per project. A retry returns the original response with the
Idempotency-Replayed: trueheader. - Same key with a different body:
409withcode: "IDEMPOTENCY_CONFLICT". Use a new key for a new operation. 5xxresponses are not stored: retrying with the same key processes the request again.
Rate limit
Each API key can make up to 600 requests per minute to each write endpoint. Over that, you get429 with the Retry-After header (seconds until you can continue):
Idempotency-Key. To sync a lot of data, use bulk: up to 1,000 items per request.
Every response includes RateLimit-Limit (the cap), RateLimit-Remaining (what you have left this minute) and RateLimit-Reset (seconds until the next minute). If RateLimit-Remaining reaches 0, wait RateLimit-Reset before continuing and you will never see the 429.
Endpoints
POST /v1/events
Track an individual event. Body parameters:
Request:
- cURL
- Node.js
201 Created
created_lead: true = the email did not exist and a new lead was created automatically.
Errors:
Learn more in Leads.
POST /v1/events/bulk
Track up to 1,000 events in a single request. Each event triggers the automations waiting for that event, just likePOST /v1/events: the contact enters once per event received.
Body parameters:
Request:
- cURL
- Node.js
201 Created
total: number of events recorded.created_leads: number of new leads created automatically (unique emails that did not exist).
GET /v1/events
Lists events with filters. Ordered bytimestamp descending (most recent first).
Query parameters:
Request:
- cURL
- Node.js
200 OK
Recording sales (stores without Shopify)
For a purchase to add revenue to your campaigns and automations, send it as soon as it is paid:
The sale is attributed like a Shopify order: to the last campaign and the last automation that person opened or clicked within your project’s attribution window. If there is none, it stays in Sales as unattributed.
If your project has Shopify connected, these events do not add revenue: orders already come from Shopify.
sk_test_ keys do not add revenue either. Refunds are not deducted through this path yet.
Errors
Error format:{ "error": "message" }. Codes common to all endpoints: