Skip to main content

Restrict Didit ID Verification to Passport or National ID

Send expected document types (P, ID, DL, RP, HIC, TC, SSC) inside the expected details object when you create a Didit session. The hosted flow's document picker shows only those types; unknown values return 400.

Restrict Didit ID Verification to Passport or National ID

Contents

In this guide

Jump to the part you need.

Restricting a Didit ID check to a passport or a national ID is one field on the session you create: expected_details.expected_document_types. Send ["P","ID"] and the document picker in the hosted flow offers those two types. It fits teams that must collect one specific document for a market, or that cannot accept a driver's licence. The ID check costs $0.15 per completed check and the restriction adds nothing to that price. The caveat: it narrows one session, not the whole workflow.

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

Session fields and workflow settings that control which document a person can submit
FieldSet onAccepted valuesEffect
expected_document_typesexpected_details on POST /v3/session/P, ID, DL, RP, HIC, TC, SSC. Case-insensitive, deduplicatedNarrows the document picker in the hosted flow for that session
id_countryexpected_detailsISO-3 country code, for example ESPRecorded as an expectation; a document from another country surfaces as a decision warning
nationalityexpected_detailsISO-3 country codeChecked the same way; a mismatch becomes a decision warning
documents_allowedID Verification feature config on the workflowPer country, via the console Countries tab or the Management APIControls the accepted types for every session on that workflow; a disallowed type can end in DOCUMENT_TYPE_NOT_ALLOWED

Start free in the sandbox at business.didit.me (no sales call) and create a test session with ["P","ID"] before you change production. Developers connecting Didit to an AI assistant can use the hosted MCP server at didit.me/developers/mcp. The documentation for the check is the ID Verification overview and every unit price is on didit.me/pricing.

What expected_document_types does, and what it does not do

Didit ID Verification reads 14,000+ document types across 220+ countries. Without guidance, the hosted flow lets the person pick the issuing country and the document type they hold. expected_document_types narrows that picker for one session, so a person who holds only a passport is not offered a driver's licence.

What it changes:

  • The document selection screen in the hosted flow lists only the types you name.
  • The value comes back in the decision under expected_details, so your own records show what you asked for.
  • A submitted document that does not match your expectation surfaces as a decision warning instead of passing quietly.

What it does not do:

  • It does not change the price. An ID document check is $0.15 whether you allow one type or seven.
  • It does not persist. It applies to the single session you create with it; the next session without the field is unrestricted again.
  • It is not a workflow-wide block. Enforcement for every session is set on the workflow's ID Verification feature, covered further down.
Didit Business Console: session detail id document
Didit Business Console: session detail id document

Prerequisites

  • A Didit organization and an API key, sent on each call as the x-api-key header. See API authentication.
  • A workflow with ID Verification enabled. The canonical feature enum is ID_VERIFICATION; OCR is the legacy alias.
  • The workflow UUID, described in the docs as the stable UUID from /v3/workflows/. KYC workflows create User Verification sessions.
  • A server that can send the create call and later read GET /v3/session/{session_id}/decision/ with a key holding read:sessions.
A session overview with its warnings in the Didit Business Console.
A session overview with its warnings in the Didit Business Console.

Steps to restrict the document types

  1. Decide where the control lives. Session level if the requirement differs per applicant or per market campaign. Workflow level if the rule must hold for every applicant on that flow.
  2. Map your requirement to Didit codes. P is a passport, ID a national identity card, DL a driver's licence, RP a residence permit. The set also includes HIC, TC and SSC. Values are case-insensitive and duplicates are removed, so ["p","P","ID"] is treated as ["P","ID"]. The full set is listed in the Create Session API reference.
  3. Create the session with the field inside expected_details. The field belongs to the expected_details object, next to id_country and nationality.
  4. Send the user to the returned session_url. Open it in the browser or mount the Web or Mobile SDK. The document picker now lists only your requested types.
  5. Read the result. Call the decision endpoint on session.status.updated or after the redirect, and branch on session_kind before you read the feature arrays.
  6. Audit the session. Confirm expected_details on the decision matches what you sent, and read warnings on each entry of id_verifications.

A runnable example

Passport or national ID only, for a Spanish document, on an existing KYC workflow:

curl -X POST 'https://verification.didit.me/v3/session/' \
  -H 'x-api-key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "workflow_id": "WORKFLOW_UUID",
    "vendor_data": "user-1234",
    "callback": "https://app.example.com/kyc/done",
    "language": "es",
    "expected_details": {
      "id_country": "ESP",
      "nationality": "ESP",
      "expected_document_types": ["P", "ID"]
    }
  }'

Then fetch the decision when the session finishes:

curl 'https://verification.didit.me/v3/session/SESSION_ID/decision/' \
  -H 'x-api-key: YOUR_API_KEY'

Two details from the create reference matter here. vendor_data binds the session to your own user record and is used for duplicate detection across sessions. callback must sit on one of the application's allowed domains when the application has an allow-list, otherwise creation fails with a 400 on callback; custom URL schemes such as app deep links are always accepted.

Expected output

The create call returns the session handle. Field names are the documented ones:

{
  "session_id": "<uuid>",
  "session_url": "<hosted URL to open for the user>",
  "status": "Not Started"
}

The decision echoes your expectation and carries the per-document result. Trimmed to the fields you need for this control:

{
  "session_kind": "user",
  "status": "Approved",
  "expected_details": {
    "id_country": "ESP",
    "nationality": "ESP",
    "expected_document_types": ["P", "ID"]
  },
  "id_verifications": [
    { "status": "Approved", "warnings": [] }
  ]
}

Read the status first, then warnings. A non-empty warnings array with a terminal code means the document did not clear the check even though its type was allowed.

Failure cases and recovery

What goes wrong when you set the document restriction
SymptomCauseRecovery
400 on session createAn unknown value in expected_document_types, for example "PASSPORT" instead of "P"Use a code from the allowed set and retry. No check ran, so nothing was billed
400 on callbackThe URL is not on the application's allowed domainsUse an allowed origin or an app deep link
400 with a credits message on POST /v3/session/Balance cannot cover the checkTop up at business.didit.me, then retry
401Key is wrong, malformed, revoked or expiredCheck the key, or create a new one
403Key has no access to this resource, or was used from outside its IP listRead the body, fix the key scope or IP list
404 on the decision callSession id does not exist, or sits outside the key's workflow and status limitsCheck the id and the key limits
429Rate limit or quota reachedWait for Retry-After, then retry

A 400 means the request itself failed validation, so nothing ran and nothing was billed; the API errors reference lists it as a fix-and-retry case.

If the person still submits something you did not expect, look for a warning on id_verifications[].warnings. The catalogue includes DOCUMENT_TYPE_NOT_ALLOWED and COUNTRY_NOT_ALLOWED, alongside DOCUMENT_EXPIRED, INVALID_MRZ and COULD_NOT_RECOGNIZE_DOCUMENT. Surface the first warning to the user and stop, or send the session to review.

Restricting at the workflow level as well

Session expectations and workflow configuration are two different controls, and most teams want both.

  • Session level: expected_details.expected_document_types records what you expect for that one person and narrows the picker. It travels with the session, so you can vary it per market without cloning a workflow.
  • Workflow level: the ID Verification node stores the accepted document types and subtypes per country in documents_allowed. The console edits the same object under the node's Countries tab, and the Management API writes it directly.

Set the workflow rule when a compliance requirement must hold for every applicant. Set the session field when the requirement changes per applicant, per corridor or per test. Put simply: documents_allowed on the workflow controls the document types accepted for that workflow, while expected_details records the session's expectations and narrows the picker.

Country control and the hosted flow

Country is a separate expectation. id_country and nationality take ISO-3 codes and are compared against the result; a difference becomes a decision warning. The documentation does not describe a parameter that pre-selects the issuing country in the hosted flow, so treat these fields as expectations on the record, not as a way to skip the picker. If you need to forbid a country outright, configure that country on the workflow instead, where the console lists each country and the methods it accepts. To limit which methods a country may use, such as document capture only, open the country editor and choose Document only; turning every method off for a country is rejected on save with "No method enabled".

Worked cost example

Assume 5,000 completed full KYC checks a month, each one ID document verification $0.15 + passive liveness $0.10 + face match 1:1 $0.05 + device and IP analysis $0.03 = $0.33. Restricting the picker to passport and national ID does not change any of those unit prices.

  • List price: 5,000 x $0.33 = $1,650.00 a month.
  • Scale plan, 10% off every Didit price: 5,000 x $0.297 = $1,485.00 a month.
  • ID document check alone, if liveness and face match run as separate steps elsewhere: 5,000 x $0.15 = $750.00.

That arithmetic uses published unit prices only. Your own mix of steps, plus any NFC add-on at $0.15 per check, decides the final figure; the estimator on didit.me/pricing runs it with your numbers.

  • Creating a session is free. Billing is per completed check from prepaid credit, so a 400 on create costs nothing.
  • The document check bills when it runs. $0.15 for ID Verification, $0.15 more if you add NFC chip reading, and $0.20 if the standalone ID verification API is used server to server instead of a session.
  • Sandbox is free and unlimited on every plan, including the Free plan with $10 of monthly credit for organizations that sign up with a work email.
  • Review is a session status, not a different check. If a warning routes a session to In Review, the console records it in reviews, and a reviewer who changes the status by hand leaves status_override with the automatic status kept beside it.
  • What review cannot do. Review decides on the session in front of it; it does not rewrite the document restriction. If the wrong types keep arriving, fix expected_document_types or the workflow configuration, not the individual case.

Sources

Next step: open the sandbox at business.didit.me, create a session with ["P","ID"] and confirm the picker yourself. No sales call, and sandbox testing is free.

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

What values can expected_document_types take?

The allowed values are P, ID, DL, RP, HIC, TC and SSC. P is a passport, ID a national identity card, DL a driver's licence and RP a residence permit. Send them as an array of strings inside expected_details on the create session call, as documented in the Create Session API reference.

Is expected_document_types case-sensitive?

No. The values are case-insensitive and deduplicated, so ["p","P","ID"] behaves like ["P","ID"]. Use upper case in your own code anyway, so logs and support tickets stay readable.

What happens if I send an unknown value such as "PASSPORT"?

The create call fails with HTTP 400 because a field did not pass validation. Fix the value to a code from the allowed set and retry. Because the session was never created, no check ran and nothing was billed.

Does expected_document_types block a person from submitting another document?

It narrows the document selection screen in the hosted flow to the types you requested, and a result that does not match your expectation surfaces as a decision warning. For a hard rule across every session, set the accepted types on the workflow's ID Verification feature, where a disallowed document can end in DOCUMENT_TYPE_NOT_ALLOWED.

Where exactly do I put the field in the API request?

Inside the expected_details object in the body of POST https://verification.didit.me/v3/session/, next to id_country, nationality and the personal fields. That object is the documented home for the field and the values you expect.

Can I use id_country or expected_document_types to pre-select the country or document in the hosted flow?

Didit documents these as expectations that are checked against the result and surfaced as decision warnings, not as a way to pre-select the picker. If you need a country restricted outright, configure the country and its allowed methods on the ID Verification node in the console or through the Management API.

Does restricting document types change the price of a check?

No. ID Verification is $0.15 per completed check whether one document type or all seven are allowed, and the full KYC bundle stays at $0.33. Only the steps that actually run inside the session are billed.

Can I set this in the console instead of the API?

Yes, at the workflow level. Open the workflow, select the ID Verification node, then Countries, and set the accepted document types and subtypes for each country. That configuration applies to every session on the workflow, while expected_details applies to the single session you create.

Which warning tells me the person submitted the wrong document?

Look for DOCUMENT_TYPE_NOT_ALLOWED or COUNTRY_NOT_ALLOWED in id_verifications[].warnings on the decision. The full catalogue also covers DOCUMENT_EXPIRED, INVALID_MRZ, INCONSISTENT_DATA and COULD_NOT_RECOGNIZE_DOCUMENT.

Do I need a separate workflow for each document type combination?

Not if the difference is only the expected type. Send a different array in expected_details on each create call and keep one workflow. A separate workflow makes sense when the accepted types must hold for every applicant without exception.

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.