How to Integrate ID Verification With Didit's JS SDK
Build a workflow in the console, create a session with POST /v3/session/, pass its url to DiditSdk.shared.startVerification, then read the decision from the signed webhook. Full KYC is $0.33; sandbox is free.

Contents
In this guide
Jump to the part you need.
Didit's JavaScript SDK fits a web app that needs a full identity check inside its own page, in React, Vue, Next.js, Nuxt, Svelte, Angular or plain JavaScript. A full KYC check costs $0.33 and the sandbox is free. For API-session flows, keep the API key server-side and create the session in your backend. UniLink can be used without a backend.
Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.
| Step | What you do | What it costs |
|---|---|---|
| 1 | Create an organization and application, copy the API key | Free |
| 2 | Build a workflow in the console, copy its workflow ID | Free, the workflow orchestrator is included |
| 3 | Create a session with POST /v3/session/ from your backend | Free to create |
| 4 | Open the flow with DiditSdk.shared.startVerification | Billed per completed check, $0.33 for a full KYC |
| 5 | Read the decision from the signed webhook | Free |
| 6 | Review sessions the automated checks flag as In Review | Manual review is handled in the Didit Business Console. |
Start free in the sandbox at business.didit.me, with no sales call and no contract. If you also want to drive Didit from an AI assistant, connect the hosted server through didit.me/developers/mcp. The checks in this guide are described on the identity verification product page, and every unit price is public on didit.me/pricing.
What you build, and why the SDK is the recommended method
The outcome is a page where a logged-in user captures an ID document, passes a passive liveness check and is matched to the portrait on that document, all without leaving your domain. Your backend creates a session, your frontend opens it, and your webhook endpoint receives the decision.
Didit documents seven ways to do this on the web. The JavaScript SDK is the recommended one for a production web app: about 3 minutes to set up, backend optional, the user stays on your domain, and you get real-time event callbacks with full programmatic control. The InContext iframe sets up in under a minute and suits a page that only needs an embedded flow, with limited control and postMessage events. Redirect takes about 5 minutes, requires a backend, and is the one method that leaves your domain, so use it when camera access inside an iframe is unreliable or the user has to finish on another device. WebView is the mobile fallback, and WordPress, Shopify and Salesforce each have a no-code plugin. The JavaScript SDK, iframe and redirect methods deliver final signed results by webhook. The difference is the in-browser experience, not the decision.
More than 4,000 companies use Didit across 220+ countries and 14,000+ document types, with sub-2-second p99 inference.

Prerequisites
- A Didit organization. Sign up at business.didit.me with a work email; eligible organizations get $10 of credit every month.
- An application inside that organization and its API key, from Developers, then API keys. New keys start with
sk_test_for a sandbox application orsk_live_for a live one, followed by 43 URL-safe characters. Never validate a key by its prefix. - A published workflow and its UUID. You build it in the console, no code.
- A backend that holds the API key as a server-side secret and exposes one endpoint to your frontend.
- A public HTTPS endpoint for the webhook that answers in under 5 seconds.
- Node and a bundler for the SDK package, or vanilla JavaScript support via the documented examples.
Step by step
Step 1. Create the organization, the application and the API key
Sign in to the Didit Business Console, pick the Application from the dropdown at the top, then open Developers, then API keys. The Primary key is the application's own secret. Create an extra key when a service or a partner needs its own. Copy it into your server environment as DIDIT_API_KEY and never ship it to a browser bundle or a public repository.
You can also provision without the console. POST https://apx.didit.me/auth/v2/programmatic/register/ emails a 6-character code, and POST https://apx.didit.me/auth/v2/programmatic/verify-email/ returns both keys inline. Store response.sandbox_application.api_key for building and testing, and response.application.api_key for going live.
Step 2. Build the workflow and copy its ID
Open Workflows in the sidebar and click New workflow. Choose whether you verify users or businesses, then pick a start: describe the checks you need and review the draft that Didit builds, start from a template, or start empty and add steps in the editor. A Simple workflow runs its steps in a fixed order, which is what standard onboarding needs. A Node-based workflow branches on verification results.
Build a workflow with ID verification, passive liveness and face match, with AML screening if needed. Templates cover standard KYC, Adaptive Age Verification with a selfie age check and ID fallback, and Biometric Authentication. Publish the workflow and copy the UUID. That value is the workflow_id in every session you create.
Step 3. Create a session from your backend
One call starts a verification. It runs server side, with the API key in the x-api-key header.
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/kyc/return"}'
The response contains session_id, url and session_token. Send only the url to your frontend. Keep vendor_data as your own stable user identifier: it binds the session to that person and is used for duplicate detection across sessions. The callback is where the hosted flow redirects when it finishes, and Didit appends the session id and status to it as ?verificationSessionId={session_id}&status={status}.
Step 4. Start the flow in the browser with the SDK
The browser never sees your API key. The key and every session-creation call stay on your server, and the frontend receives only the session url returned in step 3. Install the package and pass that URL. The SDK supports modal and inline modes, TypeScript types, and React, Vue, Angular, Next.js, Nuxt, Svelte and vanilla JavaScript.
import { DiditSdk } from '@didit-protocol/sdk-web';
DiditSdk.shared.onComplete = (result) => {
switch (result.type) {
case 'completed':
console.log('Verification completed!');
console.log('Session ID:', result.session?.sessionId);
console.log('Status:', result.session?.status);
break;
case 'cancelled':
console.log('User cancelled verification');
break;
case 'failed':
console.error('Verification failed:', result.error?.message);
break;
}
};
// Start verification with the url returned by POST /v3/session/ (or your UniLink)
DiditSdk.shared.startVerification({
url: 'https://verify.didit.me/session/3FaJ9wLqX2Mz'
});
The user stays on your domain while the SDK renders the document capture, liveness and face match screens your workflow defines. Working React, Vue, Angular, Next.js, Nuxt, Svelte and vanilla examples sit in the SDK web examples repository.

Step 5. Read the decision from your webhook
The callback from step 3 only redirects the user back to your page and appends the session ID and status to the URL, which is enough to show a thank-you screen. The authoritative record is the webhook. Register a destination with POST https://verification.didit.me/v3/webhook/destinations/, passing label, url, subscribed_events and webhook_version set to v3. There is no wildcard, so subscribe to every family you want; status.updated, data.updated, user.status.updated and user.data.updated cover the verification flow. Save the returned secret_shared_key as DIDIT_WEBHOOK_SECRET.
On your endpoint, read the raw request body before parsing any JSON. Verify the X-Signature-V2 header, which is an HMAC-SHA256 over the sorted canonical JSON, using that secret. Check that X-Timestamp is within 300 seconds of now. Compare in constant time, and accept a match on the -Previous header too so a secret rotation does not break delivery while you deploy. Return a 2xx quickly, then update your database idempotently, de-duplicating on event_id.
The envelope carries session_id, status, webhook_type, vendor_data, metadata and, when the session reaches Approved, Declined, In Review or Abandoned, a full decision object. The decision mirrors GET https://verification.didit.me/v3/session/{session_id}/decision/, so you can always re-fetch it if a delivery is lost.
Step 6. Test in the sandbox, then switch to the live key
Every check in the sandbox is mocked, so you can drive any outcome without real documents or billing. Use the scenario catalog through sandbox_scenario on session create, or arm a scenario on an existing session with POST /v3/session/{session_id}/sandbox/arm/ while it is still Not Started. The parameter is rejected with 400 on live applications.
When the flow works end to end, switch DIDIT_API_KEY to the live key. Do that once the organization has credit, because an organization created through the API starts at zero.
Expected output
- The session call returns
session_id,urlandsession_token. - Your browser console prints Verification completed!, the session ID, and a status string.
- Your webhook log shows a
status.updatedevent withevent_id,session_id,vendor_dataand, on a final status, thedecisionobject. - The decision holds plural arrays such as
id_verifications[],liveness_checks[],face_matches[],aml_screenings[]andpoa_verifications[]. Read them as arrays, never as singular V2 fields. - Status strings are exact and case sensitive, including
Kyc Expiredwith a single capital K.

Failure cases and recovery
| Symptom | What it means | Recovery |
|---|---|---|
| 401 on verification.didit.me | The x-api-key header is wrong, malformed, revoked or expired | Log back in through the programmatic login endpoint, read the application and copy api_key again |
| 403 on verification.didit.me | No key, a scoped key without access to this resource, or a call from outside the key's IP list | Use a key created in Developers, API keys with the access you need |
403 with application_deleted | The key's application was deleted | Do not retry. Use the key of an application that exists |
| 400 on session create | Invalid workflow_id, or a callback outside the application's allowed domains | Copy the workflow UUID again, or add the origin to allowed domains |
| 404 on a session route | The session sits outside the scoped key's workflows or statuses | Use a key whose limits include that session |
| 429 | Rate limit, with a wait field in seconds | Back off for that many seconds, then retry |
| Webhook never arrives | Your handler answered 5xx or 404, or took longer than 5 seconds | Didit retries twice, about 1 and 4 minutes later, then drops the delivery. Resend it from the destination's delivery log, then re-fetch the decision endpoint |
| SDK reports failed or cancelled | The user closed the flow, or a capture step failed | Read result.error.message. If the user chooses to try again, create a new session; this is an implementation choice on your side |
Inputs and outputs of the session call
| Field | Direction | Notes |
|---|---|---|
workflow_id | Input, required | UUID of the published workflow. The workflow type decides whether this is a KYC or a KYB session |
vendor_data | Input, recommended | Your stable user or business identifier, used for duplicate detection |
callback | Input, optional | Where the hosted flow returns. Must match an allowed domain when the application sets one |
metadata, tags | Input, optional | Arbitrary JSON echoed in webhooks, and console tags for filtering |
language, contact_details, expected_details | Input, optional | UI language, pre-filled email or phone steps, and expected identity fields whose mismatches surface as decision warnings |
session_expiration_time | Input, optional | Seconds the link stays valid, between 3600 and 2419200 |
session_id | Output | Identifier you use for the decision endpoint and for support |
url | Output | The hosted flow the SDK opens with startVerification |
session_token | Output | Token returned with the session |
What is billable, and where a human decides
Creating a workflow and creating a session cost nothing. Testing in the sandbox is free and unlimited. In production you pay per completed check from prepaid credit, and the docs pricing page lists the few no-match database lookups and retries that are also billable.
A full KYC check is $0.33. Each extra step is its own line: AML screening $0.20, proof of address $0.20, age estimation $0.10, NFC chip reading $0.15 as an add-on, custom questionnaires $0.10, white label flow $0.10, and database validation priced by country. Reusable KYC, the workflow orchestrator, the SDKs and the MCP server are free.
The review boundary is a status, not a setting. Automated checks end at Approved, Declined or In Review. An In Review session waits for a person in the Didit Business Console to approve it, decline it or send it back for resubmission. Plan for a review queue before you go live, and never grant access on an In Review status.
Worked cost example
Assume 20,000 completed KYC checks a month, and 5,000 of those users also get AML screening. Using published list prices only:
- 20,000 x $0.33 = $6,600.00
- 5,000 x $0.20 = $1,000.00
- Total at list price = $7,600.00
On the Scale plan every Didit price is 10% off:
- $6,600.00 x 0.90 = $5,940.00
- $1,000.00 x 0.90 = $900.00
- $5,940.00 + $900.00 = $6,840.00, plus the $299 monthly fee = $7,139.00
That is $461.00 less than list price at this volume. On the Free plan, $10.00 of monthly credit covers 30 full KYC checks ($10.00 / $0.33 = 30.3), and phone verification codes are excluded from that credit.
Sources
- Didit docs, Web Identity Verification SDKs: JS and Iframe
- Didit docs, JavaScript SDK
- Didit docs, Quick Start
- Didit docs, API Authentication
- Didit docs, Create Session API
- Didit docs, Webhooks and HMAC signing
- Didit docs, Verification statuses
- Didit docs, Sandbox test data and scenarios
- Didit docs, end-to-end integration prompt
- Didit docs, Pricing and billing rules
- Didit pricing page and pricing as JSON, read November 26, 2026
- SDK web examples on GitHub
- Didit MCP server setup
Your next step: open business.didit.me, create an organization with a work email, and run this flow in the sandbox today. The sandbox is free, no sales call is involved, and you can switch to the live key when the webhook decision matches your database.
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
Can I see a Didit demo without a sales call?
Yes. Create an organization at business.didit.me with a work email and the console and sandbox are live immediately, with no call and no contract. The sandbox mocks every check, so you can run a full identity flow and see real decision payloads before you pay anything.
How do I add age verification to a web app with Didit?
Build a workflow that includes Age Estimation, or start from the Adaptive Age Verification template, which uses a selfie age check with an ID document fallback. Publish it and create a session exactly as in this guide; the same JavaScript SDK call opens the flow, so you do not need a second integration. Age Estimation is $0.10 per check, and a full KYC check for the fallback path is $0.33.
Which Didit integration method should a web app use?
For a production web app, use the JavaScript SDK: about 3 minutes to set up, backend optional, and full programmatic control with real-time event callbacks. Use the InContext iframe when you need the quickest embed, Redirect when camera access inside an iframe is unreliable or you need cross-device flows, and the WordPress, Shopify or Salesforce plugin when your site lives on that platform.
How much does a full KYC check cost with Didit?
A full KYC check is $0.33, made of ID document verification at $0.15, passive liveness at $0.10, face match 1:1 at $0.05 and device and IP analysis at $0.03. Growth takes 4% off Didit prices ($0.3168) and Scale takes 10% off ($0.297). Sandbox testing is free and unlimited, and eligible organizations get $10 of credit every month.
Should the Didit API key go in the browser?
No. The key is a server-side secret, and the verification API only accepts it on the x-api-key header, never from a client bundle. Create the session in your backend and send the returned url to the frontend, where the SDK opens it. A missing key returns 403 and a wrong, revoked or expired key returns 401.
What does the SDK return when the user finishes?
The DiditSdk.shared.onComplete handler receives a result whose type is completed, cancelled or failed. A completed result carries result.session.sessionId and result.session.status. A failed result carries result.error.message, which is the string to log when a capture step breaks.
How do I know the final decision on a session?
Read the webhook. A status.updated event carries the exact status string and, on Approved, Declined, In Review or Abandoned, the full decision object. If a delivery is lost, call GET https://verification.didit.me/v3/session/{session_id}/decision/, which returns the same object. Statuses are case sensitive, so match on Approved and In Review exactly.
What happens if my webhook endpoint does not respond in time?
If your handler answers 5xx or 404, or takes longer than 5 seconds, Didit retries twice, roughly 1 and 4 minutes later, then drops the delivery. You can resend it from the destination's delivery log in the console. Design the endpoint to read the raw body, verify X-Signature-V2, return 2xx fast, and process idempotently on event_id.
Can I test the JavaScript SDK without real documents or billing?
Yes. The sandbox is free and unlimited, and every check is mocked. Pass a scenario slug in sandbox_scenario when you create the session, or arm a scenario with POST /v3/session/{session_id}/sandbox/arm/ while the session is still Not Started. The parameter is rejected with 400 on live applications.
Does the verification take the user off my site?
With the JavaScript SDK, no. It runs in modal or inline mode inside your page and keeps your domain visible to the user, and the flow can be white labelled at $0.10 per check. Redirect is the one method that sends the user to a Didit-hosted page and brings them back to your callback URL.
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


