Idempotency-Key request header: send the same key on a retry and, when the operation’s successful response is JSON under 100KB, the API runs it at most once.
How it works
Attach anIdempotency-Key header to any POST request:
POST carrying the same key within the retention window doesn’t re-execute — it gets the recorded status and JSON body back, with an extra header marking it as a replay:
- Only
POSTrequests are affected. The header is ignored onGET/PATCH/PUT/DELETE. - Without the header, nothing changes — POSTs behave as before (at-least-once under retries).
- Idempotency runs after authentication and rate limiting: a replay never bypasses either check, and a rate-limited retry still counts against your request budget.
Key rules
Replay semantics
The concurrent-conflict body looks like:
409 like a short-lived 429: back off for a second or two, then retry with the same key. Once the first request finishes you’ll get its replayed response.
What’s stored, and for how long
- Retention is 24 hours. After that a key expires and the same key would execute a fresh request. Retry loops operate on the scale of seconds to minutes, so this is ample — don’t rely on keys for long-term dedupe.
- Only JSON bodies up to 100KB are stored. A response that is larger or isn’t JSON is not stored at all: the key is released, and a retry with the same key re-executes the handler. In practice every v2 write response is JSON and well under the cap.
- Only successful
2xxoutcomes are cached.4xxand5xxoutcomes discard the stored key so later attempts can be evaluated again. - Idempotency is best-effort by design: if the idempotency store itself is briefly unavailable, your request still executes (without replay protection) rather than failing.
Using the TypeScript SDK
Every write method on@classet/api-client accepts a trailing options object with idempotencyKey. Supplying it sends the header, and on a POST it also unlocks automatic retries — the SDK never retries a write it cannot prove is safe. Because server-side idempotency covers POST only, a key on PATCH/PUT/DELETE is still sent but does not enable retries:
Repeats without a key
force_create skips the duplicate check, so a client that sets it on every create and re-posts after an error would make a new candidate, and start a new interview, on every retry. Two rules stop that whether or not you send an Idempotency-Key. Both look back 12 hours on the same job.
- A repeated create returns the existing candidate. If the API created a candidate for the same person in the last 12 hours,
POST /v2/candidateswithforce_create: truereturns that candidate with200anddata.replayed: true, in place of201. No candidate is created.- “The same person” means the same phone, email and name. Two people who share a phone are two candidates.
data.interview_statusis the candidate’s interview status:not_sent,in_progressorcompleted.data.call_idis the call the candidate already has.- If your request asks for outreach and that candidate was never contacted (the first create had no send flags, or its send failed), the outreach is started on the existing candidate and
interview_statusisin_progress. You are never told “replayed” for a send that did not happen. POST /v2/callsworks the same way for a phone number and name, with or withoutforce_create.
- One outreach per destination per job. A request that would text or call a phone number, or email an address, that was contacted in the last 12 hours through another candidate record returns
409withcode: "recently_contacted". Nothing is created or sent.Retry-Afteranddata.retry_atsay when a send is accepted again. To add the record without contacting them, create it without send flags.
force_create creates a new candidate again, as documented. A candidate created by an ATS sync or a careers-page application is never returned as a replay: force_create on top of one still creates.
Two requests for the same person on the same job sent at the same moment are handled one at a time: the second gets 409 with code: "request_in_progress" and Retry-After: 2, and on retry it sees what the first one did. This is best-effort (if the lock store is unreachable the requests run unprotected), so an Idempotency-Key is still the guarantee. The Idempotency-Replayed header is set only for a key-based replay, not by these rules.
When to use it
- Always on interview-sending POSTs (
POST /v2/candidateswith send flags,POST /v2/candidates/:id/interview) — a double-send reaches a real person and burns an invite slot. - On any POST issued from a job queue, webhook handler, or cron that might redeliver.
- Whenever you retry a
5xxon a write — see Error handling.
Quick rules
- One fresh key (UUID) per logical operation; same key on every retry of it.
- Keys are org-unique and endpoint-bound — reuse on a different endpoint gets a
422. 409 conflictwhoseerrorsaysalready in progress= original still running; wait and resend the same key. Any other409is not a key conflict. Matching the text is a stopgap until the in-flight case gets its owncode.- Replays carry
Idempotency-Replayed: true;5xxoutcomes never replay. - Keys expire after 24 hours — they’re for retry windows, not permanent dedupe.