API Security for Sensitive Identity Data: 8 Steps for 2026
Secure identity APIs with server-side scoped keys, HMAC signed webhooks, retry-aware error handling and configurable retention. A full Didit KYC check is $0.33 and the sandbox is free.

Contents
In this guide
Jump to the part you need.
This guide fits engineering and security teams that call an identity API and then hold the identity data it returns. It covers keys, webhooks, error handling, retention and deletion against Didit's documented endpoints. A full KYC check lists at $0.33 per completed check and the sandbox is free on every plan. The main caveat: the API key is a server-side secret, so never let it reach a browser or mobile bundle.
Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.
| Risk | Control | Where it is documented |
|---|---|---|
| Key copied into a browser or mobile bundle | Key lives on the server only, one key per workload | API authentication |
| Key reaches more than it should | Scoped keys with workflow, status and IP limits | API errors |
| Forged webhook changes a decision | HMAC-SHA256 X-Signature-V2 and a 300 second timestamp window | Webhooks |
| Wrong or missing key fails silently | Branch on 401, 403 and the body code | API errors |
| Runaway loop exhausts the quota | Respect Retry-After and cap retries | Rate limiting |
| Identity data kept longer than allowed | Retention window plus the delete session call | Data retention |
Start free in the sandbox at business.didit.me, no sales call. Developers who want an assistant to drive the integration can connect Didit through the Didit MCP server, and every list price sits on Didit pricing.
What an identity API exposes
An identity API accepts an ID document, a selfie, often a phone number, an email or an address, and returns decisions about a person. The decisions are the sensitive part. A document step returns extracted fields and authenticity results. Liveness and face match return whether a live person was present and whether that face matches the document portrait. Device and IP analysis returns location and device signals. AML screening returns list hits. Didit serves 4,000+ companies. The platform scores every session against 200+ fraud signals. Those results are available through the API and Business Console, so secure both access paths.
Two access paths are the boundary you defend. Routes on verification.didit.me take a long-lived API key in the x-api-key header. Routes on apx.didit.me take Authorization: Bearer plus a JWT access token, which you replace by logging in again when the API answers 403. Webhook payloads use HMAC signatures rather than either API authentication scheme. The API key is the long-lived secret of the three, so every control below starts with it and works outward to webhooks, errors, retention and deletion.

Prerequisites
- A Didit application, because every API key belongs to an application. The sandbox application is free.
- The
workflow_idof a published workflow, since a session cannot start without one. - A server that holds secrets as environment variables, and a deploy process that never writes them into client code.
- An HTTPS endpoint that can receive POST requests and read the raw request body before JSON parsing.
- Access to
Developersand thenAPI keysin the Business Console for the person who issues keys.
Eight steps to secure an identity API
- Separate the two hosts and their auth schemes. Didit has two hosts and they do not share a key format.
https://verification.didit.meserves every/v3route (sessions, workflows, entities, transactions, standalone APIs, lists, webhooks, billing) and authenticates with anx-api-keyheader.https://apx.didit.meserves account, organization and application management and authenticates withAuthorization: Bearerplus a JWT access token. The verification API does not use OAuth Bearer tokens. - Get a key and store it as a server-side secret. Two calls create the organization and return both applications inline, one sandbox and one live:
Persistcurl -X POST https://apx.didit.me/auth/v2/programmatic/register/ -H "Content-Type: application/json" -d '{"email": "you@yourdomain.com", "password": "StrongP@ss1"}' curl -X POST https://apx.didit.me/auth/v2/programmatic/verify-email/ -H "Content-Type: application/json" -d '{"email": "you@yourdomain.com", "code": "A3K9F2"}'sandbox_application.api_keyasDIDIT_API_KEYandapplication.api_keyasDIDIT_LIVE_API_KEY. New keys start withsk_live_orsk_test_followed by 43 URL-safe characters, and keys created before that format have no prefix, so never validate a key by its prefix. - Give each service its own scoped key. In the Business Console open
DevelopersthenAPI keys. The Primary key is the application's own secret. Create a new key for each service or partner so one leak does not reach every workflow. A key can be limited to particular workflows and statuses, and to an IP allow list. A key called from outside its IP list returns 403, and a key used on a session outside its limits returns 404. - Create sessions from your server, never from the client. Session creation is one billable route. Other standalone APIs have their own published prices. The call itself is short:
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"}'vendor_datais your own user id, and the webhook envelope echoes it back so you can correlate events with your records. Keep the returnedsession_idas well, because the decision call and the delete call both need it.callbackis where the user lands when the flow ends. - Verify every webhook before you read the body. Read the raw request body before parsing JSON. Reject anything where
abs(now - X-Timestamp)is over 300 seconds. Recompute HMAC-SHA256 with the destination signing secret over the sorted, Unicode-preserved canonical JSON and compare in constant time againstX-Signature-V2, the recommended header.X-Signaturesigns the exact raw bytes and only works if your stack does not re-encode the body. Accept a match onX-Signature-V2-Previouswhen it is present, because Didit sends the previous signature for 24 hours after a secret rotation.X-Signature-Simpleauthenticates the envelope only, so if you verify with it, re-fetch the decision fromGET /v3/session/{session_id}/decision/instead of trusting the payload. Return 2xx quickly and write idempotently onevent_id. - Branch on status and body code, not on message text. Error bodies do not share one envelope: most carry
detail, some addcode, standalone APIs useerror, and a 500 may have no JSON at all. Parse defensively:
Rely on the status first and onconst 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);codewhen it is present, because the text of a message can change. - Back off correctly on 429. Didit counts requests per
x-api-keyin 60 second fixed windows and returnsRetry-AfterplusX-RateLimit-Scopewhen a scope is exhausted. Session creation is capped at 600 per minute per key,generic-getat 600 per minute, and the v1 and v2 decision paths at 100 per minute. Wait at leastRetry-After, then layer exponential backoff with jitter and stop after a small ceiling so a runaway loop does not keep burning quota. - Set retention and delete on request. In the Business Console open
App SettingsthenData retentionand pick a window from 1 month to 10 years. A new application starts at the longest window its plan includes. For an erasure request, delete the session and ask for the biometric template to go with it:
A 200 response reports what happened to the face biometric data incurl --request DELETE --url https://verification.didit.me/v3/session/SESSION_ID/delete/ --header 'x-api-key: YOUR_API_KEY' --header 'Content-Type: application/json' --data '{"deletion_instruction": "privacy_erasure"}'face_retention_outcome, and a 404 means the session was already deleted.


Expected output
A correct verify-email call returns the access token, the refresh token, the organization and both applications with their keys:
200 OK
access_token, refresh_token, organization
application: { api_key, client_id, uuid, mode: "live" }
sandbox_application: { api_key, client_id, uuid, mode: "sandbox" }
A throttled request returns the scope that tripped and the wait, so your client can pause instead of guessing:
HTTP/1.1 429 Too Many Requests
X-RateLimit-Scope: session-v2-create
X-RateLimit-Limit: 600
X-RateLimit-Remaining: 0
Retry-After: 37
{"detail": "Session creation rate limit exceeded. You can make up to 600 requests per minute.", "limit": 600, "remaining": 0, "reset": 1794358860, "window_seconds": 60}
Failure cases and recovery
| Status | What it means | Recovery |
|---|---|---|
| 401 | Key wrong, malformed, revoked or expired | Check DIDIT_API_KEY or log back in to recover the key. Do not retry the same key. |
| 403 | No key sent, key lacks access, call came from outside the key's IP list, or the balance cannot cover the call | Read the body, then use a key with that access or fix the IP list |
403 with code application_deleted | The key's application was deleted | Stop. The application and its keys no longer exist. Use a key of an application that exists. |
| 404 on a session route | The session sits outside the key's workflow or status limits | Use a key whose limits include that session |
402, or 403 with insufficient_credits | The check could not be paid for, so it did not run | Top up at business.didit.me, then retry |
| 409 | Conflict, for example a reused idempotency key or a step that already ran | Read code, reload state, retry only if the code allows |
| 429 | A rate limit or quota was reached | Wait for Retry-After, add jitter, cap the attempts |
| 500, 502, 503 | An unexpected error, or a service Didit depends on is down | Retry with backoff, then contact support |
Inputs and outputs
| Direction | Field | Notes |
|---|---|---|
| Input | x-api-key | Server-side only, one key per workload |
| Input | workflow_id | The published workflow the session runs |
| Input | vendor_data | Your own user id, echoed back in the webhook so you can correlate events |
| Input | callback | Where the user returns when the flow ends |
| Input | deletion_instruction | Set to privacy_erasure to purge a retained biometric template |
| Output | session_id | Used for the decision call and for deletion |
| Output | status | Approved, Declined, In Review, In Progress, Not Started, Abandoned, Expired, Kyc Expired, Resubmitted, Awaiting User |
| Output | webhook_type | status.updated, data.updated, transaction.created and the other listed event families. There is no wildcard. |
| Output | decision | Per-feature arrays: id_verifications, liveness_checks, face_matches, aml_screenings, ip_analyses and the rest |
Paid steps and review boundaries
The sandbox is free and every check is mocked there, so key handling, webhook verification and deletion cost nothing to test. Live calls are paid per completed check from prepaid credit. A full KYC check is $0.33, AML screening is $0.20, proof of address is $0.20 and wallet screening is $0.15 per screening. A session create that cannot be paid for does not run the checks: POST /v3/session/ answers 400 when the balance cannot cover it. You can review the AML side on the AML screening page and the full list on Didit pricing.
The review boundary sits in the status. A session can have status In Review. Treat that status as pending in your system until it reaches an approved or declined status. Do not mark a user as verified because a session was created, and do not read an interrupted flow as an approval. Every price here is a published list price read from the live feed on November 26, 2026, so check the same line on Didit pricing before you commit a budget.
Worked cost example
Take 5,000 new users a month, each with a full KYC check and an AML screening, at list prices:
- KYC: 5,000 x $0.33 = $1,650.00
- AML screening: 5,000 x $0.20 = $1,000.00
- Monthly total at list price: $2,650.00
On the Scale plan every Didit price drops 10 percent, so the KYC line is 5,000 x $0.297 = $1,485.00 and the AML line is 5,000 x $0.18 = $900.00, for $2,385.00 in usage. The plan fee is $299.00 a month and includes $350.00 of credit, so $2,385.00 minus $350.00 leaves $2,035.00 in top-ups, and $299.00 plus $2,035.00 is $2,334.00 paid that month. On Growth the same math runs at 4 percent off, with $99.00 a month and $115.00 of credit.
Sources
- Didit docs: API authentication
- Didit docs: Webhooks and HMAC signing
- Didit docs: API errors
- Didit docs: Rate limiting
- Didit docs: Security and compliance
- Didit docs: Data retention and deletion
- Didit docs: Delete session API
- Didit: AML screening
- Didit pricing and pricing in the docs
- Didit MCP server
- GDPR, Regulation (EU) 2016/679
Next step: create a free sandbox application at business.didit.me, run one session with a sandbox key, and wire key handling, webhook verification and deletion before you spend anything. No sales call is needed to start.
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 API security for identity data?
It is the set of controls around the endpoints that accept documents, selfies and personal details and return decisions about a person. It covers how callers authenticate, what each key can reach, how signed events are verified, how failures are handled and how long the data is kept. The data is the target, so the API is the boundary you defend.
What is an identity API?
An identity API is a server-to-server interface that runs identity checks and returns results as data instead of a screen. At Didit one call creates a session from a published workflow, and the result comes back through the decision endpoint and through signed webhooks. The same open API covers ID checks, liveness, face match and AML screening.
How does Didit authenticate API requests?
Every /v3 route on verification.didit.me takes a long-lived key in the x-api-key header. Account, organization and application management on apx.didit.me takes Authorization: Bearer with a JWT access token. The verification API does not use OAuth Bearer tokens. A missing key returns 403 and a wrong, revoked or expired key returns 401.
Where should I store the Didit API key?
On the server only, as an environment variable such as DIDIT_API_KEY, and never in frontend code, a public repository or a mobile bundle. Give each service or partner its own key so one leak has a small blast radius, and limit that key to the workflows, statuses and IP ranges it needs.
How do I verify a Didit webhook signature?
Read the raw body before parsing, reject requests older than 300 seconds by X-Timestamp, recompute HMAC-SHA256 with the destination signing secret and compare in constant time against X-Signature-V2. Accept a match on X-Signature-V2-Previous while you rotate a secret. If you fall back to X-Signature-Simple, re-fetch the decision from the API rather than trusting the payload.
What happens when a Didit API call returns 401 or 403?
A 401 means the key is wrong, malformed, revoked or expired, so fix the key or recover it by logging in again. A 403 means no key was sent, the key lacks access to that resource, the call came from outside the key's IP list, or the balance cannot cover it. Do not loop on either status, because retrying the same request changes nothing.
How do I handle Didit rate limits?
Didit counts requests per API key in 60 second windows and returns 429 with Retry-After when a scope is exhausted. Wait at least that long, then add exponential backoff with jitter and stop after a small number of attempts. Session creation is limited to 600 requests per minute per key, and the generic GET ceiling is 600 per minute.
Does Didit keep the selfie and the ID document?
Didit stores verification inputs, outputs and operational metadata for the retention window you set on the application, from 1 month to 10 years. An application starts at the longest window its plan includes: 1 year on Free, 5 years on Growth, 10 years on Scale and unlimited on Enterprise. You can set a shorter window and delete a session on demand.
How do I delete a user's identity data on request?
Call DELETE on /v3/session/{session_id}/delete/ and send deletion_instruction set to privacy_erasure for an erasure request, which also purges any retained biometric template for that person. The call returns 200 with face_retention_outcome, or 404 if the session was already deleted. You remain the data controller and Didit is the processor.
Is Didit certified for security and privacy?
Didit is SOC 2 Type 2 certified, with a report covering the March 9 to July 1, 2026 observation period and issued in July 2026, and ISO/IEC 27001:2022 certified. Liveness detection is iBeta Level 1 and Level 2 certified under ISO 30107-3. Didit is GDPR compliant, acts as a data processor, and processes and stores data in the EU on AWS by default.
How much does an identity API cost?
At Didit you pay per completed check from prepaid credit. A full KYC check is $0.33 (ID document $0.15, passive liveness $0.10, face match 1:1 $0.05, device and IP analysis $0.03), AML screening is $0.20 and proof of address is $0.20. The sandbox is free on every plan, and the Free plan includes $10 of monthly credit for organizations that sign up with a work email.
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


