Liveness Detection in Your Browser: Didit JS SDK Guide
Use Didit's JavaScript SDK to run passive liveness ($0.10 a check) or 3D active liveness ($0.15) inside your own web page; the method is set on the workflow, not in the SDK call, and the standalone passive liveness API is $0.10.

Contents
In this guide
Jump to the part you need.
This guide is for web developers who need a liveness check inside a browser page, not a native app. With the Didit JavaScript SDK you mount the session URL that POST /v3/session/ returns, the workflow runs passive liveness at $0.10 per check or active liveness at $0.15, and you read one decision payload. The caveat: the liveness method is chosen on the workflow, not in the SDK call.
Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.
| Item | Detail |
|---|---|
| Integration method | JavaScript SDK, package @didit-protocol/sdk-web. Iframe and redirect alternatives exist |
| Setup time | 3 minutes, per the docs comparison table |
| Backend required | Optional for the SDK. A backend is where the API key that creates sessions belongs |
| Liveness methods | Passive Liveness, 3D Flash, 3D Action & Flash |
| Price, passive liveness in a workflow | $0.10 per check |
| Price, active liveness in a workflow | $0.15 per check |
| Price, standalone passive liveness API | $0.10 per call |
| Price, full ID check that includes liveness | $0.33 bundle total (ID $0.15 + passive liveness $0.10 + face match $0.05 + device and IP $0.03) |
| Cost to test | Sandbox testing is free and unlimited. Eligible Free organizations that sign up with a work email receive $10 of monthly credit; phone verification is excluded |
| Where the result lands | liveness_checks[] on GET /v3/session/{session_id}/decision/, plus webhooks |
| Accuracy stated by Didit | 99.9% accuracy, false acceptance rate under 0.1%, iBeta Level 1 PAD |
Start free in the sandbox at https://business.didit.me/, no sales call. Developers who want an AI assistant to scaffold the integration can connect Didit through https://didit.me/developers/mcp/. Every module price sits on https://didit.me/pricing/, and the liveness reference lives at docs.didit.me/core-technology/liveness/overview.
What you get, and the method we recommend
The outcome is a page on your own domain where a user completes a liveness challenge in the browser, and your application receives a signed decision with a status, a method name, a score and a list of risk warnings. The SDK mounts the hosted session URL and reports the flow's events back to your page; the capture screens themselves are served by Didit, so the liveness step is not a screen you build or maintain.
For a production web app we recommend the JavaScript SDK. The web SDK overview lists seven integration methods and names the JavaScript SDK as the pick for full programmatic control, with React, Vue, Angular, Next.js, Nuxt, Svelte and vanilla JavaScript support, full TypeScript types, modal and inline modes, and event callbacks. Use the InContext iframe when you want the shortest setup, and Redirect when the flow has to survive a device switch or a browser that blocks camera access in an iframe.
All three browser methods deliver the final, signed result through webhooks. The difference between them is the in-browser experience, not how you receive the decision.
Which liveness method to run, including 3D liveness detection
Didit documents three anti-spoofing methods. They differ in how much the user has to do and how hard the method is to spoof. The workflow decides which one runs.
| Method | What happens in the browser | Security level | Best for |
|---|---|---|---|
| Passive Liveness | A single frame is analysed for artefacts, texture and screen or print signatures. The user just looks at the camera | Standard | Low-risk sign-up and re-verification |
| 3D Flash | Light patterns are projected at over 30 frames per second and the reflections are turned into a depth map, with no user action | High | Financial services, account access, general identity verification |
| 3D Action & Flash | A randomized action such as blinking or nodding runs at the same time as the light pattern analysis, combining behavioural and depth cues | Highest | Banking, healthcare, government flows |
If your question is whether a 3D liveness detection SDK can run in a browser: yes. The 3D methods are the two flash-based ones above, and they run inside the same hosted session the JavaScript SDK mounts. You select one on the workflow with the face_liveness_method field, which takes PASSIVE, ACTIVE_3D or FLASHING, in the Business Console or through POST /v3/workflows/. Pricing follows the method: passive liveness is $0.10 per check and active liveness is $0.15 per check.
Prerequisites
- A Didit organization and an application. Sandbox testing is free and unlimited.
- An API key for the application. Keep it on the server: it creates sessions and reads decisions.
- A workflow with the liveness feature enabled, and the liveness method you want set on it.
- Node and a bundler, or a plain script tag, for the
@didit-protocol/sdk-webpackage. - A page served over HTTPS, because browsers only grant camera access to a secure origin.
- Optional: a backend endpoint that creates the session and returns the session URL to the page.
Two routes: the hosted session SDK and the standalone passive liveness API
The JavaScript SDK route runs a hosted Didit session. Your server calls POST /v3/session/, the SDK mounts the session URL that comes back, and the workflow decides which liveness method runs: passive, 3D Flash or 3D Action & Flash. That route can carry a document check, face match, AML screening and any other step you put in the workflow.
The standalone POST /v3/passive-liveness/ endpoint is a server-to-server call that takes one image you already captured and returns a liveness verdict for it. It is passive only: no 3D methods, no hosted flow, no document step. Use it when the capture happens outside a Didit session, for example a selfie your own app already stores. The hosted workflow and the standalone endpoint are billed as separate lines, both at $0.10 per passive liveness check. The snippets below show both.
Step by step: add liveness to a browser page
Create the workflow and pick the liveness method. In the Business Console, or with
POST /v3/workflows/, setface_liveness_methodtoPASSIVE,ACTIVE_3DorFLASHING. The workflow is what the SDK session runs, so this is the only place the method is chosen.Install the SDK. Add
@didit-protocol/sdk-webto your project. The SDK web examples repository has React, Vue, Angular, Next.js, Nuxt, Svelte and vanilla versions of the same flow.Create a session on your server. Send
workflow_id, your stablevendor_dataand acallback. The response carries the session URL the SDK will mount.curl -X POST 'https://verification.didit.me/v3/session/' \ -H 'x-api-key: YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "workflow_id": "YOUR_WORKFLOW_UUID", "vendor_data": "user-123", "callback": "https://app.example.com/verification/done" }'The full field list is on Create Session API. If the application has allowed domains configured, an http or https callback has to be on one of those origins or creation fails with a 400 on
callback.Mount the SDK and start verification. Set
onCompletefirst, then callstartVerificationwith theurlyour server returned.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; } }; DiditSdk.shared.startVerification({ url: 'https://verify.didit.me/session/3FaJ9wLqX2Mz' });The
onCompletecallback is a user-interface signal. Treat the session decision as the source of truth.Fetch the decision. Read the session on your server and branch on
session_kindfirst, then onliveness_checks[].curl https://verification.didit.me/v3/session/<SESSION_ID>/decision/ \ -H "x-api-key: <API_KEY>"Details on Retrieve Session API. The same decision also arrives through a
status.updatedwebhook. Thestatus.updatedevent delivers the decision.Or check a selfie you already captured. If your flow grabs the image itself, skip the session entirely and call the standalone endpoint, which is passive only.
curl -X POST 'https://verification.didit.me/v3/passive-liveness/' \ -H 'x-api-key: YOUR_API_KEY' \ -F 'user_image=@./selfie.jpg' \ -F 'save_api_request=true' \ -F 'vendor_data=user-123'The response is
{ request_id, liveness: { status, method, score, warnings, face_quality, face_luminance } }. Accepted formats are jpg, jpeg, png, tiff and webp, maximum 5 MB. See Passive Liveness API.Act on the result. Approve on
Approved, refuse onDeclinedwithLIVENESS_FACE_ATTACK, and routeIn Reviewto a human. The warning catalogue is on Liveness warnings.


Expected output
An abbreviated decision, cut to the fields a liveness integration acts on. The values below are examples, not a captured result:
{
"session_id": "0b0f0a52-1c1d-4a53-9f0a-7a1f2b9c1d34",
"session_kind": "user",
"status": "Approved",
"liveness_checks": [
{
"status": "Approved",
"method": "PASSIVE",
"score": 96,
"warnings": [],
"face_quality": 88,
"face_luminance": 71
}
]
}
Feature arrays in the v3 contract are always plural arrays. If the workflow did not run liveness, liveness_checks is absent or null, never a placeholder object.

liveness_checks entry, rendered in the Business Console session detail.Failure cases and recovery
| Status or error | Cause | Recovery |
|---|---|---|
| HTTP 403 | Out of credits on a live application | Top up, or turn on auto top-up so live checks do not stop |
HTTP 400 on user_image | Missing image, file over 5 MB, or an extension outside jpg, jpeg, png, tiff, webp. PDFs are rejected | Re-encode the capture and resend |
HTTP 400 on callback | The callback URL is not on the application's allowed domains | Use an allowed origin, or a custom URL scheme such as an app deep link |
| HTTP 401 | Invalid API key on a read call | Use the key for the right application. The passive liveness endpoint answers 403 rather than 401 |
| HTTP 403 on the decision | The key lacks the read:sessions privilege | Re-scope the key |
| HTTP 404 on the decision | Unknown session ID, or the session belongs to another application | Check the ID you stored against the create response |
| HTTP 429 | More than 300 write requests a minute on one API key | Back off and retry |
Declined with LIVENESS_FACE_ATTACK | The model detected a presentation attack | Do not approve. Offer a retry or send to manual review per your policy |
Declined with LOW_LIVENESS_SCORE | Score at or below face_liveness_score_decline_threshold, whose documented default is 30 | Retry in better light with a single, well-framed face |
NO_FACE_DETECTED or MULTIPLE_FACES_DETECTED | No face, or more than one face, in frame | Ask for a retry with a single, well-framed face |
FACE_IN_BLOCKLIST or DUPLICATED_FACE | The face matches your blocklist, or an earlier approved session | Block, or route to review, as your policy requires |
cancelled in onComplete | The user closed the flow | Create a fresh session when the user is ready to try again |
The sandbox is free on every plan, and it behaves differently by route. On the standalone passive liveness API, a sandbox API key skips processing and billing: after request validation (malformed input still returns a 400) the call returns a static Approved mock payload, no session is persisted and no credits are consumed. The session sandbox is the other way round: a sandbox session runs a scenario from the sandbox catalogue through sandbox_scenario, so you get deterministic outcomes that include declines and review states. See sandbox test data and scenarios.
Inputs and outputs
| Field | Direction | Notes |
|---|---|---|
workflow_id | Input, required | Workflow UUID. It carries the liveness method in face_liveness_method |
vendor_data | Input, recommended | Your stable user ID. Binds the session to an entity and feeds duplicate detection |
callback | Input, optional | Where the hosted flow sends the user afterwards. Didit appends verificationSessionId and status |
metadata, tags, language | Input, optional | Echoed data, console filters, and the ISO 639-1 language of the verification UI |
user_image | Input, standalone API | One face image, jpg, jpeg, png, tiff or webp, maximum 5 MB. PDFs are rejected |
save_api_request | Input, standalone API | Defaults to true: the call is stored as an API-type session and the face is enrolled. Set false for a one-shot check |
url | Input to the SDK | The session URL from the create response, or your UniLink |
result.type | Output, browser | completed, cancelled or failed |
decision.status | Output, server | Approved, Declined, In Review, In Progress, Not Started, Expired, Abandoned, Kyc Expired, Resubmitted, Awaiting User |
liveness_checks[].status | Output, server | Not Started, In Progress, Approved, In Review, Declined, Abandoned, Kyc Expired |
liveness_checks[].method | Output, server | The method that ran |
liveness_checks[].score | Output, server | Confidence of the liveness model, 0 to 100 |
liveness_checks[].warnings | Output, server | Risk codes such as LOW_LIVENESS_SCORE or POSSIBLE_DUPLICATED_FACE |
liveness_checks[].face_quality, face_luminance | Output, server | Capture quality signals, 0 to 100, nullable |
biometric_retention.deletes_at | Output, server | The date the live biometric data of that session is deleted |

What is billable, and where review starts
You pay per completed check, from prepaid credit. Inside a workflow, passive liveness is $0.10 per check and active liveness is $0.15. The standalone passive liveness endpoint is its own line at $0.10 per call. The $0.33 full ID check is a bundle total, not a liveness price: ID document $0.15 + passive liveness $0.10 + face match $0.05 + device and IP analysis $0.03, billed once per completed check. When liveness runs as its own workflow step or through the standalone API, only the liveness price applies, and the document, face match and device and IP lines are billed separately if you run them. Face Search at $0.05 per search and ID Verification at $0.15 are separate lines too. Plan credit is added monthly and does not roll over; top-ups last 12 months. The full price list with the Growth and Scale discounts is on https://didit.me/pricing/.
Nothing in the sandbox is charged. Sandbox testing is free and unlimited, and a sandbox key never consumes credits.
Review is a boundary you should design for, not a fallback. A session can land in In Review, and the decision payload then carries reviews[] with the manual activity, assignee, waiting_since and sla_due_at, plus decision_trace whose decided_by is manual, automatic or investigator. A reviewer can change the outcome by hand, which appears as status_override with the original automatic_status alongside it. Decide in advance which warning codes you accept automatically, which you decline, and which you send to a person.
Worked cost example
Take an application that runs 12,000 full ID checks a month inside a workflow that uses passive liveness, at Free plan list prices.
- Full ID check bundle: 12,000 x $0.33 = $3,960.00.
- The liveness line inside that total: 12,000 x $0.10 = $1,200.00.
- Check the arithmetic on the bundle: ID $0.15 + passive liveness $0.10 + face match $0.05 + device and IP $0.03 = $0.33.
- Liveness on its own, through a liveness-only workflow step or the standalone passive liveness API: 12,000 x $0.10 = $1,200.00.
- Free plan credit covers $10.00 / $0.10 = 100 passive liveness checks before top-ups are needed.
- Same volume on Growth, which takes 4% off every price: 12,000 x $0.3168 = $3,801.60, plus the $99 monthly fee.
- Switching the workflow to 3D active liveness at $0.15 changes the liveness line to 12,000 x $0.15 = $1,800.00.
One product detail that keeps the bill honest: the liveness method lives on the workflow, so a change of method is a workflow change, not a code change, and the price moves with it.
Sources
- Didit docs: Web Identity Verification SDKs, JS and iframe
- Didit docs: Liveness Detection overview
- Didit docs: Passive Liveness API
- Didit docs: Create Session API
- Didit docs: Retrieve Session API
- Didit docs: Data models
- Didit docs: Liveness warnings catalogue
- Didit docs: Webhooks
- Didit docs: Sandbox test data and scenarios
- Didit docs: Pricing and billing rules
- Didit pricing page, prices read November 26, 2026
- Didit SDK web examples repository
- Didit MCP server setup
Next step: create a free sandbox application at https://business.didit.me/, set the liveness method on a workflow, and run the snippet above against a test session. No sales call, and nothing in the sandbox is billed.
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
How much does liveness detection cost with the Didit JavaScript SDK?
Inside a workflow, passive liveness costs $0.10 per check and active liveness costs $0.15 per check. The standalone passive liveness endpoint costs $0.10 per call. Eligible Free organizations that sign up with a work email receive $10 of monthly credit, and sandbox testing is free and unlimited.
Does Didit have a 3D liveness detection SDK for browsers?
Yes. The JavaScript SDK runs the hosted session in the browser, and the workflow can be set to the 3D methods: 3D Flash, which builds a depth map from light patterns at over 30 frames per second, and 3D Action & Flash, which adds a randomized action such as blinking or nodding. The workflow field face_liveness_method takes PASSIVE, ACTIVE_3D or FLASHING.
Do I need a backend to use the Didit JS SDK?
No. The docs list the backend as optional for the JavaScript SDK, and a UniLink can be mounted without one. You do need a server for anything that uses your API key, such as creating sessions and reading decisions, because the key must not ship to the browser.
What does a Didit liveness report contain?
Each entry in liveness_checks[] carries a status, the method that ran, a score from 0 to 100, an array of warning codes, and face_quality and face_luminance values. The same payload includes decision_trace and biometric_retention.deletes_at. The schema is documented on data models.
What happens when the liveness check detects an attack?
The liveness status becomes Declined with the warning LIVENESS_FACE_ATTACK. A low score produces Declined with LOW_LIVENESS_SCORE when the score is at or below face_liveness_score_decline_threshold, whose documented default is 30. Neither case should be approved automatically.
Can I test browser liveness without paying?
Yes. Create a sandbox application at https://business.didit.me/; sandbox testing is free and unlimited and nothing in the sandbox is billed. On the standalone passive liveness API a sandbox key returns a static Approved mock payload after validation, while the session sandbox runs the scenario you choose, so you get deterministic outcomes that include declines.
Which integrations exist besides the JavaScript SDK?
Didit documents seven web methods: the JavaScript SDK, the InContext iframe, Redirect, WebView for iOS and Android, and no-code plugins for WordPress and WooCommerce, Shopify, and Salesforce. All browser methods deliver the final signed result through webhooks.
Should I poll for the liveness result or use a webhook?
Use a webhook in production. The status.updated event delivers the decision, and GET /v3/session/{session_id}/decision/ gives you the same payload on demand for reconciliation or for a user who revisits the page. The browser callback only tells you the flow finished.
Can I tune how strict passive liveness is?
The standalone passive liveness endpoint declines when the liveness score is at or below face_liveness_score_decline_threshold, and the documented default is 30. That field is the threshold control the docs describe for this endpoint, so check the Passive Liveness API reference for the current value before you change it. A stricter threshold cuts false accepts and raises retries, so test it against your own samples first.
How accurate is Didit liveness detection?
Didit states 99.9% accuracy with a false acceptance rate under 0.1%, and holds iBeta Level 1 PAD. Accuracy claims are only meaningful against your own population, so use the documented sandbox scenarios to test your integration before setting a threshold.
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


