Skip to main content
Manage your project’s leads (contacts) via API: CRUD, segments, tags, and attributes.

Authentication

All requests require a Bearer token:
Learn more in Public API v1.

Retries without duplicates

Add the Idempotency-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: true header.
  • Same key with a different body: 409 with code: "IDEMPOTENCY_CONFLICT". Use a new key for a new operation.
  • 5xx responses 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 get 429 with the Retry-After header (seconds until you can continue):
Wait those seconds and retry with the same 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): the data 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.
Response 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.
Response 200 OK

GET /v1/leads/:id

Get a lead by ID (UUID), including its segments.
Response 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 of email, data, or segment_ids is required. *At least one of the three is required. For partial attribute merging, see Attributes.
Response 200 OK
Errors: if the new email already exists on another lead in the project, it responds 409.

DELETE /v1/leads/:id

Deletes a lead and its segment memberships.
Response 200 OK

Segments

POST /v1/leads/:id/segments

Adds a lead to one or more segments.
Response 200 OK
Errors: if any segment does not exist in the project, it responds 404 and adds none.

DELETE /v1/leads/:id/segments/:segmentId

Removes a lead from a segment.
Response 200 OK
Errors: if the lead does not belong to the segment, it responds 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.
Response 200 OK

DELETE /v1/leads/:email/tags

Removes tags from a lead.
Response 200 OK

GET /v1/leads/:email/tags

Lists a lead’s tags.
Response 200 OK

Attributes

Custom attributes in the lead’s data 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.
Response 200 OK

GET /v1/leads/:email/attributes

Returns the lead’s attributes, excluding the reserved key _tags.
Response 200 OK

Errors

Error format:
500 errors may include a details field with the error detail. See the Node.js SDK guide.