KYC SDK for JavaScript: Add a KYC Check in 6 Steps
The Didit JavaScript SDK adds a KYC check to a web app in about three minutes. Your server creates the session, the SDK runs the flow, and the signed decision arrives by webhook or a server-side decision fetch.

Contents
In this guide
Jump to the part you need.
A KYC SDK for JavaScript fits a web team that wants identity checks inside its own signup flow rather than on a hosted page. Didit's SDK, @didit-protocol/sdk-web, takes about three minutes to wire and the package costs nothing; a completed full KYC check costs $0.33. The caveat is architectural: the API key stays on your server, the callback reports flow status, and the signed decision arrives by webhook or a decision fetch from your server.
Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.
| Item | Detail |
|---|---|
| What you build | ID document capture, passive liveness and face match inside your own page, with the decision stored on your server |
| Package | @didit-protocol/sdk-web, free on every plan |
| Documented setup time | 3 minutes, per the Didit web SDK documentation |
| Frameworks | React, Vue, Angular, Next.js, Nuxt, Svelte and vanilla JavaScript, with TypeScript types |
| Backend | Optional for the SDK itself, required to keep the API key off the client and to verify webhooks |
| Price per completed full KYC check | $0.33 (ID $0.15 + passive liveness $0.10 + face match $0.05 + device and IP $0.03) |
| Free credit | $10 a month on the Free plan; sandbox testing is free and unlimited |
| Signed result | status.updated webhook with HMAC-SHA256 signature, plus GET /v3/session/{session_id}/decision/ |
| Main caveat | The callback reports client-side flow state only. The server-side record comes from the status.updated webhook or a decision fetch |
Start free in the sandbox at business.didit.me, with no sales call. If you would rather have an AI assistant write the integration, connect Didit through the Didit MCP server. Every module price is on didit.me/pricing, and the web SDK overview lists all seven integration methods.
What a JavaScript KYC SDK does in a web app
A KYC SDK for JavaScript is a client library that runs the identity steps inside your own page. It opens the verification flow and hands the outcome back to your code. You keep your signup flow and your design. The checks run on Didit's side and the decision comes back as structured data.
Didit documents seven web integration methods. The JavaScript SDK is the one with full programmatic control: modal or inline modes, real-time event callbacks, TypeScript types, and support for React, Vue, Angular, Next.js, Nuxt, Svelte and vanilla JavaScript. The InContext iframe is the quickest option at under a minute, the redirect flow is the most compatible, and WordPress, Shopify and Salesforce each have their own plugin. Pick the SDK when you want to control the experience. Pick the iframe when you want the quickest setup.
The SDK documentation lists backend integration as optional, and the iframe's UniLink mode really does need no server of its own. Secure production use still requires server-side session creation, so the API key never reaches the browser, and webhook verification, so the decision you store is one you can defend.
One distinction shapes the architecture. Browser callbacks report client-side flow state, which is what drives your interface. The compliance record is the server-side one: the status.updated webhook, or a fresh decision fetch from GET /v3/session/{session_id}/decision/. Treat the webhook payload or that fetch as the source of truth and let the callback update the screen.
What to check before you pick a JavaScript KYC SDK
- Document coverage. Didit supports 14,000+ document types across 220+ countries and territories.
- Liveness and face match. Passive liveness is $0.10 per check and face match 1:1 is $0.05, both inside the full check price.
- Screening. AML screening covers 1,300+ lists and costs $0.20 per check.
- Deterministic testing. A sandbox that can reproduce any outcome is worth more than a demo. Didit publishes scenarios, magic values and test documents in the sandbox testing guide.
- Price per completed check. Per-seat pricing hides the cost of growth. Didit bills per completed check from prepaid credit, and every price is public on didit.me/pricing.
- Key handling. If a vendor asks you to ship a secret in the browser bundle, walk away. The authentication guide explains the server-side
x-api-keymodel.
Prerequisites
- A Didit account and an application. Sign in at business.didit.me and pick the application you are building against.
- An API key from Developers, then API keys. The primary key is the application's own secret and has full access. New keys start with
sk_live_for live orsk_test_for sandbox, followed by 43 URL-safe characters. Store it as a server-side environment variable such asDIDIT_API_KEY. - A KYC workflow and its UUID, which
POST /v3/session/expects asworkflow_id. A workflow of type KYC creates a user verification session; a KYB workflow creates a business verification session. There is no separate endpoint for the two. - Node.js with npm or yarn, and a bundler for your framework of choice.
- A backend route for creating sessions, and one for receiving webhooks. A browser needs camera permission for the document and face steps.
- A sandbox application for testing. The sandbox is free on every plan and every check is mocked.
Add a KYC check to a JavaScript app in 6 steps
Create the session on your server. Call
POST https://verification.didit.me/v3/session/with your workflow UUID. The response contains the hostedsession_urlthat the SDK will open. Keep this call server-side: thex-api-keyheader must never reach the browser or a mobile bundle.vendor_datais your stable user identifier and binds the session to an entity, which is what duplicate detection uses.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"}'If your application has allowed domains configured, an http or https
callbackmust sit on one of those origins, otherwise creation fails with a 400 on callback. Custom app deep links are always accepted.Install the SDK. Run
npm install @didit-protocol/sdk-web. The package is published on npm and the working examples for React, Vue, Angular, Next.js, Nuxt, Svelte and vanilla JavaScript are in the sdk-web-examples repository.Register the completion handler and start the flow.
onCompletefires once with aresult.typeofcompleted,cancelledorfailed. Pass thesession_urlfrom step 1 asurl.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' });Subscribe to the webhook and fetch the decision on your server. Register a destination for
status.updated, the event Didit sends when a session status changes. When that payload arrives, itswebhook_typereadsstatus.updatedand it carries the session id and status. Read the full record withGET https://verification.didit.me/v3/session/{session_id}/decision/. The key needs theread:sessionsprivilege. Always branch onsession_kind, because the same endpoint serves user and business sessions.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); }Map the status strings exactly. Statuses are case-sensitive and include spaces:
Not Started,In Progress,Approved,Declined,In Review,Awaiting User,Resubmitted,Expired,AbandonedandKyc Expired, which uses a single capital K. The status reference is the single source of truth for those strings.Test in the sandbox, then switch the key. Sandbox applications accept a
sandbox_scenarioslug that reproduces a chosen outcome, so you can drive approvals, declines and review paths without PII or billing. When the flow behaves, pointDIDIT_API_KEYat thesk_live_key and make sure the organization carries credit.


Expected output
A user who passes produces three console lines from the handler in step 3:
Verification completed!
Session ID: 3FaJ9wLqX2Mz
Status: Approved
Two things surprise people here. First, a user who closes the modal gets cancelled, not an error. Second, a verification that runs correctly but fails its checks is still a completed callback: it returns the session with status Declined, and the reasons sit in the decision warnings. A completed callback means the flow finished, not that the person was approved, so read result.session.status before you grant anything. failed means the verification flow failed.
Failure cases and recovery
| Symptom | Cause | Recovery |
|---|---|---|
| 401 from verification.didit.me | x-api-key wrong, malformed, revoked or expired | Recover the key through the documented login flow, or use another valid key |
| 403 from verification.didit.me | No key header, a scoped key without access to this resource, or a call from an IP outside the key's list | Use a key that holds the privilege, or adjust the key in Developers, then API keys |
400 on callback | The callback origin is not on the application's allowed domains | Add the origin, or use a custom app deep link |
429 with a wait field | Rate limit | Back off for the number of seconds returned, then retry |
| 404 on a decision fetch | The session does not exist or belongs to another application | Check the id and the key you used |
| Webhook rejected by your verifier | Timestamp older than 300 seconds, or a body re-encoded before signature check | Read the raw body, verify X-Signature-V2, compare in constant time, and accept the -Previous header during a secret rotation |
Status Expired | The user never opened the link before the session TTL ran out | Create a new session and resend it |
Status Abandoned | The user opened the flow but did not finish in time | Resend the link or create a fresh session |
Status Declined | One or more checks failed | Notify the user, and request a resubmission if the issue is fixable |
Status In Review | Automated checks raised warnings a person must read | A reviewer approves, declines or requests a resubmission in the console. Do not treat it as a pass or a fail in your code |
Inputs and outputs
| Field | Where | What it does |
|---|---|---|
workflow_id | Create session, required | Stable workflow UUID from /v3/workflows/. Its type decides whether a user or business session is created |
vendor_data | Create session, optional | Your user identifier. Binds the session to an entity and feeds duplicate detection |
callback | Create session, optional | Where the hosted flow returns the user. Didit appends the session id and status |
metadata | Create session, optional | Arbitrary JSON echoed back in responses and webhooks, not shown to the user |
language | Create session, optional | ISO 639-1 code for the verification interface, defaults to browser detection |
expected_details | Create session, optional | Name, date of birth, nationality or document types you already hold. Mismatches surface as decision warnings |
session_url | Create response, then passed to the SDK | The hosted verification URL that startVerification opens |
result.type | SDK callback | completed, cancelled or failed |
result.session.sessionId, result.session.status | SDK callback | The session identifier and its status string at completion |
result.error.message | SDK callback | The reason the flow could not run, on a failed result |
webhook_type | Webhook payload | Use status.updated to receive session status changes |
session_kind | Decision or webhook | user or business. Branch on it before you read feature arrays |
id_verifications[], liveness_checks[], face_matches[], aml_screenings[] | Decision or webhook | Per-feature results, always plural arrays. Absent or null when a feature did not run |
decision_trace, reviews | Decision or webhook | How the status was reached, and any manual review activity |

What is free, what is billed, and where review starts
Nothing in the client library is metered. The JavaScript SDK, the iframe, the redirect flow, the workflow orchestrator, reusable KYC and the MCP server are free on every plan, and sandbox testing is free and unlimited.
Verification steps bill per completed check from prepaid credit. Published list prices on November 26, 2026:
- Full KYC check: $0.33 for the document, biometrics and device checks together.
- ID document only: $0.15. NFC chip reading: $0.15 as an add-on. Active liveness: $0.15.
- AML screening: $0.20. Ongoing AML monitoring: $0.07 per person per year. Proof of address: $0.20. Document AI: $0.20.
- Face search 1:N: $0.05 per search. Email verification: $0.02. Phone verification: from $0.02 plus the carrier's price for the country and channel.
- White label flow: $0.10 per check. Custom questionnaires: $0.10.
Plan credit is added monthly, is spent before top-ups, and does not roll over. Top-ups last 12 months. The pricing documentation lists the billing rules, and pricing.json carries every number in machine-readable form. The modules themselves are described on the user verification product page.
The review boundary is the part teams underestimate. Automated checks move most sessions straight to Approved or Declined. When warnings need a person, the session sits at In Review until a compliance reviewer opens it in the Didit Business Console and approves, declines or requests a resubmission. Your application should hold those sessions in a pending state, not decide them.
Worked cost example
Assume 10,000 new users a month, each running a full KYC check plus AML screening.
Per user: 0.15 + 0.10 + 0.05 + 0.03 = $0.33 for the KYC check. Adding AML at $0.20 gives 0.33 + 0.20 = $0.53 per user.
Monthly list cost: 10,000 x $0.53 = $5,300. The client SDK adds nothing, because SDKs and the workflow orchestrator are free.
On the Growth plan, each Didit price drops 4%: 0.33 x 0.96 = $0.3168 and 0.20 x 0.96 = $0.192, so 0.3168 + 0.192 = $0.5088 per user. 10,000 x $0.5088 = $5,088 of usage. The plan costs $99 a month and includes $115 of credit, which pays the first $115 of that usage, leaving $4,973 to top up, for $5,072 out of pocket in month one.
On the Free plan, $10.00 of monthly credit covers 10 / 0.33 = 30 full KYC checks at list price.
Sources
- Didit web SDK overview, read November 26, 2026
- Didit JavaScript SDK documentation, read November 26, 2026
- Didit InContext iframe documentation, read November 26, 2026
- Didit redirect flow documentation, read November 26, 2026
- Didit API authentication guide, read November 26, 2026
- Didit create session API, read November 26, 2026
- Didit retrieve session decision API, read November 26, 2026
- Didit webhooks documentation, read November 26, 2026
- Didit verification statuses, read November 26, 2026
- Didit sandbox testing guide, read November 26, 2026
- Didit pricing page and pricing.json, live price feed read November 26, 2026
- Didit pricing documentation, read November 26, 2026
- Didit sdk-web-examples repository, read November 26, 2026
- Didit site index for AI agents, read November 26, 2026
Ready to wire it up? Open the sandbox at business.didit.me, create an application, and run your first session with a sandbox key. No sales call, no contract, and the $10 monthly credit on the Free plan covers about 30 full KYC checks when you move to live.
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 a KYC SDK for JavaScript?
A KYC SDK for JavaScript is a client library that runs identity verification steps inside your own web page and returns the outcome to your code. Didit's package is @didit-protocol/sdk-web. It handles session start and event callbacks, while the checks themselves run on Didit's servers.
Do I need a backend to use the Didit JavaScript SDK?
The SDK documentation lists backend integration as optional, but secure production use still requires one. The API key must never be shipped to a browser bundle, so session creation belongs on your server. Your backend is also where you verify webhook signatures and store the decision.
How much does one KYC check cost with the Didit JavaScript SDK?
A completed full KYC check costs $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. AML screening adds $0.20. The SDK itself is free on every plan.
Which JavaScript frameworks does the Didit SDK support?
Didit documents React, Vue, Angular, Next.js, Nuxt, Svelte and vanilla JavaScript, with full TypeScript support. Working examples for each are published in the sdk-web-examples repository on GitHub. The SDK offers both modal and inline modes.
How do I get the verification result in my application?
The SDK's onComplete handler returns a type of completed, cancelled or failed, plus the session id and status. A completed callback can still carry a Declined status, so check the status before granting access. For the compliance record, subscribe to the status.updated webhook or call GET /v3/session/{session_id}/decision/ from your server.
What is the difference between the JavaScript SDK, the iframe and the redirect flow?
The JavaScript SDK gives full programmatic control with real-time event callbacks and stays on your domain. The InContext iframe sets up in under a minute and also stays on your domain, with limited control and postMessage events. The redirect flow is the most compatible and the only one that navigates the user away, which makes it useful when cross-device verification matters.
How do I test a JavaScript KYC integration without paying?
The sandbox is free on every plan and every check inside it is mocked. Sandbox applications accept a sandbox_scenario slug so you can reproduce approvals, declines and review paths on demand. Live keys are rejected for sandbox scenarios, so tests cannot bill you by accident.
What does the In Review status mean for my code?
In Review means automated checks raised warnings that a person must read. A compliance reviewer approves, declines or requests a resubmission in the Didit Business Console. Your application should hold those sessions in a pending state rather than treating them as a pass or a fail.
Can I white label the verification flow?
Yes. The web integration comparison lists white label support for the JavaScript SDK, the iframe and the redirect flow. The white label flow is a published line at $0.10 per check, separate from the verification steps themselves.
Where should I store the Didit API key in a JavaScript app?
In a server-side environment variable such as DIDIT_API_KEY, never in the client bundle or a public repository. The primary key gives full access on behalf of the application. New keys start with sk_live_ or sk_test_, and older keys without a prefix keep working, so never validate a key by its prefix.
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


