Didit Node.js SDK on Cloudflare Workers, Deno and Bun
The Didit Node.js SDK runs on Node.js 18, Bun, Deno and edge runtimes with fetch. An edge runtime such as Workers has no process environment, so you pass the API key to the client as an option, while on Bun a client with no.

Contents
In this guide
Jump to the part you need.
The Didit Node.js SDK, published as @didit-protocol/sdk-node, runs on Node.js 18, Bun, Deno and edge runtimes that have fetch. It fits teams that keep verification calls next to the app on Cloudflare Workers. The caveat is the environment: an edge runtime such as Workers has no process environment, so you pass the API key to the client as an option instead of relying on DIDIT_API_KEY. The SDK is free, and a full KYC check costs $0.33.
Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.
| Question | Answer |
|---|---|
| Package | @didit-protocol/sdk-node, installed with npm install @didit-protocol/sdk-node |
| Supported runtimes | Node.js 18, Bun, Deno, and edge runtimes that have fetch |
| Cloudflare Workers | No process environment, so the API key is passed to the client as an option |
| Node.js and Bun | Read the standard environment variables, so a client with no options is ready to use |
| Auth on the wire | x-api-key header against https://verification.didit.me |
| SDK price | Free. You pay per completed check, $0.33 for a full KYC |
| Sandbox price | Free and unlimited on every plan |
| Cheapest plan to start | Free, with $10 of monthly credit for eligible work email sign-ups |
Start free in the sandbox at business.didit.me, no sales call. Developers who want an AI assistant to drive the same API can connect Didit through the Didit MCP server, hosted at https://mcp.didit.me/mcp with OAuth sign-in, or hand a coding agent the integration prompt. The per-check prices behind every step below live on didit.me/pricing.
What the Node.js SDK gives you on an edge runtime
The server SDKs are our official libraries for your backend. Each one calls the server endpoints with typed requests and responses, verifies the webhooks Didit sends you, and checks the tokens of Didit Authentication. Use them wherever your code holds a Didit API key: creating verification sessions, reading decisions, calling the standalone APIs, managing users, businesses, workflows and cases, screening transactions and wallets, and the Travel Rule.
The Node.js and TypeScript package is @didit-protocol/sdk-node, on npm with source on GitHub. Its minimum runtime row reads Node.js 18, Bun, Deno, edge runtimes with fetch. That row is why this page exists: making an API call does not need a Node-only module, so the package that runs in a Node process also runs inside a Cloudflare Worker. 4,000+ companies run identity and fraud checks on Didit.
One setting changes. Every SDK reads the same environment variables, so a client created with no options is ready to use. Edge runtimes have no process environment, so there you pass the API key to the Node.js client as an option. Anything you can set through the environment you can also pass to the client, along with the base URL, timeout, retries, default headers and your own HTTP client.
The rest of the integration is unchanged: one call creates the session, one call reads the decision, and one webhook destination delivers status changes back to you. Nothing in that list is Node-specific.
Prerequisites
| Requirement | Detail |
|---|---|
| Runtime | Node.js 18, Bun, Deno, or an edge runtime with fetch |
| Package | @didit-protocol/sdk-node from npm |
| Plan | Free includes $10 of credit each month for organizations that sign up with a work email. Growth is $99 a month, Scale $299 a month, Enterprise from $15,000 a year. Sandbox testing is free and unlimited on every plan. |
| Application and key | Create or copy the key in the Business Console under Developers then API keys. New keys start with sk_live_ or sk_test_ followed by 43 URL-safe characters. |
| Workflow id | The UUID of the workflow the session runs, from Workflows in the console or POST /v3/workflows/ |
| Key permissions | The decision endpoint needs read:sessions. A scoped key without access to a resource answers 403. |
| Organization ids | DIDIT_ORGANIZATION_ID and DIDIT_APPLICATION_ID, only for calls under /v3/organization/{organization_id}/application/{application_id}/ |
Three install routes
- npm package, the route this page covers.
npm install @didit-protocol/sdk-nodein a Worker, Deno or Bun project. - MCP connector, for AI assistants. The hosted server at
https://mcp.didit.me/mcpsigns in with OAuth, needs no key in your code, and is free. It is the right route when you want Claude or ChatGPT to call the same API through tools rather than through your source tree. - Integration prompt, for coding agents. One prompt that walks an agent from account creation to a working session and webhook.
Set the SDK up in seven steps
-
Get the API key. Sign in to the Business Console, pick the Application from the dropdown at the top, open Developers then API keys, and copy the Primary key or create a new key for the service. A new key starts with
sk_live_for a live application orsk_test_for a sandbox application. Keys created before this format have no prefix and keep working, so never validate a key by its prefix.The console is optional. Two calls create an organization, a live application and a sandbox application at once:
curl -X POST https://apx.didit.me/auth/v2/programmatic/register/ \ -H "Content-Type: application/json" \ -d '{"email": "you@yourdomain.com", "password": "StrongP@ss1"}' curl -X POST https://apx.didit.me/auth/v2/programmatic/verify-email/ \ -H "Content-Type: application/json" \ -d '{"email": "you@yourdomain.com", "code": "A3K9F2"}' # 200 -> { access_token, organization, application: { api_key, mode: "live" }, # sandbox_application: { api_key, mode: "sandbox" } }Store
sandbox_application.api_keyas your test key. The register endpoint checks the address first, so reserved test domains come back 400 withemail_undeliverable. -
Install the package.
npm install @didit-protocol/sdk-nodeThe documented package is
@didit-protocol/sdk-node, and Deno and Bun are listed as supported runtimes in the SDK's minimum runtime row, so no build step is specific to this article. -
Create the client and pass the key as an option. This is the only line that differs from a Node.js deployment, and it is the one place to follow the Node.js and TypeScript SDK page for the exact constructor and option names. The rule from our docs is short: every SDK reads the same environment variables, so a client created with no options is ready to use on Node.js 18 and Bun, and edge runtimes have no process environment, so there you pass the API key to the client as an option. Deno is listed as a supported runtime. For an edge-style deployment without a process environment, pass the key to the client as an option. The same option route covers the base URL, timeout, retries, default headers and your own HTTP client.
Keep the key in the runtime's secret store. It is a server-side secret: never place it in a browser bundle or a public repository, and remember that keys you create in the console can be scoped to less than the primary key's full access.
-
Create a session.
sessions.createcallsPOST https://verification.didit.me/v3/session/. The workflow type decides what kind of session is created, so a KYC workflow creates a user session and a KYB workflow creates a business session. The documented request looks like this:curl -X POST https://verification.didit.me/v3/session/ \ -H "x-api-key: $DIDIT_API_KEY" \ -H "Content-Type: application/json" \ -d '{"workflow_id": "", "vendor_data": "user-42", "callback": "https://myapp.com/kyc/return"}'workflow_idis required.vendor_datais your stable identifier for the person or business and is strongly recommended, because it binds the session to an entity and is used for duplicate detection.callbackis where the hosted flow returns: Didit appends?verificationSessionId=...andstatus=..., and an http or https callback must sit on one of the application's allowed domains or creation fails with 400.
The hosted flow the session URL opens: your Worker creates it, Didit renders it. -
Read the decision. Path ids are positional arguments, so the client method takes the session id and returns the full decision. The documented API route behind it and the handler pattern both run unchanged on any runtime that has
fetch: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); }Branch on
session_kindfirst, then readstatus. Feature results are always plural arrays:id_verifications,liveness_checks,face_matches,aml_screenings. A feature that did not run is absent or null, never a placeholder.
The same session in the console: status, warnings and the decision trace behind the API response. -
Turn on request logging while you wire it.
DIDIT_LOG=debuglogs the method, path, status, duration and request id of every request. Bodies and headers are never logged. Where there is no process environment, pass the same setting to the client as an option. -
Register the webhook destination and handle the events. One call, then store the secret it returns:
curl -X POST https://verification.didit.me/v3/webhook/destinations/ \ -H "x-api-key: $DIDIT_API_KEY" \ -H "Content-Type: application/json" \ -d '{"label": "Production", "url": "https://app.example.com/didit/webhook", "subscribed_events": ["status.updated", "data.updated", "user.status.updated", "user.data.updated"], "webhook_version": "v3"}'labelandurlare required. Savesecret_shared_keyasDIDIT_WEBHOOK_SECRETand verify theX-Signature-V2header, which is HMAC-SHA256 of the canonical JSON. De-duplicate onevent_idand answer within 5 seconds: a handler that is slower, or that returns 5xx or 404, gets two retries after about 1 and 4 minutes, then the delivery is dropped and can be resent from the destination's delivery log.
Field and event mapping
| Variable | What it enables | On Workers and Deno |
|---|---|---|
DIDIT_API_KEY | Every API key call | Pass it as a client option using the constructor field documented on the Node.js SDK page, in place of the variable the runtime cannot read. |
DIDIT_ORGANIZATION_ID | Calls under /v3/organization/{organization_id}/application/{application_id}/: cases, networks, regulatory reports, report templates, and some user and business tools | Pass it as a client option; the exact constructor field is documented on the Node.js SDK page. The SDK fills both path ids from the client, so you never pass them per call, and without them those calls fail before any request is sent. |
DIDIT_APPLICATION_ID | The same organization routes | Pass it as a client option, next to the organization id. |
DIDIT_LOG=debug | Method, path, status, duration and request id of every request. Bodies and headers are never logged. | Pass the same setting to the client where the runtime has no environment. |
| Base URL, timeout, retries, default headers, your own HTTP client | Everything else the environment can set | Client options on every runtime. |
On Bun, a client created with no options reads the standard environment variables, so passing the key as an option is optional there.
| Stage | Field or event | What it carries |
|---|---|---|
| Create session | workflow_id | Stable workflow UUID. A KYC workflow creates a user session, a KYB workflow creates a business session. |
| Create session | vendor_data | Your identifier for the person or business, used for duplicate detection across sessions. |
| Create session | callback | Return URL for the hosted flow, with the session id and status appended. |
| Create session | sandbox_scenario | Sandbox applications only. Replays a bundled outcome, and is rejected with 400 on live applications. |
| Decision | session_kind | user or business. Always branch on it. |
| Decision | status | Approved, Declined, In Review, In Progress, Not Started, Expired, Abandoned, Kyc Expired, Resubmitted, Awaiting User. |
| Decision | id_verifications, liveness_checks, face_matches, aml_screenings | Always plural arrays, one item per check that ran. |
| Webhook | status.updated, data.updated, user.status.updated, user.data.updated | The four events a v3 destination subscribes to. |

liveness_checks array comes from.Test with sandbox data, then handle the failures
Use a sandbox application and its sk_test_ key. Sandbox testing is free and unlimited, every check is mocked, and the code does not change: only the key and the secret binding do. To force a specific outcome, read the scenario catalog at GET /v1/sandbox/scenarios/ and pass the slug as sandbox_scenario on create, or arm it afterwards with POST /v3/session/{session_id}/sandbox/arm/ while the session is still Not Started.
Expected success looks like this: sessions.create resolves with session_id, url and session_token; opening url runs the flow; sessions.retrieve_decision returns session_kind plus populated arrays and a status. Then the webhook arrives with the same status, and its X-Signature-V2 header verifies against the destination's shared key.
| Symptom | Status and body | Fix |
|---|---|---|
| The key never arrives | 403, {"detail": "You do not have permission to perform this action."} | The option was undefined. Check the secret name the runtime hands to your code: the SDK cannot fall back to a process environment that does not exist. |
| The key is rejected | 401, Authentication credentials were not provided or are invalid. | Wrong, malformed or revoked key. Copy it again under Developers then API keys. |
| The key lacks a scope | 403, This API key has no access to this endpoint. | Use a key with that access. Reading a decision needs read:sessions. |
| Session not found | 404, Session not found. | The session sits outside the key's workflow or status limits, or belongs to another application. |
| Rate limited | 429 with a wait field in seconds | Back off for that many seconds, then retry. |
| No credit | 400 on POST /v3/session/ | Top up the balance, or finish the build in the sandbox, which is free and unlimited. |
| Error on our side | 500, 502 or 503 | Retry with backoff and read code when present. A 500 may carry no JSON body, so branch on the status. |
Disconnect and rotate the key
To rotate, create a new key under Developers then API keys, put it in the runtime's secret store, deploy, then revoke the old key: a revoked key answers 401 like any invalid key. An application you delete answers 403 with application_deleted for a few minutes, and after that its keys are refused like any wrong key, so do not retry that error. If an AI assistant was connected through the MCP connector, remove the connector in that client's settings instead, because it holds an OAuth grant rather than your API key.
What both ends cost
| Side | Item | Price |
|---|---|---|
| Didit | Full ID check: ID document $0.15, passive liveness $0.10, face match 1:1 $0.05, device and IP $0.03 | $0.33 per completed check |
| Didit | AML screening | $0.20 per check |
| Didit | Business verification, priced by country and data tier | From $2.00 per company |
| Didit | Node.js SDK, workflow orchestrator, MCP server | Free |
| Didit | Sandbox testing | Free and unlimited |
| Your edge platform | Requests, CPU time and egress to verification.didit.me | Billed by your platform, not published by Didit |
An illustrative example on list prices, with every assumption stated. A team runs 20,000 full KYC checks a month with AML on every check, and onboards 300 businesses with three key people each:
- KYC: 20,000 x $0.33 = $6,600.00. The unit price is $0.15 + $0.10 + $0.05 + $0.03 = $0.33 per check.
- AML: 20,000 x $0.20 = $4,000.00.
- User subtotal: $6,600.00 + $4,000.00 = $10,600.00, which is $0.53 per person.
- KYB registry, illustrative minimum: 300 x $2.00 = $600.00. This assumes every registry retrieval costs the $2.00 minimum. Business verification is priced by country and data tier, from $2.00 per company, so the real figure is higher wherever a retrieval needs a higher tier.
- Person AML on 900 people: 900 x $0.20 = $180.00. Linked KYC on the same 900: 900 x $0.33 = $297.00.
- Business subtotal, illustrative minimum: $600.00 + $180.00 + $297.00 = $1,077.00.
- Total for the month, illustrative minimum: $10,600.00 + $1,077.00 = $11,677.00.
On Scale every Didit price carries 10% off, so a KYC check is $0.297 and 20,000 checks cost 20,000 x $0.297 = $5,940.00, which is $660.00 less than list on that line alone. The plan fee and the monthly credit that comes with it are listed on the pricing page.
Sources
- Didit docs: Server SDKs overview, the runtime table and the configuration rules
- Didit docs: Node.js and TypeScript SDK
- Didit docs: API authentication
- Didit docs: API keys in the console
- Didit docs: Create Session
- Didit docs: Retrieve Session decision
- Didit docs: API errors, status codes and fixes
- Didit docs: Rate limiting and 429 backoff
- Didit docs: Sandbox testing
- Didit docs: Quick start, webhook destination and subscribed events
- Didit pricing page and pricing as JSON, read November 26, 2026
- Didit MCP server
- Didit integration prompt
- npm: @didit-protocol/sdk-node
- GitHub: sdk-node
Start in the sandbox: create an organization at business.didit.me, copy the sk_test_ key, and run your first session from a Worker, a Deno script or a Bun process. No sales call, and the sandbox is free.
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
Alberto Rosas
Co-founder and CEO

Questions
Frequently asked questions
Does the Didit Node.js SDK run on Cloudflare Workers?
Yes. The minimum runtime for @didit-protocol/sdk-node is Node.js 18, Bun, Deno or an edge runtime with fetch, and Cloudflare Workers provides fetch. The only change is configuration: Workers have no process environment, so the API key goes to the client as an option.
How do I pass the Didit API key on Cloudflare Workers when there is no process.env?
Create the client with the key as an option, taking the value from the Worker's secret store rather than from a process environment. Our docs state the case directly: edge runtimes have no process environment, so the API key is passed to the Node.js client as an option. Keep it server-side, because the primary key has full access to the application while keys you create can be scoped to less.
Does the Didit Node.js SDK work on Deno?
Yes. Deno sits in the SDK's supported runtime row next to Node.js 18, Bun and edge runtimes with fetch. Deno is listed as a supported runtime. For an edge-style deployment without a process environment, pass the key to the client as an option. The calls after that are the same as on Node.js.
Does Bun need the API key passed as an option?
No, although it is allowed. Bun supports the environment variables every SDK reads, so a client created with no options is ready to use there, the same as on Node.js 18. Passing the key as an option also works and keeps one code path across Workers, Deno and Bun.
Which call creates a verification session with the Node.js SDK?
sessions.create, with workflow_id required and vendor_data and callback strongly recommended. It calls POST https://verification.didit.me/v3/session/ and returns session_id, url and session_token. The workflow type decides whether a user or a business session is created, so there is no separate KYB endpoint.
How do I read a decision from the SDK?
sessions.retrieve_decision takes the session id as a positional argument and calls GET /v3/session/{session_id}/decision/. It returns status, session_kind and plural feature arrays such as id_verifications and liveness_checks. Branch on session_kind first, and use a key that holds read:sessions.
Can I use the Didit Node.js SDK in a browser or a mobile app?
No. Server SDKs hold your API key, so they belong on the server. In the browser or a mobile app, use the web and native SDKs instead: they present the verification flow to your user and never hold your API key.
How do I test the integration without spending money?
Use a sandbox application and its sk_test_ key. Sandbox testing is free and unlimited on every plan and every check is mocked, so the same code runs unchanged. Pass sandbox_scenario with a slug from GET /v1/sandbox/scenarios/ to replay a specific outcome, including the failure paths worth testing.
What happens if my webhook handler is slow or returns an error?
If the handler takes longer than 5 seconds, or answers 5xx or 404, Didit retries twice, after about 1 and 4 minutes, then drops the delivery. You can resend it from the destination's delivery log. Verify the X-Signature-V2 header first and de-duplicate on event_id, so a retry does not apply the same decision twice.
What does a full KYC check cost on Didit?
$0.33, made of $0.15 ID document verification, $0.10 passive liveness, $0.05 face match 1:1 and $0.03 device and IP analysis. AML screening is $0.20 on top, so KYC plus AML is $0.53. The Node.js SDK, the workflow orchestrator and the MCP server add nothing to that price.
How do I see what the SDK sends from an edge runtime?
Turn on DIDIT_LOG=debug, or pass the same setting to the client where there is no process environment. The SDK logs the method, path, status, duration and request id of every request, and never logs bodies or headers. That is enough to tell a bad key from a bad workflow id without exposing payloads.
How do I disconnect Didit or rotate the key?
Create a new key under Developers then API keys, deploy it into the runtime's secret store, then revoke the old one: a revoked key answers 401 like any invalid key. If an AI assistant is connected through the MCP connector, remove the connector in that client's settings, since it holds an OAuth grant rather than your API key.
Do I need DIDIT_ORGANIZATION_ID and DIDIT_APPLICATION_ID on Workers?
Only for calls under /v3/organization/{organization_id}/application/{application_id}/, such as cases, networks and regulatory reports. The SDK fills both path ids from the client, so you pass them once as client options rather than on every call. Without them those calls fail before any request is sent.
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


