Skip to main content

Web SDK

JavaScript SDK for web

Add the Didit verification flow to any web app. Install one package and call one method.

$npm install @didit-protocol/sdk-web

Install

Install

Use npm or yarn, or load the script from a CDN.

Package@didit-protocol/sdk-web, on npm.
BuildsESM, CommonJS and UMD.
CDNThe script tag loads the UMD build, so you need no bundler.
TypesTypeScript types are included.
npm install @didit-protocol/sdk-web

Start

Start a verification

Set one callback, then pass the session URL from your server.

Three results

completedThe user finished. Read result.session.status.
cancelledThe user closed the flow.
failedSomething went wrong. Read result.error.message.

The result in the browser is for your screen only. The signed decision reaches your server by webhook.

import { DiditSdk } from '@didit-protocol/sdk-web';DiditSdk.shared.onComplete = (result) => {  switch (result.type) {    case 'completed':      console.log('Status:', result.session?.status);      break;    case 'cancelled':      console.log('Cancelled');      break;    case 'failed':      console.error('Error:', result.error?.message);      break;  }};DiditSdk.shared.startVerification({  url: 'https://verify.didit.me/session/3FaJ9wLqX2Mz'});

Frameworks

Works with your framework

The examples repo has a working app for each one.

Modal and embedded modesTypeScript types includedESM, CJS and UMD buildsDesktop and mobile browsers

It also works with plain JavaScript. Modal mode opens the flow over your page. Embedded mode shows it inline, inside an element you choose.

Questions

Questions about the JavaScript SDK

Which frameworks does the JavaScript SDK work with?
React, Vue, Angular, Next.js, Nuxt, Svelte and plain JavaScript. The examples repo has a working app for six of them.
Do I need a backend to use it?
For production, yes. Your server creates the session and passes its URL to the browser. For a prototype you can pass a verification link from the console instead.
Does my API key go in the browser?
No. The key stays on your server. The SDK only needs the session URL.
How do I get the final result?
The onComplete callback tells your screen what happened. The signed decision reaches your server in a status.updated webhook.
How do I install the Didit JavaScript SDK?
Run npm install @didit-protocol/sdk-web or yarn add @didit-protocol/sdk-web. For pages without a build step, load the UMD build from https://unpkg.com/@didit-protocol/sdk-web/dist/didit-sdk.umd.min.js. The package ships ESM, CommonJS and UMD builds with full TypeScript type definitions.
Can I show the flow inline instead of in a modal?
Yes. Pass configuration with embedded set to true and embeddedContainerId set to the ID of your container element. Embedded mode fills the host element's content box, so give that element an explicit or otherwise resolved height, and resize it when your layout changes.
What errors can the JavaScript SDK report?
A failed result carries an error type of sessionExpired, networkError, cameraAccessDenied or unknown, plus a message. The SDK also reports cancelled when the user closes the modal. Observe onStateChange for the idle, loading, ready and error states to drive your own interface.
Can I track the user's progress step by step?
Yes. Set DiditSdk.shared.onEvent to receive granular events such as didit:started, didit:step_started, didit:step_completed, didit:document_selected, didit:code_sent, didit:status_updated and didit:completed. Steps include document_selection, document_front, document_back, face, email, phone, poa and questionnaire.
Can the selfie step open on the rear camera?
Yes, from SDK version 0.4.0. Set defaultLivenessCamera to 'back' and, for a kiosk, showLivenessCameraSwitchButton to false. defaultDocumentCamera controls the document step. The liveness options apply to the passive liveness check only, and a device without the requested camera keeps the one it has.
How do I check which SDK version is installed?
Your package manager is authoritative: run npm list @didit-protocol/sdk-web, or npm view @didit-protocol/sdk-web version for the latest release. From version 0.3.1 the SDK_VERSION export also matches the installed release; version 0.3.0 and earlier report 0.2.1 there regardless.

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.

  • Trusted by EU regulators

    After a year of supervised testing, EU financial regulators confirmed that verifying with Didit is safer than checking an ID in person.

  • 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.

Start

Install the SDK

Create an account, get your sandbox key and install the package.

Create accountRead the docs

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