Skip to main content

Identity Verification in Node.js: A 2026 How-To Guide

Create a verification session from your Node.js backend, send the user to Didit's hosted flow, then read the Approved or Declined decision on your server.

Identity Verification in Node.js: A 2026 How-To Guide

Contents

In this guide

Jump to the part you need.

This guide is for a developer adding identity verification to a Node.js backend. You create a session with the Didit server SDK or the REST API, send the user to the hosted flow, and branch on the decision your server reads. A full KYC check is $0.33, the published list price per completed check before any plan discount. The caveat: the API key stays server-side, and the status in the redirect URL is never the decision.

Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.

The Node.js integration at a glance
PieceValue
RuntimeNode.js 18, Bun, Deno or an edge runtime with fetch
Package@didit-protocol/sdk-node from npm
SecretDIDIT_API_KEY, created under Developers then API keys in the console
Workflowa workflow_id UUID from your Didit application
Create a sessionPOST https://verification.didit.me/v3/session/
Read the decisionGET https://verification.didit.me/v3/session/{session_id}/decision/
Eventsstatus.updated webhook, HMAC-SHA256 signed
Price$0.33 per full KYC check, sandbox free and unlimited

Start free in the sandbox at business.didit.me, no sales call, and test as much as you like. If you build with a coding assistant, connect Didit through the MCP server described at didit.me/developers/mcp.

The outcome and the method we recommend

You finish with three things: a server route that opens a verification session for a user id you already own, a redirect that puts the person in front of the document and the camera, and a server-side branch on the result. The method we recommend is the server SDK on your backend and the hosted flow in the browser. Your API key stays on your server.

A KYC check on Didit is three parts in one session: the ID document at $0.15, biometrics at $0.15 made of passive liveness at $0.10 and face match 1:1 at $0.05, and device and IP analysis at $0.03. Together that is $0.33 per completed check. You add modules to the same workflow when the use case needs them: AML screening at $0.20, proof of address at $0.20, NFC chip reading at $0.15 as an add-on, database validation priced by country. The Identity Verification product page lists what each step does.

What you do not build yourself: OCR and MRZ reading, document forgery detection, liveness models, face comparison and a sanctions list. Coverage behind those steps is 220+ countries and territories, 14,000+ document types, 1,300+ AML and sanctions lists, and 200+ fraud signals on every session. Inference runs at sub-2-second p99, and 4,000+ companies run their checks on this API.

Prerequisites

  • Node.js 18 or newer. The server SDK also runs on Bun, Deno and edge runtimes that provide fetch.
  • A Didit application. Sign in to the Business Console and choose the Application you want to work in from the dropdown at the top.
  • An API key. Open Developers then API keys and copy the Primary key or create one for this service. New keys start with sk_live_ for a live application or sk_test_ for a sandbox application, followed by 43 URL-safe characters.
  • A published workflow and its UUID, which you pass as workflow_id. A KYC workflow creates User Verification sessions and a KYB workflow creates Business Verification sessions. There is no separate KYB endpoint.
  • Credit for live checks. Sandbox testing is free and unlimited on every plan. Live checks are paid per completed check from prepaid credit.

Step by step: verify an identity from a Node.js backend

  1. Install the server SDK.
    npm install @didit-protocol/sdk-node
    The SDK calls the server endpoints with typed requests and responses, verifies the webhooks Didit sends you, and checks the tokens of Didit Authentication. It is a backend library that holds your API key, so it never ships to the browser or a mobile bundle.
  2. Export the key. Set DIDIT_API_KEY in the environment of your server. Every Didit SDK reads the same environment variables, so a client created with no options is ready to use. On an edge runtime there is no process environment, so pass the key to the client as an option. DIDIT_LOG=debug logs the method, path, status, duration and request id of every request, never bodies or headers.
  3. Pick the workflow. Copy the UUID of the published workflow from the console and export it as DIDIT_WORKFLOW_ID. The workflow decides which steps run, so a KYC and a KYB integration share the same code and differ only in this id.
  4. Create the session on the server. The endpoint is POST https://verification.didit.me/v3/session/ with the x-api-key header. With the server SDK the same call is a method on the sessions resource, and a client created with no options already reads DIDIT_API_KEY. The Node.js and TypeScript SDK page shows the current import and the method signatures for your release. The raw request below runs as written, with no SDK: save the file as .mjs or set type: module in package.json so top-level await runs.
    import { randomUUID } from "node:crypto";
    
    const BASE = "https://verification.didit.me";
    const headers = {
      "x-api-key": process.env.DIDIT_API_KEY,
      "Content-Type": "application/json"
    };
    
    const response = await fetch(`${BASE}/v3/session/`, {
      method: "POST",
      headers,
      body: JSON.stringify({
        workflow_id: process.env.DIDIT_WORKFLOW_ID,
        vendor_data: `user-${randomUUID()}`,
        callback: "https://myapp.com/return",
        metadata: { source: "nodejs-guide" }
      })
    });
    
    const session = await response.json();
    console.log(session);
  5. Send the user to the hosted flow. The create response carries the session id and the hosted URL of the session. Redirect the browser to that URL. In a mobile app, use the documented web and native SDKs instead: they present the verification flow to your user and never hold your API key. With callback set, Didit redirects back to your URL and appends ?verificationSessionId={session_id}&status={status}. If your application has allowed domains configured, an http or https callback must sit on one of those origins, otherwise creation fails with 400 on callback. Custom URL schemes such as app deep links are always accepted. Treat the status in that redirect as a signal to re-fetch, not as the result: the authoritative decision is the one your server reads in the next step.
  6. Read the decision on the server. The endpoint is GET https://verification.didit.me/v3/session/{session_id}/decision/ and the key needs the read:sessions privilege. Branch on session_kind first, because the same endpoint answers for KYC and KYB.
    const decisionResponse = await fetch(
      `${BASE}/v3/session/${session.session_id}/decision/`,
      { headers: { "x-api-key": process.env.DIDIT_API_KEY } }
    );
    
    const decision = await decisionResponse.json();
    
    switch (decision.session_kind) {
      case "user":
        console.log(decision.status, decision.id_verifications);
        break;
      case "business":
        console.log(decision.status, decision.registry_checks);
        break;
      default:
        console.log(decision.status);
    }
    With the server SDK the read is client.sessions.retrieve_decision(session_id), which returns the same object.
  7. Subscribe to the webhook. Create a destination for status.updated. Verify X-Signature-V2, an HMAC-SHA256 over the sorted canonical JSON, with your destination secret, reject a timestamp that is more than 300 seconds off, compare in constant time, and return 2xx quickly. The envelope carries session_id, status, vendor_data and the decision object when the status is Approved, Declined, In Review or Abandoned. There is no wildcard, so list every event family you want to receive.
  8. Go live. Keep the sandbox key in DIDIT_API_KEY while you build, then swap in the live key once your organization has credit. Sandbox scenarios reproduce each outcome on demand, so the decline path is testable without a real document.
The hosted verification flow asking the user to scan an identity document
The hosted verification flow guides the user through document capture in the browser. Your Node.js code only creates the session and reads the decision.

What a finished session returns

The decision endpoint returns one object for both session kinds. These are the top-level keys you will branch on, with the feature arrays trimmed.

{
  "session_id": "9b2f7c1e-4a8d-4f3b-9c21-7d5e0a6f8b13",
  "session_kind": "user",
  "session_number": 12,
  "status": "Approved",
  "vendor_data": "user-42",
  "created_at": "2026-11-26T10:12:04Z",
  "expires_at": "2026-11-26T10:32:04Z",
  "id_verifications": [ ... ],
  "liveness_checks": [ ... ],
  "face_matches": [ ... ],
  "aml_screenings": [ ... ],
  "poa_verifications": null,
  "database_validations": null,
  "reviews": [],
  "status_override": null,
  "decision_trace": { "status": "Approved", "decided_by": "automatic", "decided_at": "..." }
}

Read status as an exact, case-sensitive string: Approved, Declined, In Review, In Progress, Not Started, Expired, Abandoned, Kyc Expired, Resubmitted, Awaiting User. Note that Kyc Expired uses a single capital K. Feature arrays are always plural arrays, and a step that did not run comes back absent or null, never as a placeholder. That is how you tell a skipped proof of address from a failed one.

On a user session the useful arrays are id_verifications, liveness_checks, face_matches, nfc_verifications, poa_verifications, database_validations and aml_screenings. On a business session they are registry_checks, document_verifications and key_people_checks. When NFC did not run, the top-level nfc_skip_reason says why, for example USER_SKIPPED or DOCUMENT_WITHOUT_CHIP.

A session in the Didit Business Console showing the ID document step and its result
The same data appears in the Business Console, session by session, which is what your support team reads.

Failure cases and recovery

What breaks in a Node.js integration, and what to do
What you seeCauseRecovery
401 on verification.didit.meThe x-api-key header is wrong, malformed, revoked or expiredFetch a current key, or use one that has not expired. Never validate a key by its prefix
403 with no detailNo key header, a scoped key without access to this resource or action, or a key called from an address outside its IP listUse a key with that access, created under Developers then API keys
403 with application_deletedThe key's application was deletedDo not retry. The application and its keys no longer exist
404 on a session routeThe session does not exist, belongs to another application, or sits outside the scoped key's workflows or statusesUse a key whose limits include that session
403 on the decision routeThe key lacks read:sessionsAdd the privilege or use the application's primary key
429Rate limit, the response carries a wait field in secondsBack off for that many seconds, then retry
400 on callbackThe URL is not on the application's allowed domainsUse an allowed origin, or a custom URL scheme for an app deep link
400 on session_expiration_timeThe value is outside 3600 to 2419200 seconds or is not a whole numberSend a whole number inside the range, or omit the field to use the workflow setting
400 with email_undeliverableProgrammatic registration was sent to a reserved test domain such as @example.comRegister with a real inbox that can receive the 6-character code
Status Expired or AbandonedThe link lapsed or the person left the flowCreate a new session with the same vendor_data, so the history stays on one entity
No webhook arrivesThe destination does not subscribe to status.updated, or the endpoint does not answer 2xxCheck the subscription list, and read the decision eagerly after the redirect as a fallback
Signature mismatchThe body was parsed before verification, or a signing secret was just rotatedVerify the raw body, and accept a match on the -Previous header during a rotation

Inputs and outputs

Fields you send on create, and fields you read back
FieldDirectionWhat it does
workflow_idIn, requiredUUID of the published workflow. KYC workflow makes a user session, KYB workflow makes a business session
vendor_dataIn, recommendedYour stable identifier for the person or company. Binds the session to an entity and feeds duplicate detection
callbackInWhere the hosted flow redirects at the end, with the session id and status appended
metadataInArbitrary JSON echoed back in responses and webhooks, never shown to the user
expected_detailsInFirst name, last name, date of birth, nationality and document types to compare against. Mismatches surface as decision warnings
contact_detailsInEmail and phone that pre-fill the email and phone steps
languageInISO 639-1 code for the verification UI, otherwise the browser language is used
tags and session_expiration_timeInUp to 10 labels of 50 characters for console filtering, and a per-session link lifetime in seconds
session_id and statusOutThe id you persist, and the exact status string you branch on
decision arraysOutPer-step results: documents, liveness, face matches, NFC, AML, phone, email, IP and more
decision_traceOutHow the status was reached, including whether the decision was automatic, manual or taken by the Investigator
linked_recordsOutSame-face, earlier-verification and network summaries for duplicate detection

What you pay, and where a person takes over

Published unit prices for the steps a Node.js integration usually calls
StepPrice (USD)
ID document verification$0.15 per check
Passive liveness$0.10 per check
Face match 1:1$0.05 per check
Device and IP analysis$0.03 per check
Full KYC check, the four lines above$0.33 per check
AML screening$0.20 per check
Ongoing AML monitoring$0.07 per person per year
NFC chip reading, add-on to a document check$0.15 per check
Proof of address$0.20 per check
Business verification (KYB) registry retrieval, priced by country and data tier (Lite, Shareholders, UBOs)Variable, from $2.00 per company where applicable
Person AML for each owner or officer$0.20 per person
Wallet screening, inside Transaction Monitoring$0.15 per screening
Workflow Orchestrator, SDKs, MCP server, reusable KYCFree

Billing is per completed check, from prepaid credit. You pay for a check only when it finishes with a result. Plan credit is added every month and does not roll over, and top-ups last 12 months. The Free plan includes $10.00 of monthly credit for organizations that sign up with a work email, Growth is $99.00 a month with $115.00 of credit and 4% off every price, and Scale is $299.00 a month with $350.00 of credit and 10% off. The full list is on the pricing page.

When a session lands In Review, a person in the Business Console holds it: assignee, waiting_since and sla_due_at tell you who and since when. A status changed by hand appears in status_override with overridden_at and the automatic_status it replaced, and decision_trace.decided_by records manual, automatic or investigator. Those are the review boundaries your support tooling should read, instead of guessing from the status alone.

A session detail page in the Didit Business Console showing the liveness step result
Each paid step has its own result block, so a reviewer sees exactly which check passed or failed.

Worked cost example

Say you onboard 1,000 users a month and run a full KYC check on each of them, then AML screen the same 1,000.

  • List price per KYC check: $0.15 + $0.10 + $0.05 + $0.03 = $0.33. For 1,000 checks: 1,000 x $0.33 = $330.00.
  • On Growth the discount is 4%: $0.33 x 0.96 = $0.3168 per check. 1,000 x $0.3168 = $316.80. The plan's $115.00 of credit pays the first part, so the top-up balance pays $316.80 - $115.00 = $201.80.
  • AML screening on the same 1,000: 1,000 x $0.20 = $200.00 at list, or 1,000 x $0.192 = $192.00 on Growth.
  • Compliance total on Growth: $316.80 + $192.00 = $508.80, less the $115.00 of credit = $393.80 from the top-up balance, plus the $99.00 monthly fee.

The sandbox costs nothing while you build, so the first bill only appears when you switch to the live key.

Find a company and verify a business from the same endpoint

There is no separate KYB endpoint. Create a session with a KYB workflow and you get a Business Verification session back. To pre-fill the registry search, send expected_details with company_name, registry_country as an ISO 3166-1 alpha-2 code, which can include a state for state-level registries such as US-CA, and registration_number. Person-level fields are ignored on a KYB session.

The decision comes back with session_kind set to business, plus registry_checks covering the company, its officers, its beneficial owners and the ownership structure, and key_people_checks for the people you submitted. Registry retrieval is not one flat price: it is billed by country and by data tier, Lite, Shareholders or UBOs, starting from $2.00 per company where applicable, so the figure for a given company depends on its registry and the tier you need. Each owner or officer takes a linked full ID check at $0.33 and person AML at $0.20. The Business Verification product page covers the flow.

Registry search results for a company name, with the matching company ready to be picked
Finding the company in the registry is a step in the same session, not a separate integration.

Sources

Next step: create a sandbox application at business.didit.me, copy the sk_test_ key, and run the two snippets above against your own workflow. No sales call is needed, and the sandbox stays free while you build.

Try it

Try this in the sandbox

Run the check this guide describes, free.

ID Verification

The product this post is about, taken from its topic. Run it free in the sandbox.

$0.15 per checkStart free

Author

Alberto Rosas

Co-founder and CEO

Alberto Rosas

Alberto Rosas

Co-founder and CEO

About Didit

Questions

Frequently asked questions

How do I add identity verification to a Node.js app?

Install the Didit server SDK, create a verification session on the server with your workflow_id, redirect the user to the hosted flow, then read the decision from your backend. Didit runs the document, biometric and device checks, so you write request and response code rather than OCR or liveness code. A full KYC check is $0.33 at the published list price per completed check, before any plan discount.

Which npm package do I install for Didit in Node.js?

The package is @didit-protocol/sdk-node, installed with npm install @didit-protocol/sdk-node. It runs on Node.js 18, Bun, Deno and edge runtimes that provide fetch, returns typed requests and responses, and verifies Didit webhooks. It is a server library that holds your API key, so in the browser you use the web or native SDKs instead.

How much does one identity check cost?

A full KYC check is $0.33: 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. Adding AML screening makes it $0.53. The sandbox is free and unlimited, and the Free plan includes $10.00 of monthly credit for organizations that sign up with a work email.

Can I test identity verification without paying or talking to sales?

Yes. Sign up at business.didit.me, create a sandbox application, and use its sk_test_ key. Sandbox testing is free and unlimited, with every check mocked, so no real documents and no billing are involved. You only need a live key and credit when you go to production.

Where do I get the workflow_id?

Open your application in the Business Console and copy the UUID of a published workflow. A KYC workflow creates User Verification sessions and a KYB workflow creates Business Verification sessions from the same endpoint. A session cannot be created without a published workflow, so check that the workflow is published before you debug anything else.

Should I trust the status in the callback URL?

No. The callback is a browser redirect that carries verificationSessionId and status, and it only tells you the person came back to your page. Treat that status as a signal to re-fetch, then read the authoritative result from GET /v3/session/{session_id}/decision/ or the signed status.updated webhook. Branch on those, never on the query string.

How do I test a declined verification in the sandbox?

Pass a sandbox_scenario when you create the session, using a slug from the sandbox catalog at GET /v1/sandbox/scenarios/, and the session reproduces that outcome. You can also arm or re-arm a scenario after create with POST /v3/session/{session_id}/sandbox/arm/ while the session is still Not Started. The field is rejected with 400 on live applications.

Should I use validator.js to validate identity cards?

No. A library like validator.js checks string formats such as emails and numbers, and an identity card is not a string format: the document has to be read, its security features examined and its portrait compared with a live face. Use format checks on your own form fields, then send the document to an ID verification step. If you want to catch typos early, validate the ISO codes in expected_details before you create the session.

What does the decision return for a KYC session?

One object with session_id, session_kind set to user, the exact status string, and plural feature arrays for the steps that ran: id_verifications, liveness_checks, face_matches, nfc_verifications, poa_verifications, aml_screenings and others. A step that did not run is absent or null. The object also carries decision_trace, so you can see how the status was reached.

What happens when a session goes to manual review?

The status becomes In Review and a reviewer in the Business Console takes the case, exposed as assignee, waiting_since and sla_due_at. Their change appears in status_override with the automatic status it replaced, and decision_trace.decided_by records a manual decision. The Investigator agent is part of the Growth plan and above.

How do I keep the API key safe in an Express or Next.js app?

Keep the key in server-side environment variables and call the API only from server code, such as a route handler or a server action. Never put it in a client bundle, a public repository or a mobile app. Create separate scoped keys for each service so a leak can be revoked without breaking the others.

Does the Didit decision cover TypeScript types?

Yes. The Node.js SDK is written for Node.js and TypeScript, and it returns typed requests and responses, so decision fields are typed in your editor. The same package verifies webhook signatures and checks Didit Authentication tokens, which keeps hand-written parsing out of your code.

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.

Compliance assistant

Your obligations · 3 regions

EU · AMLRCustomer due diligence, human reviewCovered
Illinois, Texas, ColoradoExplicit biometric consentCovered
Germany · Youth protectionVerified adults only (JMStV)Covered
Workflow checked. Every obligation is met
  • 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.

Add to ClaudeChatGPT
Didit Academy · Lesson 04 · Use Didit with MCP
  • 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.

Verify your first user today.

Start free

Free sandbox. Credit applies to work-email sign-ups.