Idempotency Keys for Identity Verification API Calls, 2026
Use one idempotency key per logical operation, send a stable vendor identifier, retry 429 and 5xx as documented, handle 409 by reading its code and reloading state, and deduplicate webhooks on the event id.

Contents
In this guide
Jump to the part you need.
Idempotency keys matter when your backend calls the Didit API and a retry must not start a second verification or charge. This guide gives the pattern we document: one key per logical operation, a stable vendor_data, retry 429 and 5xx as documented, handle 409 by reading its code and reloading state, and deduplicate webhooks on event_id. A full KYC check lists at $0.33 and the sandbox is free. Caveat: the docs do not publish a key retention window.
Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.
| Risk | What a blind retry does | Documented control |
|---|---|---|
| Second verification session | Starts another hosted flow for a person who may already be verifying, and leaves two sessions to reconcile | Send a stable vendor_data; the create docs state it is used for duplicate detection across sessions |
| Second charge | Each completed check is billed from prepaid credit, so a duplicate that completes bills twice | One key per logical operation, reused on every retry of that operation |
| Retry storm | More 429 responses and longer waits against the same key-scoped counter | Read Retry-After, then back off with jitter and stop after a small ceiling |
| Duplicate webhook | The same status applied twice, so two notifications or two state writes | Deduplicate on the envelope event_id and return 2xx fast |
| Key reused across operations | The API answers 409 and your state is unclear | A new logical operation gets a new key |
Start free in the sandbox at business.didit.me, no sales call. See the User Verification product page for the KYC modules, and read unit prices at didit.me/pricing. Developers who build with an AI assistant can connect Didit through the MCP server.
Two things sit side by side in this guide. The documented behavior is the API contract in our docs: what a status means, which failures are safe to retry, how a 409 is handled, and which fields the create and decision calls return. The design advice is how we recommend wiring your client around that contract, for example generating one key per logical operation and storing it with your own record. Where the docs leave a policy to you, we say so.
What you get from this guide
Two calls define the integration. POST /v3/session/ starts a verification and GET /v3/session/{session_id}/decision/ returns the decision. Everything else is delivery. A retry only becomes dangerous when it can create a second session, a second charge, or a second state change. Idempotency is the property we design for: the same logical operation should not create a second effect, however many times your client retries it. The API contract and your client rules together decide how that is enforced.
By the end you will have:
- one key per logical operation, generated before the first call and stored with your own record of that operation;
- the documented create call, carrying a stable
vendor_datathat binds the session to a user or a business; - a decision about which responses to retry, taken from the error contract instead of guesswork;
- a webhook handler that tolerates the same event arriving twice;
- a reconciliation step for the case where no webhook arrives at all.
We run this API for 4,000+ companies. The mechanics below come from our public documentation, not from a private integration.
Prerequisites
- A Didit application and an API key. Keys live under Developers, then API keys in the Business Console. The primary key has full access to the application; create a separate key for each service that calls the API. New keys start with
sk_live_for a live application orsk_test_for a sandbox application, followed by 43 URL-safe characters. - A sandbox key for testing. Sandbox calls are mocked and the sandbox is free on every plan. The API authentication page also shows the programmatic register and verify-email calls that return both keys inline.
- A workflow UUID.
workflow_idis a stable workflow UUID from/v3/workflows/. KYC workflows create user verification sessions and KYB workflows create business verification sessions. There is no separate KYB endpoint. - Server-side storage for the API key and the operation record. The API key is a secret. Keep it out of browsers, mobile bundles and public repositories. An idempotency key is an operation identifier, not a credential: store it reliably with your record, but do not treat it as a password.
- An HTTP client. The examples use curl and plain
fetch; any client works.
The steps
- Generate one key per logical operation, before the first call. Use a UUID or another strong random string. The same key covers every retry of that operation. A different logical operation, such as the same person starting a fresh verification after leaving, gets a new key. Do not derive the key from the payload: if the payload changes it is a different operation, and it should carry a different key.
- Choose a stable
vendor_data. The create docs call it strongly recommended, because it binds the session to a User or Business entity and is used for duplicate detection across sessions. Use your own user id or business id, not a value that changes on each attempt. Every response and webhook echoes it back. - Create the session with the documented call.
curl -X POST https://verification.didit.me/v3/session/ \ -H "x-api-key: $DIDIT_API_KEY" \ -H "Content-Type: application/json" \ -d '{"workflow_id":"<WORKFLOW_ID>","vendor_data":"user-42","callback":"https://myapp.com/return"}'workflow_idis required.callbackis where the hosted flow sends the user when it finishes, and Didit appends?verificationSessionId={session_id}&status={status}. When the application has allowed domains, an http or https callback must be on one of those origins, otherwise creation fails with 400 oncallback. Custom schemes such as app deep links are always accepted.The public create example in our docs does not show where an
Idempotency-Keyheader goes. The documented duplicate control for session creation is the stablevendor_datavalue, so keep that constant across retries and use the key in your own operation record. - Keep the identifiers you get back.
session_idis returned byPOST /v3/session/and is what the decision endpoint takes.session_urlis the hosted page you send the user to. Store the key, thevendor_dataand thesession_idtogether, so a retry or a support question has one record to read. - Retry only what the error contract allows. Read the status code first and the
codefield when it is present, because message text can change. A 500 may have no JSON body at all, so parse defensively.const raw = await response.text(); let body = {}; try { body = JSON.parse(raw); } catch { // A 5xx response may not be JSON: rely on response.status. } const code = body.code ?? null; const message = body.detail ?? body.error ?? (Array.isArray(body) ? body[0] : raw);Then branch:
429wait forRetry-Afterand try again;500,502and503retry with backoff;409readcodeand reload the state before doing anything else;400,401,402,403,404,410,415and422need a fix or a new resource, not another identical send. - Read the decision, and branch on the session kind.
curl https://verification.didit.me/v3/session/<SESSION_ID>/decision/ \ -H "x-api-key: <API_KEY>"const decision = await (await fetch(url, { headers: { "x-api-key": API_KEY } })).json(); switch (decision.session_kind) { case "user": return handleUserDecision(decision); case "business": return handleBusinessDecision(decision); }Always branch on
session_kind. Feature arrays are always plural arrays, and a feature that did not run is absent or null, never a placeholder. Reading the same decision twice is safe by design, so a lost decision response never forces you to create a new session. - Deduplicate webhook deliveries. Verify
X-Signature-V2over the sorted canonical JSON, check thatX-Timestampis within 300 seconds, and compare in constant time against the header and, when present, its-Previouspair. Then deduplicate on the envelopeevent_id, apply the change once, and return 2xx as fast as you can. If you fall back toX-Signature-Simple, re-fetch the decision fromGET /v3/session/{session_id}/decision/instead of trusting the payload, because that scheme authenticates the envelope only. - Reconcile when no webhook arrives. Delivery is retried a bounded number of times. The decision endpoint is the source of truth, so call it after a session event and whenever your own record shows a session that has not reached a final status. Repeating that read is cheap, and it closes the gap a lost webhook leaves. If a create call timed out before you stored a session id, do not assume a repeated create returns the first response. Reconcile from your operation record and any session id you hold before starting a new logical operation.
Expected output
A good run looks like this. The create call returns a session you can identify, session_id and session_url go into your record next to the key, and the user finishes the hosted flow at session_url. A status.updated webhook arrives with one of the documented statuses: Approved, Declined, In Review, In Progress, Not Started, Expired, Abandoned, Kyc Expired, Resubmitted or Awaiting User. Those strings are exact and case sensitive, and Kyc Expired uses a single capital K.
The decision read returns the full record: session_id, session_kind, status, vendor_data, features, decision_trace, reviews, status_override, linked_records and the feature arrays for the steps your workflow runs. linked_records is where duplicate detection becomes visible, with same_face, earlier_verifications and network summaries, or null when there is nothing to report.

Failure cases and recovery
| Situation | What you see | Recovery |
|---|---|---|
| Timeout before any response | No status code and no session id | Resend with the same key if your operation record says the create is unresolved, but do not assume the API replays the original response. Read any session id you stored and reconcile from your own record before starting a new logical operation. |
| Reused key on a conflicting request | 409, sometimes with a code | Read code, reload the current state and stop creating. Do not send an identical create again until you know the current state. |
| Rate limited | 429 with X-RateLimit-Scope, Retry-After and a reference | Wait at least Retry-After, then back off with jitter (5s, 10s, 20s, 40s plus random). Stop after about five attempts and alert, because sustained 429s usually mean a runaway loop. |
| Balance too low | 402 with insufficient_credits on some APIs, 403 on others, a 400 body on session create | The check did not run, so nothing was billed. Top up, then retry once. |
| Callback rejected | 400 on callback, saying it must be on one of the application's allowed domains | Use an origin on the allowed domains, or a custom scheme deep link. |
| Ambiguous wallet address | 422 with candidate_chains | Resend with blockchain set to one of the candidates. Nothing was screened or billed on the failed call. |
| Session expired | 410, or status Expired on the decision | Create a new session with a new key, because a re-verification is a new logical operation. |
| Duplicate webhook | The same event_id twice | Drop the second delivery once the signature check passes and return 2xx. |
| Bad signature | Signature mismatch, or a timestamp older than 300 seconds | Rebuild the canonical JSON from the raw body, compare in constant time, and accept the -Previous header during a secret rotation. |
Inputs and outputs
The decision read is where every output lands, including the ones that tell you a retry would have been wrong.

| Field | Direction | Required | What it does |
|---|---|---|---|
workflow_id | In | Yes | Stable workflow UUID. It decides whether the session is KYC or KYB. |
vendor_data | In | No, strongly recommended | Your identifier for the person or business. Used for duplicate detection and echoed back. |
callback | In | No | Where the hosted flow sends the user when it finishes, with the session id and status appended. |
callback_method | In | No | initiator (default), completer or both. Use both when the callback sometimes fails to fire. |
metadata | In | No | Arbitrary JSON echoed in responses and webhooks, never shown to the user. |
session_expiration_time | In | No | Seconds the link stays valid, between 3600 and 2419200, overriding the workflow setting for this session only. |
session_id | Out | Returned | The key for the decision read. |
session_url | Out | Returned | The hosted page you send the user to. |
status | Out | Returned | One of the documented statuses. |
session_kind | Out | Returned | user or business. Always branch on it. |
event_id | Out | Returned in webhooks | The deduplication key for webhook delivery. |
Paid steps and review boundaries
Billing is per completed check, from prepaid credit. That is the reason to make the create call idempotent: a duplicate that completes is billed like any other check. The KYC line is documented on the User Verification product page, and the unit prices are on didit.me/pricing. The pricing docs also note that some no-match database lookups and retries are billable, so your retry policy is a cost decision as well as a reliability decision.

| Step | Price (USD) | Unit |
|---|---|---|
| Full ID check (KYC): ID document, passive liveness, face match 1:1, device and IP | $0.33 | check |
| ID verification alone | $0.15 | check |
| Passive liveness | $0.10 | check |
| Face match 1:1 | $0.05 | check |
| Device and IP analysis | $0.03 | check |
| AML screening | $0.20 | check |
| Ongoing AML monitoring | $0.07 | person per year |
| Business verification (KYB) | From $2.00 | company |
| Wallet screening | $0.15 | screening |
Repeat reads are the cheap part. GET /v3/session/{session_id}/decision/ is governed by the generic GET ceiling of 600 requests a minute per key, so reconciling by reading a decision is a normal operation rather than a costly one.
Review is a different boundary. A session in In Review is held by a person in the Console, and the decision record says so: assignee, waiting_since and sla_due_at are set, reviews lists the manual review activity, and decision_trace.decided_by reads manual, automatic or investigator. When a reviewer changes a status by hand, status_override carries the automatic_status it replaced. A retry must never be used to push a session past a reviewer. If you need the current position, read the decision; if you need to act, act on the status it reports.
Worked cost example
Take 10,000 completed KYC checks a month at list price. 10,000 x $0.33 = $3,300.00. Suppose 2% of your create calls time out and your code retries them with no deduplication, so each retry starts a second session. That is 200 extra sessions, and if they complete, 200 x $0.33 = $66.00. Add AML screening to each KYC at $0.20 and the duplicate run adds 200 x $0.20 = $40.00. The avoidable total is $106.00 a month, plus the time spent reconciling 200 extra sessions.
On the Growth plan every Didit price is 4% lower, so the same duplicates cost 200 x $0.3168 = $63.36 for KYC and 200 x $0.192 = $38.40 for AML, $101.76 in total. The fix costs nothing to run: one key per operation and a stable vendor_data. Build and break it in the sandbox first, which is free and unlimited on every plan. On the Free plan, $10.00 of monthly credit covers about 30 full KYC checks at $0.33 when you switch to live keys.
Sources
- Didit docs: Create Session API, for
workflow_id,vendor_data,callbackand the duplicate detection wording. - Didit docs: Retrieve Session API, for the decision fields,
session_kind,linked_records,decision_traceand the handler pattern. - Didit docs: API errors, for status codes, which failures are safe to retry, the 409 conflict and the defensive body parsing snippet.
- Didit docs: API rate limiting, for the 600 per minute ceilings,
Retry-After, the 429 body and the backoff guidance. - Didit docs: Webhooks, for
X-Signature-V2, the 300 second timestamp window,event_idand the envelope fields. - Didit docs: API authentication, for the
x-api-keyheader, key formats and the create session curl example. - Didit docs: Verification statuses, for the session lifecycle and the exact status strings.
- Didit pricing and the machine-readable price feed, read November 26, 2026, for every unit price in this guide.
- Didit docs: Pricing, for billing rules, including that some no-match lookups and retries are billable.
Next step: open the sandbox at business.didit.me, create a session with a sk_test_ key, and retry it on purpose. No sales call, no credit spent, and you will see the error contract behave exactly as the table above describes.
Try it
Try this in the sandbox
Run the check this guide describes, free.
The product this post is about, taken from its topic. Run it free in the sandbox.
Author
Alejandro Rosas
Co-founder and CTO

Questions
Frequently asked questions
What is an idempotency key in an API call?
An idempotency key is a unique identifier you send with a request so the server can distinguish a retry from a new operation. Your client generates it once per logical operation and reuses it on every retry of that operation. The Didit docs document a 409 conflict when a reused Idempotency-Key collides, so a conflict is a signal to read the code and reload state, not a promise that the original response will be replayed.
Does the Didit API support idempotency keys?
Yes. The Didit error reference documents a 409 conflict when a reused Idempotency-Key collides, alongside the case where a step already ran. For session creation specifically, the documented duplicate control is a stable vendor_data, which the create docs say binds the session to a User or Business entity and is used for duplicate detection across sessions. Use both: the key identifies the operation in your own retry logic, and vendor_data makes a duplicate visible on the session itself.
How do I stop a retry from creating a second verification session?
Generate the key before the first call and resend that same key on every retry, with the same workflow_id and the same vendor_data. Do not create a fresh session to check what happened after a timeout; read the decision for a session id you already hold. The docs do not document replay of the original response, so if you lost the id, reconcile from your own operation record before creating anything new.
Which Didit status codes are safe to retry?
Retry 429 after waiting for Retry-After, and retry 500, 502 and 503 with backoff. Do not retry 400, 401, 402, 403, 404, 410, 415 or 422 until you fix what the body names. A 409 depends on its code: read it and reload the state before deciding.
How long is a Didit idempotency key valid?
The Didit error reference does not publish a retention window for idempotency keys, so treat the window as provider-managed and never as your only record. Keep the key, the vendor_data and the session_id in your own store. Session expiry is a separate setting, session_expiration_time, which accepts 3600 to 2419200 seconds and overrides the workflow default for that session.
Can I reuse one idempotency key for a different request?
No. One key belongs to one logical operation. Creating a session and then updating that session are two operations and need two keys, and a re-verification after a session expires is a third. Reusing a key across operations returns a 409 conflict, and you then have to reload the state to find out what actually happened.
How do I make a Didit webhook handler idempotent?
Verify X-Signature-V2 over the sorted canonical JSON, reject a timestamp more than 300 seconds old, then deduplicate on the envelope event_id before writing any state. Return 2xx as fast as possible so Didit stops retrying, and do the slow work after the response. Accept the -Previous signature header for 24 hours while a destination secret is being rotated.
What does a 409 conflict from Didit mean?
The request conflicts with the current state, for example a reused Idempotency-Key or a step that already ran. Read the code field when it is present and reload the state from the decision endpoint. Retrying the identical request without reading the code will not resolve it.
How much does a duplicate verification cost?
A full KYC check lists at $0.33, made up of ID verification at $0.15, passive liveness at $0.10, face match 1:1 at $0.05 and device and IP analysis at $0.03. AML screening adds $0.20 per check and KYB starts at $2.00 per company. Because billing is per completed check from prepaid credit, every duplicate that completes is billed in full.
Do retries count as billable checks?
A retry that is rejected before any work runs is not billed: a 402, a 403 for missing credits, a 400 on session create or a 422 for an ambiguous wallet address all mean nothing ran. The pricing docs do note that some no-match database lookups and retries are billable, so read the docs pricing page for the endpoints you call. A retry that turns into a second completed session is always billed.
How do I test the retry path without spending money?
Use a sandbox application key, which starts with sk_test_. Sandbox calls are mocked and the sandbox is free and unlimited on every plan, so you can force timeouts and duplicate deliveries safely. Switch the environment variable to the live key only when the retry behaviour is already proven.
What is the vendor identifier used for in Didit?
vendor_data is your stable identifier for the person or business behind a session. The create docs strongly recommend it because it binds the session to that entity and is used for duplicate detection across sessions, and it is echoed in responses and webhooks. It is the field that lets a duplicate session be recognised as a duplicate rather than as a new user.
Compliance built in
Audited, certified and attested.
We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center
- Regulation encoded into your flows
Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.
- Ready for AMLR
Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.
- Tested in Spain's Treasury sandbox
Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.
- Audited, not self-declared
iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.
Your obligations · 3 regions
SOC 2 Type 2
ISO 27001
iBeta Level 1 and Level 2
EU regulator attestation
FSM youth protection
GDPR
EBA remote onboarding
MiCA compatible
FIDO Alliance member
- AMLREU AML Regulation ready
Integration · Didit MCP
Run Didit from your own AI agent
Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.
- Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
- Run investigationsAsk why a session was declined, review cases, search people and companies.
- Change rulesCreate payment rules, test them on past data and switch them on.
- Pull reportsAsk for numbers, exports or the audit log.
Didit Academy


