Skip to main content

How to Integrate a KYC API Into a Web App

A KYC API turns identity checks into a workflow, one session call and a signed webhook. On Didit a full ID check costs $0.33, the sandbox is free, and your backend creates a session after you configure a workflow and webhook.

How to Integrate a KYC API Into a Web App

Contents

In this guide

Jump to the part you need.

If you're adding identity checks to a web app, start with our hosted verification flow. It fits teams that want a working KYC session without building document capture or liveness models. A full ID check costs $0.33: the ID document, passive liveness, face match and device and IP analysis. The caveat: your API key is a server-side secret, so every call that carries it belongs in your backend, never in browser code.

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

KYC API integration at a glance
StepCall or actionWhat you get
1Sign in at business.didit.me and open Developers, then API keys in the selected application. Or register and then call POST /auth/v2/programmatic/verify-email/A key from the application that issued it
2POST https://verification.didit.me/v3/workflows/ to create a workflow for this onboarding flow, then reuse its ID when creating sessionsworkflow.id
3POST /v3/webhook/destinations/ to register the destination for the endpoint that receives the events, then deploy your handlersecret_shared_key for signature checks
4Create a session for each new verification with POST https://verification.didit.me/v3/session/. Reuse the same stable vendor_data for the same user across sessions.session_id, url, session_token
5Redirect the user to urlA completed verification flow
6Your handler verifies X-Signature-V2 and checks webhook_typeThe status, with a decision object for Approved, Declined, In Review or Abandoned
7GET /v3/session/{session_id}/decision/The full decision with plural feature arrays

What a KYC API does in a web app

One verification session belongs to one user. The hosted flow runs the checks configured in your workflow, and your app acts on the session decision. A full ID check includes document verification, passive liveness, face match, and device and IP analysis. Add AML screening to receive AML results in the same session decision.

The capture steps depend on the workflow you build. Account opening usually runs the full ID check: ID document verification, passive liveness, face match and device and IP analysis. A lower-assurance step can run fewer checks. Our Adaptive Age Verification template, for example, runs a selfie age check with ID as a fallback. One endpoint creates the session, one webhook tells you the outcome, and one GET returns the full decision when a delivery is lost.

We use POST /v3/session/ to create both KYC and KYB sessions. The workflow type determines which kind of session is created, so business verification needs no separate endpoint. Read the business verification quick start when the entity is a company.

Hosted flow or a standalone check

Our hosted flow is the right fit when a person completes steps in a browser or an app and you want one decision at the end. A team needs a documented standalone server-to-server call when a check runs with no end user in the loop, for example screening a name you already hold. The price feed lists those API lines separately, each at its own per-call price.

What you need before you start

  • A Didit account. Sign up at business.didit.me with a work email. The Free plan gives $10 of credit a month to the first eligible organization created for a company domain with an eligible work email, and phone verification codes are excluded from that credit. Sandbox testing is free and unlimited on every plan.
  • An organization and an application. Every key belongs to the application that issued it, and you find the keys under Developers, then API keys, in the console.
  • A backend that can hold a secret, in any stack that can make an HTTPS request.
  • A public webhook endpoint that can receive POST requests. The HTTPS callback that returns the user to your app is optional, and worth adding so the browser lands somewhere sensible. When an application has allowed domains, an HTTP or HTTPS callback must match the configured scheme, host and port of one of those origins.
  • A mapping from our statuses to your own user states. Decide now what Approved, In Review and Declined mean inside your product.

How to integrate a KYC API into a web app

Step 1: Get an API key

Two routes. In the console, open Developers, then API keys in the application you selected, and copy the Primary key or create a scoped key for one service. Programmatically, register and then verify the emailed 6-character code. Substitute your own inbox and the code you receive before you run these commands:

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"}'

The email verification call returns both keys inline. Save response.sandbox_application.api_key as DIDIT_API_KEY while you build, and response.application.api_key as DIDIT_LIVE_API_KEY for production. Confirm in the console whether the application is Sandbox or Live, and read the key from that application. New sandbox keys start with sk_test_ and new live keys start with sk_live_, and older keys can be unprefixed, so never validate a key by its prefix. The sandbox mocks every check, so you build and test without spending credit. An organization created through the API starts at $0, so switch to the live key only when it has credit.

Step 2: Create a verification workflow

A workflow is the list of checks a session runs. Create a workflow for this onboarding flow and reuse its ID when creating sessions. This is the documented example workflow: document verification, passive liveness, face match and AML.

curl -X POST https://verification.didit.me/v3/workflows/ \
-H "x-api-key: $DIDIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"workflow_label": "Standard KYC",
"workflow_type": "kyc",
"features": [
  {"feature": "OCR"},
  {"feature": "LIVENESS", "config": {"face_liveness_method": "PASSIVE"}},
  {"feature": "FACE_MATCH"},
  {"feature": "AML"}
]
}'

Store workflow.id. You can also build the workflow in the console: describe what you need, start from a KYC template, or start empty and add steps. A Simple workflow runs its steps in a fixed order. A node-based workflow branches on results, which is how you send only risky sessions to extra checks. Note what this example does and does not include: it runs AML, and device and IP analysis is not one of its four features.

Step 3: Register the webhook destination and deploy the handler

Register a webhook destination for the endpoint that receives the events, and make sure your handler can receive and verify events before you create your first session. If delivery fails, retrieve the current decision from your backend.

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://myapp.com/api/webhooks/didit",
"subscribed_events": ["status.updated"],
"webhook_version": "v3"
}'

Save the returned secret_shared_key as DIDIT_WEBHOOK_SECRET. There is no wildcard event, so you list each family you want. This tutorial subscribes to status.updated only, because that is the event that carries a session decision. A second destination is allowed if the same events must also reach another system.

Your handler reads the raw body before parsing JSON, then checks these things:

  • X-Timestamp is within 300 seconds of now.
  • Compute the HMAC-SHA256 over sorted, Unicode-preserved canonical JSON using the destination secret configured in your handler. Compare it in constant time against X-Signature-V2 and, when present, X-Signature-V2-Previous. Accept a match against either header. Didit sends the previous header for 24 hours after rotation.
  • webhook_type is status.updated before you touch session state. A destination can carry more event families later, and a user-entity event uses a different enum.
  • event_id has not been processed before.
  • Your handler answers 2xx within 5 seconds. If it is slower, or answers 5xx or 404, we retry twice, after about 1 and 4 minutes, then drop the delivery.

Then apply the session status, which is an exact, case-sensitive string. Note the single capital K in Kyc Expired. The decision object is attached for Approved, Declined, In Review and Abandoned.

Example access rules per session status
StatusWhat it meansExample rule in your app
ApprovedAll checks passed and a decision object is attachedEnable the account and store the decision data
In ReviewAutomated checks raised warnings and a reviewer decidesKeep limited access and show a pending state
DeclinedOne or more checks failed and a decision object is attachedBlock the flow and keep the account restricted
ResubmittedA reviewer asked the user to redo specific stepsSend the user back to the hosted flow
Expired and AbandonedThe link was never opened, or the window ended mid-flowCreate a new session when the user returns

Step 4: Create a session

Create a session for each new verification. Use the same stable vendor_data for the same user across sessions. Replace the placeholder with the workflow UUID from step 2 before you run it:

curl -X POST https://verification.didit.me/v3/session/ \
-H "x-api-key: $DIDIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"workflow_id": "REPLACE_WITH_WORKFLOW_UUID", "vendor_data": "user-42", "callback": "https://myapp.com/kyc/return"}'

The response contains session_id, url and session_token. Keep session_id, because you use it in the decision lookup. Always send vendor_data, your own user identifier. It binds the session to that user and drives duplicate detection across sessions. When allowed domains are configured, an HTTP or HTTPS callback must match a configured origin's scheme, host and port. Custom URL schemes are accepted.

Step 5: Send the user to the hosted flow

Redirect the browser to url, or open it in a native SDK. The user sees the checks in your workflow, in the language you set. We append ?verificationSessionId={session_id}&status={status} to your callback when the flow finishes. Use the callback to show progress in the interface, and use a verified webhook or a server-side decision lookup to change what the account can do.

A hosted Didit KYC flow walking a user through document capture and a selfie check
The hosted flow at the session url runs exactly the checks you put in the workflow.

Step 6: Read the decision when a delivery is lost

Call this when a webhook does not arrive, or when you need the record again later. The key needs the read:sessions privilege, and you pass the session_id from step 4:

curl https://verification.didit.me/v3/session/$SESSION_ID/decision/ \
-H "x-api-key: $DIDIT_API_KEY"

Branch on session_kind first, because one endpoint serves both kinds. V3 returns plural arrays, so read id_verifications[], liveness_checks[], face_matches[] and aml_screenings[]. Never assume the singular V2 fields.

Sandbox acceptance check

Before you switch to a live key, run three cases and confirm what your app shows:

  • A signed approval: your handler accepts the signature and grants access, and the app shows the account as verified.
  • An In Review event: the handler keeps the account limited and shows a pending state, with the decision object stored.
  • A repeated event_id: send the same delivery twice and confirm the second one changes nothing.

Expected output

A finished user session returns a document that starts like this, trimmed to four top-level keys:

{
  "session_id": "SESSION_UUID",
  "session_kind": "user",
  "status": "Approved",
  "vendor_data": "user-42"
}

The per-feature results sit in plural arrays: id_verifications[], liveness_checks[], face_matches[], aml_screenings[], plus ip_analyses[] and the others your workflow runs. When a feature did not run on a session, its field is absent or null, never an empty placeholder. When a reviewer changed the outcome by hand, status_override appears with the automatic status it replaced, and reviews lists the manual review activity.

A verification session overview with its warnings in the Didit Business Console
The console shows the same session you see in the API, including the warnings that move it to In Review.

Inputs and outputs

What you send to a session and what comes back
FieldDirectionNotes
workflow_idInput, requiredStable workflow UUID from POST /v3/workflows/. The workflow type decides KYC or KYB.
vendor_dataInput, recommendedYour user id. Binds the session to the user and is used for duplicate detection.
callbackInput, optionalWhere the hosted flow redirects. When allowed domains are configured, an HTTP or HTTPS callback must match a configured origin's scheme, host and port. Custom URL schemes are accepted.
metadataInput, optionalArbitrary JSON echoed back in responses and webhooks. Never shown to the user.
session_id, url, session_tokenOutput of createSend the user to url. Keep session_id for lookups.
statusOutputExact, case-sensitive string. Branch on it after checking webhook_type.
decision_traceOutputHow the status was reached: automatic, manual or investigator.
Feature arraysOutputAlways plural: id_verifications[], liveness_checks[], face_matches[], aml_screenings[].

Failure cases and recovery

  • 401 on verification.didit.me: the key is wrong, malformed, revoked or expired. Log back in and read the application record to recover it, or issue a new key in the console.
  • 403 on verification.didit.me: no key header, a scoped key without access to that resource, or a call from an address outside the key IP list.
  • 400 on session create: an invalid workflow_id, a callback outside the allowed domains, or a session_expiration_time outside the 3600 to 2419200 second range.
  • 404 on a session route: the session is missing, belongs to another application, or falls outside the key's allowed workflows or statuses. Check the session ID, the application and the key scope.
  • 429: rate limited, and the response carries a wait field in seconds. Back off, then retry.
  • A webhook never arrives: open the destination delivery log and resend when a delivery record exists. If there is no record, check that the subscription includes status.updated, then retrieve the decision directly.
  • The user never finishes: the session moves to Expired if the link was never opened, or Abandoned when the window ends mid-flow. Create a new session rather than reviving an old link.
  • The document expires later: by default, an approved session moves to Kyc Expired when the verified document expires. The Allow expired setting can permit expired documents for the configured country and document type. Apply your re-verification policy when you receive Kyc Expired.

AML screening inside the same KYC API

An AML KYC API does two jobs in one session. It confirms the person is who they claim to be, and it checks that person against sanctions, watchlists and politically exposed person lists. AML screening checks sanctions, watchlists and politically exposed person lists across 1,300+ lists. Results appear in aml_screenings on the session decision. On Didit, AML is a feature in the workflow rather than a second integration, which is why the AML feature sits in the workflow from step 2.

Two services are priced separately. One screening costs $0.20 per completed check. Ongoing AML monitoring is optional, at $0.07 per person a year, and re-screens a customer after onboarding. Whether you need monitoring depends on your applicable requirements and risk policy, so decide that from your own programme rather than from a default.

AML screening results attached to a verification session in the Didit Business Console
AML screening results sit on the same session as the ID and liveness checks, so one decision covers both.

What you pay for, and where a human decides

Billing is per completed check from prepaid credit. The workflow orchestrator, reusable KYC, the SDKs and the MCP server are free, and sandbox checks are mocked. We serve 4,000+ companies.

  • Full ID check: $0.33, which is ID document $0.15, passive liveness $0.10, face match 1:1 $0.05 and device and IP analysis $0.03.
  • AML screening: $0.20 per completed check. Ongoing AML monitoring: $0.07 per person a year.
  • Proof of address: $0.20. NFC chip reading: $0.15 as an add-on. Custom questionnaires: $0.10.
  • Phone verification: the carrier price for the country and channel plus our $0.02 fee per code.
  • Database validation: variable by country. Read the pricing page for the full list.

When In Review appears, a compliance reviewer opens the session in the console and approves, declines or requests a resubmission. That activity is recorded in reviews, and status_override is populated when a reviewer overrides the automatic outcome. A reviewer can request Resubmitted so the user redoes the requested steps.

Worked cost example

Take a web app that onboards 10,000 users a month and runs identity plus one AML screen on every one. Confirm what you are pricing first: the workflow must include document verification, passive liveness, face match and device and IP analysis for the $0.33 full ID check, and you add $0.20 for each completed AML screen. The example workflow in step 2 runs AML but not device and IP analysis, so add that feature before you price it as a full check.

At list prices the bundle is $0.33 + $0.20 = $0.53 per user, so 10,000 x $0.53 = $5,300 a month in gross usage. On the Free plan with the full $10 of monthly credit available, top-ups cover $5,300 - $10 = $5,290.

10,000 completed full ID checks and 10,000 completed AML screenings per month, at list price and on Scale
LineFree plan with full eligible credit available, list priceScale plan, 10% discount
Completed-check usage10,000 x $0.53 = $5,30010,000 x ($0.297 + $0.18) = $4,770
Included plan credit applied$10$350
Subscription fee$0$299
Cash paid$5,300 - $10 = $5,290 in top-ups$4,770 - $350 = $4,420 in top-ups, plus the fee

At monthly Scale rates, 10,000 x ($0.297 + $0.18) = $4,770 in usage. If the full $350 monthly credit is available for these checks, top-ups cover $4,770 - $350 = $4,420. Add the $299 subscription fee for a total of $4,719. Plan credit is spent on usage before any top-up, and unused monthly credit does not roll over.

Volume of completed checks drives the number. If 8,000 users each complete one full ID check and one AML screening, list-price usage is 8,000 x $0.53 = $4,240. The docs also list a few billable exceptions, including some no-match database lookups and retries, so read the billing rules before you model a large volume. The machine-readable price feed carries the same numbers.

A walkthrough of Didit billing with credits, auto-recharge and volume discounts
Didit uses monthly plan credit before prepaid top-ups.

If you are replacing an existing provider, start from didit.me/switch. If you would rather hand the build to a coding agent, use the integration prompt or the MCP server.

Sources

Start in the free sandbox. Copy your sandbox application's API key, configure your webhook, and create your first verification session. Sandbox checks use mocked results, and you can start without a sales call.

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

Alejandro Rosas

Co-founder and CTO

Alejandro Rosas

Alejandro Rosas

Co-founder and CTO

About Didit

Questions

Frequently asked questions

What is a KYC API?

A KYC API is an HTTP interface that runs identity checks and returns a decision your app can act on. Send a workflow_id and, preferably, your stable user identifier as vendor_data. The hosted flow runs the checks configured in your workflow. The API returns the session status and any available results from checks that ran. You write the product logic, not the document capture or the liveness model.

How do I integrate a KYC API into a web app?

Create a workflow, register a webhook destination and deploy your handler, then create a session on your server and redirect the user to the returned url. The signed webhook brings the decision back, and a decision lookup covers a lost delivery. Create a workflow for this onboarding flow and reuse its ID when creating sessions, and register a webhook destination for the endpoint that receives the events. Create a session for each new verification with the same stable vendor_data for the same user. The quick start walks the same path in the console.

How much does a KYC API cost on Didit?

A full ID check is $0.33 and includes the document, passive liveness, face match and device and IP analysis. AML screening is $0.20, so identity plus one screen is $0.53 per user at list price. The Free plan gives $10 of credit a month to the first eligible organization created for a company domain with an eligible work email, and phone verification codes are excluded from that credit. Growth costs $99 a month and discounts Didit charges by 4%, with carrier and Meta charges passed through at cost.

Can I test a KYC API before paying anything?

Yes. Sandbox testing is free and unlimited on every plan and every check is mocked, so no credit is spent while you build. Confirm in the console whether the application is Sandbox or Live, and read each key from that application. New sandbox keys start with sk_test_ and new live keys start with sk_live_, and older keys can be unprefixed, so never validate a key by its prefix. Before switching to the live key, confirm the workflow ID and webhook destination for the live application and make sure the organization has prepaid credit. Remove any sandbox_scenario value from live requests.

What is the difference between a KYC API and an AML KYC API?

KYC establishes who the person is: a real document, a real face, a consistent identity. AML screening checks that identity against sanctions, watchlists and politically exposed person lists across 1,300+ lists. One screening costs $0.20 per completed check, while ongoing monitoring at $0.07 per person a year is a separate, optional service. On Didit, AML screening runs only when the workflow includes it, and then both appear on one decision.

Can I automate approvals without a manual review?

The workflow can approve or decline automatically, and a reviewer handles sessions marked In Review. A node-based workflow lets you add checks only on the paths that need them, so clean sessions clear without a human touch. Warnings that need a person stop the automation at In Review instead of deciding.

How do I automate KYC decisions with webhooks?

Subscribe to status.updated, verify X-Signature-V2 with your destination secret, de-duplicate on event_id, and answer 2xx within 5 seconds. Check that webhook_type is status.updated before you apply a session status, then update your user record from the status in the payload. If you drop a delivery, resend it from the destination delivery log or re-read the decision endpoint.

What happens when a KYC check fails?

Declined means one or more checks failed, and the webhook carries the decision object with the warnings that explain the failure. In Review is different: a reviewer decides. A reviewer can request Resubmitted so the user redoes the requested steps, and we record that activity in reviews, while status_override is populated when a reviewer overrides the automatic outcome.

Should the KYC API call run in the browser?

Requests carrying the Didit API key run on your server, because the key is a long-lived secret that must never reach a browser bundle or a mobile package. The browser opens the hosted url and can receive the session ID and status at the return URL. Use the callback to show progress, and a verified webhook or a server-side decision lookup to change account access.

How long does an integration take?

The first working session takes minutes: one key, one workflow, one webhook destination and one session call. The rest of the effort is product work, mapping statuses to your user states, verifying webhook signatures and deciding where a human review belongs. The public documentation index and the canonical integration prompt cover the details.

How many countries and documents does the Didit KYC API cover?

220+ countries and territories, 14,000+ document types, and capture and UI in 54 languages. Document recognition covers 130+ languages across 50+ scripts.

Does the same API handle businesses and wallet screening?

We use POST /v3/session/ to create both KYC and KYB sessions. The workflow type determines which kind of session is created. Wallet screening is a feature inside transaction monitoring at $0.15 per screening, and you can also bring your own screening provider and run it inside Didit.

Is the API suitable for regulated onboarding?

We have a SOC 2 Type 2 report and hold ISO/IEC 27001:2022 certification. FATF publishes international recommendations on customer due diligence. Which onboarding checks you need depends on the rules that apply to your business and your risk policy.

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.