Idempotency
Retry safely after a timeout or dropped connection without creating duplicates.
Idempotency keys
The two operations that create leads, Create a lead and Submit a lead, require an Idempotency-Key header. Generate one key per logical request and store it with your job before the first attempt.
- Same key, same body: LMS returns the original result with the original status code and does nothing else.
- Same key, different body:
409 IDEMPOTENCY_CONFLICT. Create a new key for a new request. - Keys do not expire. LMS stores each key with the lead or delivery it created, so a retry hours or days later still returns the original result.
Keys are 8–128 letters, digits, dots, underscores, colons or hyphens; Create a lead needs a UUID. Keys are scoped to your credential and the target (workspace or source), so two integrations never collide.
Retrying safely
Retry a create after a timeout, a dropped connection or a 5xx, always with the saved key. SOURCE_ID is the Partner API source the key may submit to: copy it from the source in Lead intake → Sources, or read sourceIds from Describe the current credential.
BASE="$LMS_API/v1/integrations"# 1. Save the key with the job before the first attempt; reuse it.[ -f job-48213.key ] || uuidgen > job-48213.keysubmit() { curl --silent --max-time 30 \ -o response.json -w "%{http_code}" \ -X POST "$BASE/sources/$SOURCE_ID/leads" \ -H "Authorization: Bearer $LMS_API_KEY" \ -H "Idempotency-Key: $(cat job-48213.key)" \ -H "Content-Type: application/json" \ -d '{ "externalRecordId": "crm-48213", "fields": { "name": "Asha Verma", "phone": "+919812345678" } }'}# 2. Retry only a timeout (000) or a 5xx, with the same saved key.for attempt in 1 2 3; do status="$(submit)" case "$status" in 000 | 5??) sleep $((2 ** attempt)) ;; *) break ;; esacdoneecho "LMS answered $status"; cat response.jsonThe same pattern works for Create a lead, whose key must be a UUID: Quickstart → Create a lead saves one per lead and retries with it.
Operations that take a key
| Operation | Endpoint | Key | Opens |
|---|---|---|---|
| Submit a lead | POST/v1/integrations/sources/{sourceId}/leads | Required | |
| Create a lead | POST/v1/tenants/{tenantSlug}/lms/leads | Required, a UUID |
- Submit a leadPOST
/v1/integrations/sources/{sourceId}/leads - Create a leadPOST
/v1/tenants/{tenantSlug}/lms/leads
Concurrent changes
Updates to an existing record use optimistic concurrency instead of keys. Send the record's current updatedAt as expectedUpdatedAt (or its revision as expectedRevision, as the operation states). If someone changed it after you read it, the request fails with 409 and nothing is saved: read the record again, re-apply your change and retry. This keeps an integration from silently overwriting what an agent just typed.