Skip to main content

ID Document OCR: How It Works and How to Build It (2026)

ID document OCR turns a photo of a passport, ID card or licence into validated fields after authenticity checks run. On Didit it costs $0.15 per check inside a workflow, or $0.20 per standalone API call.

ID Document OCR: How It Works and How to Build It (2026)

Contents

In this guide

Jump to the part you need.

ID document OCR fits teams who hold photos or scans of passports, ID cards or driver licences and need the fields read, validated and decisioned in one call. On Didit a document check costs $0.15 in a workflow and $0.20 on the standalone API. Caveat: extracted text is not proof of identity. A readable printed copy can still raise a document-liveness warning, and adding liveness and face match is an optional broader KYC check, not a requirement for standalone OCR.

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

ID document OCR on Didit at a glance
ItemDetail
What it doesReads front and back images of a government ID, decodes the MRZ and barcodes, extracts holder fields, checks the document for tampering, returns a status and a warning list
Coverage14,000+ document types across 220+ countries and territories, document recognition in 130+ languages
Price inside a workflow$0.15 per check
Price, standalone API call$0.20 per call
LatencySub-2-second p99 inference
StatusesApproved, In Review, Declined, plus Not Started, In Progress, Abandoned, Kyc Expired
Main outputsfull_name, document_type, document_number, date_of_birth, expiration_date, parsed_address, mrz, barcodes, portrait and document images, warnings[]
Good fit forOnboarding, re-verification and step-up, age gates, payouts and claims, marketplace sellers, KYB key people

Start free in the sandbox at business.didit.me, no sales call. For developers, connect Didit to an AI assistant through the Didit MCP server. The reference for this check is the ID Verification overview, and every published number is on the pricing page. Didit runs identity and fraud checks for 4,000+ companies.

What ID document OCR does inside the pipeline

OCR is one stage in the verification flow, and the order of the stages matters. Didit checks whether a document is genuine before it trusts what the document says. The Academy lesson on reading a verification result puts authenticity checks ahead of extracted data, and that ordering is deliberate: a readable printed copy can still trigger a document-liveness warning.

  1. Capture. The user photographs or uploads the document. Didit detects the document type and issuing country, gives visual cues for framing, light and focus, and captures automatically when the frame is usable. Passports, national ID cards, driver licences and residence permits are all covered.
  2. Classification. You never declare the country or the document type. The front image is matched against known official document designs, and a front image that does not match a known design with high confidence comes back as COULD_NOT_DETECT_DOCUMENT_TYPE and declines.
  3. Extraction. The visual zone is read with OCR, the machine-readable zone is parsed with its check digits, and any barcodes are decoded. Fields are returned for the name, document number, dates, nationality and address.
  4. Cross-validation. Dates, number formats and MRZ check digits are validated, and the visual zone is compared against the MRZ. Disagreements raise INCONSISTENT_DATA or INVALID_MRZ, which you can configure to decline.
  5. Document liveness. With perform_document_liveness=true, the images are screened for screen replays, printed copies and portrait manipulation. This is on by default on the standalone endpoint.
Processing screen shown while the document is read and checked
While the document is processed, Didit reads the visual zone, parses the MRZ and runs the forgery checks in the same call, so the user waits once rather than three times.

A check that did not run is not evidence that the document is genuine. When the forgery provider fails, Didit returns In Review instead of Approved.

Choosing the method: document capture, lookup or wallet

ID Verification is one feature with three methods, and you choose per country which of them are allowed. The session records which method produced the result, and every result carries an assurance tier that states what was actually proven. The tier is an honest description, not a ranking.

The three verification methods and their assurance tiers
MethodWhat the user doesTier on the sessionWhen to choose it
Document capturePhotographs a passport, ID card, driver licence or residence permitdocumentaryThe default, and the only method available in every supported country. Use it when you need the document itself read and checked for authenticity.
Non-document lookupTypes a national ID number plus a few personal details, checked against a government or other authoritative sourcedata_matchUse it where the country has a source and you would rather not ask for a photograph. The source is named per country, never generalised.
WalletSigns in with a digital identity such as MitID, BankID or Smart-IDcryptographicUse it when the population already holds a wallet and you want signed attributes with no document photograph.

Methods sit under the methods key on the ID Verification feature config, keyed by ISO 3166-1 alpha-3 country code. Omit a country, or a method inside a country, and that country is document capture only. Each method also takes a fallback such as on_no_match: fallback_to_document for a lookup that finds nothing. Where a lookup source returns a portrait, a selfie is taken and face-matched inside the lookup price; where it returns data only, run Liveness and Face Match as their own workflow steps if you need them.

Lookup form where the user types a national ID number and personal details
The non-document route: the user types an ID number and a few details, and Didit checks them against the source for that country with no photograph involved.

Use cases for ID document OCR

  • Onboarding. Read the document once, store structured fields, and avoid asking the customer to retype a name or a date of birth the document already carries.
  • Step-up and re-verification. A user who already passed biometrics can be re-checked on the document alone when an expired document surfaces in your data.
  • Age gates. The standalone call takes minimum_age, and a document below the threshold raises MIN_AGE_NOT_REACHED instead of quietly passing.
  • Payouts and claims. Compare the account holder on a claim against the identity document you already hold, and route mismatches to review.
  • Marketplace sellers and KYB key people. Every owner and officer in a business verification can be linked to a document check, billed per person.
  • Documents that are not IDs. Payslips, bank statements, proof of funds and invoices belong to Document AI, where you define the fields to extract.

Prerequisites before your first call

  • A Didit organization and an API key from the Business Console, sent as the x-api-key header against https://verification.didit.me.
  • Credit on the account. Sandbox testing is free and unlimited, and the Free plan includes $10 of monthly credit for organizations that sign up with a work email. Phone codes are excluded from Free credit.
  • Images in jpg, jpeg, png, webp, tiff or pdf, up to 5 MB per file, uncropped, with all four corners of the document visible.
  • A decision on delivery mode: a hosted workflow session or the standalone server-to-server call. The paid steps section below lists both rates.
  • An endpoint for the status.updated webhook, or a server that can call GET /v3/session/{sessionId}/decision/ after the user finishes.

Step by step: from a document image to a decision

  1. Create the API key and check your balance. Keys are created in the Business Console. A call made with no available credit returns HTTP 403 before any image is processed, so check the balance first.
  2. Choose the delivery mode, because it decides the billing line. Hosted workflow billing and standalone API billing are separate lines: inside a workflow the check is billed per completed check, while the standalone call is billed per request and only a 200 response consumes a credit. Use the workflow route for user-facing flows, where the document arrives through the hosted session or the Web and Mobile SDKs. Use the standalone route for server-to-server jobs where you already hold the images.
  3. Configure the workflow. Add the ID Verification feature in the Business Console or through POST /v3/workflows/. The canonical feature enum is ID_VERIFICATION, with OCR kept as the legacy value. Restrict accepted documents with documents_allowed, and set the risk actions you want: invalid_mrz_action, inconsistent_data_action and expiration_date_not_detected_action each take DECLINE or NO_ACTION. A workflow that says nothing about methods stays document capture only.
  4. Create a session. Send workflow_id, vendor_data and callback to POST /v3/session/. The response returns a session.url.
  5. Hand the user to the session. Open session.url or mount the SDK. The user captures the document, and Didit runs capture, extraction and the checks without further input from you.
  6. Fetch the decision. Call GET /v3/session/{sessionId}/decision/ or subscribe to the status.updated webhook. The result appears under the plural array id_verifications[], one entry per document collected in the workflow, each with its own node_id.
  7. Call the standalone endpoint when you already hold the images. One multipart request returns OCR plus the fraud checks. This is the snippet from the Didit docs:
curl -X POST 'https://verification.didit.me/v3/id-verification/' \
-H 'x-api-key: YOUR_API_KEY' \
-F 'front_image=@./id_front.jpg' \
-F 'back_image=@./id_back.jpg' \
-F 'perform_document_liveness=true' \
-F 'minimum_age=18' \
-F 'expiration_date_not_detected_action=DECLINE' \
-F 'invalid_mrz_action=DECLINE' \
-F 'inconsistent_data_action=DECLINE' \
-F 'preferred_characters=latin' \
-F 'save_api_request=true' \
-F 'vendor_data=user-123'

front_image is required. back_image is required for two-sided documents such as ID cards and driver licences. Sending the request without the back image is a 400, not a partial read.

  1. Act on the status and the warnings together. A readable but problematic document returns HTTP 200 with status: "Declined", so inspecting the HTTP code alone is not enough. Read id_verification.status and id_verification.warnings, then branch.
  2. Correct a misread field instead of asking for a new photo. PATCH /v3/session/{session_id}/update-data/ fixes KYC fields on a finished session. Send only the fields that change; the name is recomputed and an audit trail records the previous and new value.
curl -X PATCH "https://verification.didit.me/v3/session/<SESSION_ID>/update-data/" \
-H "x-api-key: <API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"first_name": "John",
"last_name": "Doe",
"date_of_birth": "1990-01-01",
"issuing_state": "ESP",
"extra_fields": { "municipality": "Madrid" }
}'

When the image itself is unusable, do not patch around it. Ask the user to resubmit through PATCH /v3/session/{id}/update-status/ with new_status: "Resubmitted", and let the capture step do its job.

What the response looks like

The standalone call returns a correlation id and one report object. Fields the document did not supply, or that could not be read, come back as null rather than as an empty string.

{
  "request_id": "...",
  "id_verification": {
    "status": "Approved",
    "full_name": "...",
    "document_type": "Passport",
    "document_number": "...",
    "date_of_birth": "...",
    "expiration_date": "...",
    "parsed_address": { ... },
    "mrz": { ... },
    "barcodes": [ ... ],
    "portrait_image": "https://<media-host>/ocr/...",
    "front_document_image": "https://<media-host>/ocr/...",
    "back_document_image": "https://<media-host>/ocr/...",
    "warnings": []
  }
}

With save_api_request=true, the default, the call is persisted as an API-type session that appears in the Business Console, and request_id is a real session id you can pass to the decision endpoint. Media fields are presigned URLs with a limited validity window, so download them promptly instead of storing the URL.

Session overview in the Didit Business Console showing the status and the warnings raised
The same result in the Business Console: the session status, the checks that ran and every warning raised on the session.

Inputs and outputs

Inputs for the standalone ID verification call
FieldRequiredNotes
front_imageYesjpg, jpeg, png, webp, tiff or pdf, max 5 MB, uncropped
back_imageFor two-sided documentsID cards and driver licences
perform_document_livenessNoDefaults to true on the standalone endpoint
minimum_ageNoRaises MIN_AGE_NOT_REACHED below the threshold
invalid_mrz_action, inconsistent_data_action, expiration_date_not_detected_actionNoEach takes DECLINE or NO_ACTION
preferred_charactersNoScript preference for extraction
save_api_requestNoDefault true; false stores nothing and returns one-off URLs
vendor_dataNoYour own identifier for the person
Outputs you should read on every call
OutputWhy it matters
statusApproved is the only state that means the check passed. In Review is not an approval.
warnings[]Each entry carries risk, log_type, short_description and long_description; the long description is written for end-user surfaces.
full_name, date_of_birth, document_numberTyped fields for your own records, matching and downstream screening.
document_type, document_subtypeReadable class plus the registry code, filtered to what the workflow accepts.
expiration_date, mrz, barcodesValidity window and the machine-readable evidence behind the cross-checks.
portrait_image, front_document_image, back_document_imageShort-lived media URLs for your case file or face match step.

Failure cases and recovery

HTTP errors and feature-level responses, and what to do about each
LayerWhat you seeWhat it meansRecovery
HTTP403, not enough creditsThe organization balance cannot cover the call; nothing was processedTop up or wait for the monthly credit, then retry
HTTP400 with COULD_NOT_RECOGNIZE_DOCUMENTThe document cannot be processed at allAsk for a new capture: uncropped, all four corners visible, better light
HTTP400 multipart validationMissing back_image on a two-sided document, file over 5 MB, unsupported extensionFix the request; nothing is billed
StatusDeclined with DOCUMENT_EXPIRED or DOCUMENT_LIVENESS_FAILEDOn an HTTP 200 response, a terminal warning resolved to a declineSurface the first warning long description, stop the flow, do not retry blindly
StatusIn Review with DOCUMENT_LIVENESS_NOT_COMPUTEDThe forgery check returned no usable score, so the document is uncheckedRoute to manual review. This escalation is not configurable
StatusIn Review with other warningsThe check could not reach a decisionSend to your review queue; do not approve
WarningINVALID_MRZ, INCONSISTENT_DATA, EXPIRATION_DATE_NOT_DETECTEDA risk group governed by your per-request action parameter, so the same warning can decline or passSet the action to DECLINE where the risk is unacceptable to you, or handle the warning yourself under NO_ACTION
WarningDUPLICATED_DOCUMENTA duplicate-document warning. We do not publish a fixed disposition for it.Inspect the warning details and apply your review policy

Read the HTTP status and the feature status as two separate layers: the HTTP code tells you whether the call ran, the feature status and warnings tell you what the check concluded. The full risk catalogue, with the description text for every code, is the ID verification warnings page. The canonical field schema is in the data models reference.

  • ID document check in a workflow: $0.15 per check. This is the price that applies when the check runs as a step in a session.
  • Standalone ID verification API: $0.20 per call, one credit per HTTP 200 response.
  • NFC chip reading: $0.15 per check, as a separate add-on to a document check when you need the chip rather than the print.
  • Document liveness: runs inside the same call. The published price book has no separate line for it.
  • Full KYC: $0.33, which is the document check at $0.15 plus passive liveness at $0.10, face match 1:1 at $0.05 and device and IP analysis at $0.03.
  • Non-document lookup and wallets: priced separately from the document check, variable per country for a lookup and published per wallet. Check the pricing page before you enable a method in a country.

The review boundary is the part teams get wrong. Didit returns a decision per check: Approved, Declined or In Review. In Review means the system could not reach a trustworthy answer, and the session must land in a human queue. Do not build logic that treats a timeout, a provider error or a missing forgery score as a pass. Build the opposite: the default on an unanswered check is review.

Worked cost example

Take 20,000 onboarding checks a month, all of them document plus biometrics.

  • Document only, inside a workflow: 20,000 x $0.15 = $3,000.00 a month.
  • Full KYC, inside a workflow: 20,000 x $0.33 = $6,600.00 a month.
  • Full KYC on Growth: $0.33 x 0.96 = $0.3168 per check, so 20,000 x $0.3168 = $6,336.00 a month, and the plan fee is $99.00 a month with $115.00 of credit included.
  • Full KYC on Scale: $0.33 x 0.90 = $0.297 per check, so 20,000 x $0.297 = $5,940.00 a month, and the plan fee is $299.00 a month with $350.00 of credit included.
  • The same 20,000 documents sent through the standalone API instead: 20,000 x $0.20 = $4,000.00 a month, which is $1,000.00 more than the workflow route. Use the standalone call when you already hold the images and do not need a session, not as a default.

Add Document AI at $0.20 per document only for the files that are not IDs, such as a bank statement uploaded as proof of funds.

Sources

Next step: open the sandbox at business.didit.me, create a workflow with ID verification, and run one document through it. No sales call and no contract, and the Free plan's $10 of monthly credit covers the test.

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

How does ID document OCR work?

ID document OCR turns a photo of a passport, ID card, driver licence or residence permit into typed fields. Didit classifies the document automatically, reads the visual zone with OCR, decodes the MRZ and any barcodes, then cross-checks the two before returning values such as name, date of birth, document number and expiry. Authenticity checks run in the same call, so a value can come back with a warning attached to it.

How much does ID document OCR cost on Didit?

Didit charges $0.15 per document check inside a workflow and $0.20 per call on the standalone ID verification API. Growth takes 4% off every Didit price and Scale takes 10%, which makes the workflow check $0.144 and $0.135. Billing is per completed check from prepaid credit, with $10 of monthly credit on the Free plan for organizations that sign up with a work email.

Which image formats and sizes does the API accept?

Didit accepts jpg, jpeg, png, webp, tiff and pdf, with a maximum of 5 MB per file. Send front_image always, and back_image for two-sided documents such as ID cards and driver licences. Upload uncropped photos with all four corners visible, because Didit detects, aligns and crops the document itself.

What should I do when the status comes back In Review?

Treat In Review as an unresolved check, never as an approval. The most common cause is DOCUMENT_LIVENESS_NOT_COMPUTED, where the forgery check returned no usable score and the document is effectively unchecked. Route those sessions to a manual review queue and read the whole warnings[] array rather than the status alone.

Can I correct fields that the OCR read wrong?

Yes. PATCH /v3/session/{session_id}/update-data/ corrects KYC fields on a finished session, including document number, dates, name, nationality and parsed address, and only the fields you send change. Each update fires a data.updated webhook and the audit trail records the previous and new values. When the image itself is unusable, ask the user to resubmit instead.

Does ID document OCR work on documents that are not IDs?

Not on the ID verification endpoint, which is built for government-issued identity documents. Didit runs a separate Document AI product at $0.20 per document for payslips, bank statements, proof of funds, invoices and tax documents, where you define up to 30 fields and can compare a name against an expected person or company.

Is ID document OCR the same thing as KYC?

No. The document check reads and authenticates the ID; a full KYC check on Didit also runs passive liveness, face match 1:1 and device and IP analysis, priced together at $0.33. You can buy the document check alone when biometrics sit in another system you already trust, or when you only need the document read.

Which document types and countries are supported?

Didit covers 14,000+ document types across 220+ countries and territories, including passports, national ID cards, driver licences, residence permits, work permits, visas and health insurance cards. Classification is automatic, so you do not declare the country or the type in the request. A workflow can still restrict which types and subtypes it accepts.

How fast is the check?

Didit reports sub-2-second p99 inference for ID verification. In a hosted session the end-to-end time also includes the user's capture step, so measure latency against your own flow rather than the API figure alone.

What is the difference between the $0.15 and the $0.20 price?

The $0.15 price applies when the ID check runs as a step inside a Didit workflow, where the document arrives through the hosted session or the SDK. The $0.20 price applies to the standalone POST /v3/id-verification/ call that you make server to server when you already hold the images.

Can a user verify without a document at all?

In some countries, yes. ID Verification has three methods: document capture, a non-document lookup against an authoritative source, and a digital ID wallet such as MitID, BankID or Smart-ID. Each result carries an assurance tier so you can see whether a document was inspected, a record was matched or a wallet signed the attributes. Document capture remains available in every supported country, and the methods are set per country in the feature config.

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.