MRZ Parsing Accuracy: A Step-by-Step How-To (2026)
Send an uncropped image to Didit ID Verification: it decodes the MRZ, validates check digits, cross-checks the visual zone and returns a status and warnings. $0.15 per check.

Contents
In this guide
Jump to the part you need.
This page is for teams that need the machine readable zone on a passport, ID card or residence permit decoded and checked, not just read. We decode MRZ inside Didit ID Verification at $0.15 per document check in a workflow, $0.20 per call on the standalone API. The caveat: an MRZ read is only as good as the image, so uncropped photos with all four corners visible are a prerequisite.
Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.
| Item | Detail |
|---|---|
| Outcome | A decoded MRZ, validated check digits, a cross-check against the visual zone, and a status with warnings |
| Endpoint | POST https://verification.didit.me/v3/id-verification/ for an existing image, or the ID Verification step inside a session |
| Price | $0.20 per call on the standalone API, $0.15 per document check inside a workflow |
| Required input | front_image, plus back_image for two-sided documents, max 5 MB per file, uncropped |
| Coverage | 14,000+ document types in 220+ countries, 54 capture languages |
| Signals of a bad read | INVALID_MRZ, INCONSISTENT_DATA, EXPIRATION_DATE_NOT_DETECTED, COULD_NOT_RECOGNIZE_DOCUMENT |
| When a human decides | status is In Review, for example when the forgery check returned no usable score |
Start free in the sandbox at business.didit.me, no sales call. The product behind this is ID Verification, and developers who want an AI assistant to drive the integration can connect Didit through the MCP server. Every price is on the pricing page.
What an MRZ parse has to get right
The machine readable zone is the fixed-width block of characters at the bottom of a passport data page or on the back of an ID card. ICAO Doc 9303 defines the format: a restricted character set, filler characters, and check digits at fixed positions. The zone carries the document number, issuing state, nationality, name, date of birth, sex and expiry date in a form no one has to re-key.
| Document | Layout | What the lines carry |
|---|---|---|
| Passport (TD3) | 44 characters over 2 lines | Line 1: document code, issuing state, name. Line 2: document number and its check digit, nationality, date of birth and its check digit, sex, expiry date and its check digit, optional personal number and its check digit |
| ID card, residence permit, many driver's licenses (TD1) | 30 characters over 3 lines | Line 1: document code and document number with its check digit. Line 2: date of birth with its check digit, sex, expiry date with its check digit, nationality. Line 3: name |
Recognising the characters is the easy part. Getting them right is not:
- Localisation. The zone has to be found and aligned before OCR. Glare on a laminate, a curled page or a passport photographed on a table pushes the lines out of frame.
- Character set. The MRZ font is constrained, the images are not. A 0 and an O, a 1 and an I, an 8 and a B look alike at low resolution, and a generic OCR model does not default to the MRZ alphabet.
- Check digits. Each line carries digits computed from the characters around them. A wrong digit does not just look odd, it proves that at least one character in that field is wrong.
- Cross-zone agreement. The visual zone states one date of birth and the MRZ states another. Neither can be trusted alone, so both have to be read and compared.
The recommended method follows from this. Use a parser that decodes the MRZ, validates the check digits, compares the result with the visual zone, and returns every disagreement as a warning with a documented action. That is what Didit ID Verification does, and it is what our 4,000+ companies call when they need document data they can act on. The rest of this page is the procedure.
Prerequisites
- A Didit API key, created in the Business Console at business.didit.me. Sandbox testing is free on every plan.
- One or two document images, or a workflow with the ID Verification feature for user-facing capture. Accepted file types are tiff, jpg, jpeg, png, webp and pdf, max 5 MB per file.
- A decision on your MRZ policy before the first call.
invalid_mrz_action,inconsistent_data_actionandexpiration_date_not_detected_actioneach acceptDECLINEorNO_ACTION. - Review capacity if you leave any of those groups at
NO_ACTION, because a disputed MRZ then lands on a person. - A webhook endpoint that can verify the
X-Signature-V2header if you want decisions pushed to you instead of polled.
How to parse an MRZ with Didit, step by step
Choose where the call runs. For an image you already hold, call
POST https://verification.didit.me/v3/id-verification/. For a person capturing a document in your flow, add the ID Verification feature to a workflow, create a session withPOST /v3/session/, and readid_verifications[]fromGET /v3/session/{sessionId}/decision/. Both return the same report object, so the parsing rules you write apply to both.Prepare the images. Send the whole document and do not pre-crop, because the service detects, aligns and crops the document itself. Add
back_imagefor ID cards, driver's licenses and residence permits.Set the MRZ actions before the first request.
invalid_mrz_action=DECLINEdeclines a document whose MRZ check digits do not validate.inconsistent_data_action=DECLINEdeclines when the MRZ and the visual zone disagree.expiration_date_not_detected_action=DECLINEdeclines when no expiry date could be read. Leave a group atNO_ACTIONand that risk becomes informational only.Send the request. This is the documented call:
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'Read
statusbefore you read a single field.Approvedmeans no warning resolved to a decline.Declinedmeans at least one did.In Reviewmeans the result cannot be decided automatically. Writing MRZ fields to your database before this check is how teams approve documents they should have rejected.Walk the
warnings[]array. Each entry carries ariskcode, alog_typeoferror,warningorinformation, and along_descriptionwritten to be shown to the person. Show the first error and stop the flow. Log the rest with therequest_id.Keep the evidence and be able to re-fetch. With
save_api_request=true, the default, the call is stored as an API-type session,request_idis a real session id, and the cropped document and portrait come back as short-lived media URLs. Download the images promptly instead of storing the URL. Re-read the report with:curl https://verification.didit.me/v3/session/{session_id}/decision/ \ -H "x-api-key: YOUR_API_KEY"Take
status.updatedif the decision can change. VerifyX-Signature-V2over the sorted canonical JSON, reject a timestamp more than 300 seconds old, and re-fetch the decision rather than trusting a payload you could not verify. The legacyX-Signature-Simpleheader authenticates the envelope only, so re-fetch when you use it.


Expected output
A 200 response carries request_id and one id_verification object. The three statuses you have to branch on:
| Status | Meaning | What you do |
|---|---|---|
Approved | No warning resolved to a decline | Use the fields, keep the warnings in your audit record |
Declined | At least one warning resolved to a decline, either a fraud or hard-failure risk or a risk group you set to DECLINE | Show the first warning and stop the flow |
In Review | The result cannot be decided automatically, for example DOCUMENT_LIVENESS_NOT_COMPUTED when the forgery check returned no usable score | Route to your manual review queue, never approve automatically |
Inside the object, mrz holds the decoded zone and the top-level fields hold what the visual zone said. A parse is trustworthy when the two agree and the check digits validate, which is exactly what the warnings report on. The full JSON schema is in the data models reference.
Two scope notes before you write the handler. MRZ_NOT_DETECTED, INVALID_DATE and PORTRAIT_IMAGE_NOT_DETECTED exist in workflow sessions but are never produced by the standalone endpoint, so do not code a branch for them on /v3/id-verification/. expected_details is the other way round: it is a session field, and the standalone call compares the document against nothing you already hold.

Inputs and outputs
| Field | Required | What it does |
|---|---|---|
front_image | Yes | The document image. tiff, jpg, jpeg, png, webp or pdf, max 5 MB, uncropped with all four corners visible |
back_image | For two-sided documents | Reverse side of an ID card, driver's license or residence permit |
perform_document_liveness | No, default true | Screens the images for screen replays, printed copies and portrait manipulation |
invalid_mrz_action | No | DECLINE or NO_ACTION when the MRZ check digits do not validate |
inconsistent_data_action | No | DECLINE or NO_ACTION when the MRZ and the visual zone disagree |
expiration_date_not_detected_action | No | DECLINE or NO_ACTION when no expiry date could be read |
minimum_age | No | Age threshold, for example 18 |
preferred_characters | No | Preferred character set for the OCR output, for example latin |
save_api_request | No, default true | Stores the call as an API-type session and returns media URLs |
vendor_data | No | Your own identifier for the request, echoed back |
| Field | What it holds |
|---|---|
status | Approved, Declined or In Review for this document |
mrz | The decoded machine readable zone |
document_type, document_subtype | The classified document class and the registry subtype |
full_name, date_of_birth, document_number, expiration_date, parsed_address | Fields read from the visual zone, the ones the MRZ is compared against |
barcodes | An array, always, and empty when the document produced no barcode output |
warnings | Risk objects with risk, log_type, short_description, long_description, additional_data and node_id |
portrait_image, front_document_image, back_document_image | Short-lived media URLs for the stored images |
request_id | Correlation id, and a real session id when save_api_request is true |
Failure cases and recovery
| Signal | What happened | Recovery |
|---|---|---|
| HTTP 403, not enough credits | The balance cannot cover the call, refused before any image processing | Top up or add credit in the Business Console and retry |
HTTP 400, COULD_NOT_RECOGNIZE_DOCUMENT | The document could not be processed at all | Ask for a new capture with the whole document in frame |
| HTTP 400, multipart validation | Missing back_image on a two-sided document, a file over 5 MB, or an unsupported extension | Fix the form fields and the files before retrying |
Declined with INVALID_MRZ | Check digits do not validate, so at least one character is wrong or the zone was altered | Re-capture. If the same document fails twice on a clean image, treat it as a document integrity question, not an OCR question |
Declined with INCONSISTENT_DATA | The MRZ disagrees with the visual zone | Do not auto-approve. Compare both zones by hand, because this is a pattern requiring manual document review |
Declined with EXPIRATION_DATE_NOT_DETECTED | No expiry date could be read and your action is DECLINE | Ask for the reverse side if the date lives there, or route to review |
Declined with COULD_NOT_DETECT_DOCUMENT_TYPE | The front image does not match a known official document design with high confidence | Confirm the document is a supported type before you ask the person to try again |
In Review with DOCUMENT_LIVENESS_NOT_COMPUTED | The forgery check returned no usable score, so the document is unchecked | Route to manual review. This escalation is not configurable and never overrides a Declined |
In Review on any other warning | The case needs a person | Send it to your queue with the request_id and the first warning attached |
Validation layers that stop a wrong character
Four checks stand between a misread glyph and a record in your database, and all four run inside the same call. The check digits catch a transcription error in the fields they cover. Date and number format validation catches a value that cannot exist, such as a month of 19. The cross-zone comparison catches a document where only one zone was edited. The duplicate warnings flag a document or a person already seen in your account, and they are a signal for review rather than proof of who owns the document. Any risk that is not in a decline group is informational and never declines on its own, so POSSIBLE_DUPLICATED_USER tells you something without stopping the flow.
On a session you can add one more layer before the parse happens. expected_details takes first_name, last_name, date_of_birth, nationality, id_country and expected_document_types, and a mismatch surfaces as a decision warning. An MRZ that parses cleanly but names a different person is then caught before approval instead of after onboarding.
What you pay for and where review starts
Parsing is billed per call, not per character, and the price depends on the route you take:
- Standalone API.
$0.20per call, one ID Verification API credit per 200 response. - Inside a workflow.
$0.15per ID document check. A full KYC is$0.33and is made of ID document$0.15plus passive liveness$0.10plus face match 1:1$0.05plus device and IP analysis$0.03. - NFC chip reading.
$0.15add-on per check when you read the passport chip instead of trusting the printed zone. - Sandbox. Free and unlimited. Nothing is charged in sandbox.
Each 200 response consumes one credit. A 403 for insufficient balance is rejected before image processing; check current billing terms for other errors.
The review boundary matters more than the price. Declined is terminal for the automated flow: show the warning, stop, and let the person start again. In Review means a person must decide, and a reviewer who overrides the result leaves a record in status_override alongside the automatic status it replaced. A parsed MRZ is not evidence that the document is genuine. Authenticity checks come before the extracted data, so keep the two decisions separate in your own records as well.
Worked cost example
Assume 20,000 document checks a month and one image pair per check, at published list prices.
- Standalone API: 20,000 x $0.20 = $4,000.00.
- Same checks inside a workflow with the ID Verification step: 20,000 x $0.15 = $3,000.00.
- Difference: 4,000.00 minus 3,000.00 = $1,000.00 a month, which is the price of not owning the capture flow.
- Full KYC instead of the ID step alone: 20,000 x $0.33 = $6,600.00, of which the ID document is 20,000 x $0.15 = $3,000.00.
- Illustrative Scale plan-credit example. On Scale every Didit price carries 10% off, so $0.15 x 0.90 = $0.135 and 20,000 x $0.135 = $2,700.00 of usage. That usage is drawn from the $350.00 of plan credit added each month, leaving 2,700.00 minus 350.00 = $2,350.00 to come from your top-up balance. The $299.00 monthly subscription fee is separate from the usage balance and is not part of the $2,700.00.
Sources
- Didit docs: ID Verification overview
- Didit docs: ID Verification API reference
- Didit docs: ID verification warnings catalogue
- Didit docs: Create Session
- Didit docs: Retrieve Session decision
- Didit docs: data models
- Didit docs: webhooks and HMAC signing
- Didit docs: pricing and billing
- Didit pricing page, read November 26, 2026
- ICAO Doc 9303, Machine Readable Travel Documents, the standard that defines the MRZ format
The next step is one call with your own document. Create a free sandbox account at business.didit.me, no sales call, send a single uncropped front image, and read the MRZ, the status and the warnings in the console before you write any code.
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
What is the MRZ on a passport or ID card?
The machine readable zone is the fixed-width block of characters at the bottom of a passport data page or on the back of an ID card, defined by ICAO Doc 9303. It holds the document number, issuing state, nationality, name, date of birth, sex and expiry date, plus check digits at fixed positions. Didit decodes it during ID Verification and returns it in the mrz field of the report.
How do I get an accurate MRZ parse?
Send an uncropped image of the whole document to POST https://verification.didit.me/v3/id-verification/, with a back_image for two-sided documents, and set invalid_mrz_action=DECLINE and inconsistent_data_action=DECLINE. The service reads the visual zone, decodes the MRZ, validates the check digits and compares the two zones. Read id_verification.status and id_verification.warnings before you use any field.
What does invalid_mrz_action do?
It controls what happens when the MRZ check digits do not validate. With DECLINE the response status becomes Declined with an INVALID_MRZ warning. With NO_ACTION the warning is informational and the status follows the other risks, so your review team owns that case. The same pattern applies to inconsistent_data_action and expiration_date_not_detected_action.
Why does a clean image still return INCONSISTENT_DATA?
Because the MRZ and the visual zone disagree, which is exactly what the cross-check exists to find. A clean image makes an OCR misread less likely, so a persistent disagreement points at the document rather than the photo. Compare the printed date of birth, document number and expiry date against the mrz payload by hand before you decide anything.
Is MRZ parsing only for passports?
No. Passports use a 44-character, two-line zone, while ID cards, residence permits and many driver's licenses use a 30-character, three-line format. Didit covers 14,000+ document types in 220+ countries and decodes the MRZ and any barcodes the document carries. Send back_image for the two-sided documents.
What image should I send for MRZ parsing?
An uncropped photo or scan of the whole document with all four corners visible, in tiff, jpg, jpeg, png, webp or pdf, up to 5 MB per file. Do not pre-crop, because the service detects, aligns and crops the document itself. Glare across the MRZ lines makes characters harder to read, so capture in even light and ask for a retake when the image is bright and unreadable.
Does the standalone API ever return MRZ_NOT_DETECTED?
No. MRZ_NOT_DETECTED exists in workflow sessions but is never produced by the standalone /v3/id-verification/ endpoint. There, an MRZ problem shows up through INVALID_MRZ or an extraction warning, and a document that cannot be processed at all returns 400 with COULD_NOT_RECOGNIZE_DOCUMENT.
How much does one MRZ parse cost?
$0.20 per call on the standalone ID Verification API and $0.15 per document check when ID Verification runs as a step inside a workflow. Each 200 response consumes one credit. A 403 for insufficient balance is rejected before image processing, so check current billing terms for other errors.
When does an MRZ result need a human?
When status is In Review, which happens for example when perform_document_liveness=true and the forgery check returns no usable score, flagged as DOCUMENT_LIVENESS_NOT_COMPUTED. Route those to your review queue and do not approve them. Declined is different: it is an automated decision you can show to the person and stop the flow.
Can I parse the MRZ without running the fraud checks?
Yes, set perform_document_liveness=false and the forgery check is skipped, so the status follows the remaining warnings. Do that only when you have another way to establish that the document is genuine. The parse proves the zone is internally consistent, not that the document was issued to the person holding it.
Can I check the parsed MRZ against data I already have?
Yes. On a session, send expected_details with first_name, last_name, date_of_birth, nationality, id_country and expected_document_types. Mismatches surface as decision warnings, so a clean parse that names a different person is caught before approval. For an existing image, compare the returned fields yourself before you store them.
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


