Authentication
All requests require a Bearer token:Retries without duplicates
Add theIdempotency-Key header to POST /v1/leads 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/leads
Creates or updates one or more leads. If the email already exists, it is updated (upsert): thedata keys you send are added or overwritten and the rest of the attributes (including _tags) are kept.
If an email is repeated in a bulk request, it is deduplicated and the last occurrence wins.
- cURL
- Node.js
201 Created
created: true = new lead. created: false = existing lead updated.
If a segment_id does not exist, the leads are still created and the response includes a warnings field (array of strings) with the segments that were not found.
GET /v1/leads
Lists leads with pagination, ordered by creation date descending.- cURL
- Node.js
200 OK
GET /v1/leads/:id
Get a lead by ID (UUID), including its segments.- cURL
- Node.js
200 OK
shopify_customer_id is the customer’s ID in Shopify if the lead comes from the Shopify sync; null otherwise.
PUT /v1/leads/:id
Updates a lead. At least one ofemail, data, or segment_ids is required.
*At least one of the three is required. For partial attribute merging, see Attributes.
- cURL
- Node.js
200 OK
email already exists on another lead in the project, it responds 409.
DELETE /v1/leads/:id
Deletes a lead and its segment memberships.- cURL
- Node.js
200 OK
Segments
POST /v1/leads/:id/segments
Adds a lead to one or more segments.- cURL
200 OK
404 and adds none.
DELETE /v1/leads/:id/segments/:segmentId
Removes a lead from a segment.- cURL
200 OK
404.
Tags
Tags are text labels. They are stored as an array under the reserved key_tags within the lead’s attributes (data). The :email in the path must be URL-encoded (for example, jane%40acme.com).
POST /v1/leads/:email/tags
Adds tags to a lead; they are merged with the existing ones, without duplicates.- cURL
- Node.js
200 OK
DELETE /v1/leads/:email/tags
Removes tags from a lead.- cURL
- Node.js
200 OK
GET /v1/leads/:email/tags
Lists a lead’s tags.- cURL
- Node.js
200 OK
Attributes
Custom attributes in the lead’sdata field. They are merged (shallow) with the existing ones; the reserved key _tags is preserved. The :email in the path must be URL-encoded.
POST /v1/leads/:email/attributes
Sets custom attributes on a lead. The body is a flat JSON object.- cURL
- Node.js
200 OK
GET /v1/leads/:email/attributes
Returns the lead’s attributes, excluding the reserved key_tags.
- cURL
- Node.js
200 OK
Errors
Error format:
500 errors may include a details field with the error detail.
See the Node.js SDK guide.