Barcode Decoding for Document Authentication (2026 How-To)
Send front and back images of an ID document to Didit's ID Verification API, read the decoded barcodes array, and compare it with the visual fields and the MRZ. $0.15 per check inside a workflow, $0.20 on the standalone API.

Contents
In this guide
Jump to the part you need.
Barcode decoding fits teams that must prove the printed fields of an ID were not edited after issue. With Didit you send front and back images to the ID Verification API, or run that step inside a workflow at $0.15 per check, then read the decoded barcodes array. The caveat: a decoded payload proves what the code says, not that the paper is genuine, so read it beside the tamper checks.
Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.
| Item | Detail |
|---|---|
| What you get | Decoded barcode payloads from an ID document or any PDF or image, returned as structured data you compare with the visual zone and the MRZ |
| Endpoint, identity documents | POST https://verification.didit.me/v3/id-verification/ |
| Endpoint, other documents | POST https://verification.didit.me/v3/document-ai/ |
| Price, ID document inside a workflow | $0.15 per check |
| Price, ID Verification API (server to server) | $0.20 per call |
| Price, Document AI | $0.20 per document |
| Symbologies returned | PDF_417, QR_CODE, DATA_MATRIX, CODE_128, EAN_13 and other supported codes |
| Human review boundary | In Review goes to your review queue, Declined stops the flow |
| Testing | Free sandbox on every plan, $10 of credit each month on the Free plan |
Start free in the sandbox at business.didit.me, no sales call. Developers who want an AI assistant to call the API can connect Didit through the Didit MCP server. Every number below is on the Didit pricing page.
How barcode decoding authenticates a document
Treat the barcode as a second copy of the record, printed when the document was issued. The front of a driver's license shows a name and a date of birth in human-readable type. The code on the back carries the same values in a machine-readable string. If someone edits the front and leaves the code alone, the two copies disagree.
Didit runs the whole read inside one call. The image is classified and aligned, the visual zone is read with OCR, the MRZ and any barcodes are decoded, and cross-checks then validate dates, number formats and MRZ check digits while comparing the visual zone against the MRZ. Barcode output is an array, one entry per code found, so a document with a PDF417 on the back and a QR code on the front returns two entries.
One concrete mismatch, as implementation guidance: a license that prints an expiry of 2029-08-01 on the front while the decoded payload on the back carries 2026-08-01 is the kind of contradiction the cross-checks exist to catch. With inconsistent_data_action=DECLINE, a contradiction the cross-checks detect comes back as Declined with INCONSISTENT_DATA in the warnings array.
PDF417 on driver's licenses
PDF417 is a stacked 2D symbology, and it is the code you meet on driver's licenses and state ID cards. It usually sits on the back, which is why back_image matters. Didit returns the symbology as PDF_417 and the decoded string in data. A front edited while the back stays untouched is a direct contradiction, and that contradiction is the fraud signal.
QR codes and the other symbologies
Beyond PDF417, Didit returns QR_CODE, DATA_MATRIX, CODE_128 and EAN_13 when a document carries them. The handling does not change with the symbology: read the payload, then compare it with the visual zone and the MRZ.
What you need before you start
- A Didit application. Create one at business.didit.me; the sandbox is free on every plan.
- An API key, sent in the
x-api-keyheader. - One image per side:
tiff,jpg,jpeg,png,webporpdf, max 5 MB per file, uncropped, with all four corners of the document visible. - Both sides for two-sided documents. ID cards and driver's licenses need
back_image, and on many licenses that is exactly where the PDF417 sits. - A decision per risk: which warnings decline and which go to review, set per request with the action parameters.
- For Document AI, the list of fields you want read, 1 to 30 items, sent as one JSON array string.
Decode an ID barcode, step by step
- Create the application and copy the key. Obtain an API key for your application and send it in the
x-api-keyheader. Sandbox calls are not charged. - Pick the route. Government-issued IDs (passports, ID cards, driver's licenses, residence permits) go to ID Verification, which decodes barcodes as part of the document read. Anything else carrying a code, such as payslips, bank statements, invoices or tickets, goes to Document AI.
- Capture uncropped images of both sides. Do not pre-crop: the service detects, aligns and crops the document itself. Stay under 5 MB per file.
- Send the request and set the actions you want. The call below is the published form of the endpoint, with the back image included and the three main risks set to decline.
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 anything else.id_verification.statusisApproved,DeclinedorIn Reviewin this endpoint, and thewarningsarray explains every issue behind that status. - Read the
barcodesarray. Each entry preserves the reader output, includingtype,side,data,data_rawandposition. An empty array means no supported code was found on that document. - Compare the payload with the visual zone and the MRZ. With
inconsistent_data_action=DECLINE, a contradiction between the decoded barcode, the printed fields and the MRZ raisesINCONSISTENT_DATAand the request is declined. - Fetch the same result later. With
save_api_request=truethe call is stored as an API session:request_idis a real session id you can pass toGET /v3/session/{sessionId}/decision/, and astatus.updatedwebhook fires. Inside a workflow, readid_verifications[].barcodesfrom the session decision.


What the response looks like
The example below is trimmed to the fields you act on, with values replaced by placeholders. Field names are exactly as returned.
{
"request_id": "SESSION_OR_REQUEST_UUID",
"id_verification": {
"status": "Approved",
"full_name": "<name read from the document>",
"document_type": "Driver's License",
"document_number": "<number read from the document>",
"date_of_birth": "YYYY-MM-DD",
"expiration_date": "YYYY-MM-DD",
"barcodes": [
{
"type": "PDF_417",
"side": "back",
"data": "<decoded payload>",
"data_raw": "<raw reader output>"
}
],
"warnings": []
}
}
Three things matter in that body. barcodes is always an array, and documents without barcode output return [] rather than null, so your handler never has to guess. status is the decision: a readable document with a problem returns HTTP 200 with status: Declined, so branching on the HTTP code alone will let bad documents through. And the path differs by route: the standalone call returns the data under id_verification.barcodes, while a session decision returns it under id_verifications[].barcodes, one entry per document collected in the workflow.
Decoding barcodes on documents that are not IDs
Bank statements, proof of funds, payslips, tax documents and invoices often carry a QR code or a barcode as well. Document AI extracts the fields you define and returns every code it detects, with the payload parsed where it can be.
curl -X POST https://verification.didit.me/v3/document-ai/ \
-H "x-api-key: $DIDIT_API_KEY" \
-F "document=@./bank-statement.pdf" \
-F 'fields=[{"key":"account_holder","name":"Account holder","instruction":"Full name of the account holder","type":"text","required":true,"is_full_name":true},{"key":"balance","name":"Closing balance","instruction":"Closing balance as a number","type":"number","required":true}]' \
-F "expected_first_name=Jane" \
-F "expected_last_name=Doe"
Every successful response includes document_ai.detected_codes, one item per code on each processed page of the PDF.
| Field | What it gives you |
|---|---|
type | Symbology, such as QR_CODE, CODE_128, EAN_13, DATA_MATRIX or PDF_417 |
page_number | 1-based page number |
position, x, y, width, height | Detected polygon and bounding box in rendered-page pixels, or null when no reliable location is available |
parsed_payload | Decoded string or structured value, or null when the code can only be located |
raw_payload | Raw decoder payload as a base64 string when available, otherwise an empty string |
Didit never guesses a payload. A damaged QR code can come back with its location and parsed_payload: null, and a failure in code detection does not fail the Document AI request. Two other defaults matter for authentication: DOCUMENT_AI_SUSPECTED_MANIPULATION is set to DECLINE out of the box, while DOCUMENT_AI_NAME_MISMATCH defaults to NO_ACTION, so a name that scores below the document_ai_name_match_score_threshold of 80 only blocks the document if you change that action. See the Document AI warnings reference.
Inputs and outputs
| Direction | Field | Notes |
|---|---|---|
| In | front_image | Required. One file, max 5 MB, uncropped |
| In | back_image | Required for two-sided documents such as ID cards and driver's licenses |
| In | inconsistent_data_action, invalid_mrz_action, expiration_date_not_detected_action | DECLINE or NO_ACTION, set per request |
| In | save_api_request | Default true. Keeps the call as an API session with a usable request_id |
| Out | status | Approved, Declined or In Review |
| Out | barcodes[] | Always an array, empty when no supported code is found |
| Out | warnings[] | Risk code, short and long description, and additional data per warning |
| Out | document_ai.detected_codes[] | Document AI only: type, page, position and payload per code |
| Out | name_match_score | Document AI only, 0 to 100, null when the check is skipped |
Failure cases and recovery
| Symptom | Cause | Recovery |
|---|---|---|
| HTTP 403, not enough credits | Balance cannot cover the call | Top up or move plan. The call is refused before any image processing |
HTTP 400 COULD_NOT_RECOGNIZE_DOCUMENT | The file could not be processed at all | Re-capture uncropped, better light, both sides. Do not retry the same file |
| HTTP 400 on multipart validation | Missing back_image, file over 5 MB, unsupported extension | Fix the file, then resend |
status: Declined with DOCUMENT_EXPIRED or DOCUMENT_LIVENESS_FAILED | Terminal warning | Stop the flow and show the first warning's long_description |
status: In Review with DOCUMENT_LIVENESS_NOT_COMPUTED | The forgery check produced no usable score | Treat the document as unchecked and route it to manual review |
barcodes: [] | No supported code, or the side that carries it was not sent | Not fraud by itself. Re-request the missing side before deciding |
parsed_payload: null in Document AI | Damaged or unreadable code | The location is still returned; fall back to the extracted fields |
HTTP 400 on a Document AI fields value | Sent as bracket-style form keys instead of one JSON array string | Resend as a single array. Nothing is billed when this fails |
What is paid, and where a human decides
Inside a workflow, the ID Verification step costs $0.15 per check and barcode decoding is part of that step, not a separate line. The standalone server-to-server call is its own price-book line at $0.20 per call. Document AI is $0.20 per document.
A machine never becomes the last word on a mismatch. Declined is terminal and your application should stop the flow. In Review requires manual review, including when a requested check produced no usable result, and a check that did not run is not evidence that a document is genuine. Review the returned barcode payload alongside the visual fields and warnings in your application.

Worked cost example
Take 40,000 full KYC checks a month, all on documents that carry a barcode, plus 6,000 bank statements read with Document AI.
- ID document: 40,000 x $0.15 = $6,000.00
- Passive liveness: 40,000 x $0.10 = $4,000.00
- Face match 1:1: 40,000 x $0.05 = $2,000.00
- Device and IP analysis: 40,000 x $0.03 = $1,200.00
- Full KYC subtotal: $6,000.00 + $4,000.00 + $2,000.00 + $1,200.00 = $13,200.00, which is 40,000 x $0.33
- Document AI on statements: 6,000 x $0.20 = $1,200.00
- Monthly total at list price: $13,200.00 + $1,200.00 = $14,400.00
- On the Scale plan, 10% off every Didit price: $14,400.00 x 0.10 = $1,440.00, so $12,960.00
The same 40,000 documents sent to the standalone ID Verification API instead cost 40,000 x $0.20 = $8,000.00 for the documents alone, with no liveness, face match or device analysis in that figure. If you are building a user-facing flow, the workflow route is both cheaper per document and the one that returns a decision.
Sources
- Didit ID Verification API documentation
- Didit ID Verification overview
- Didit Document AI API documentation
- Document AI rules and warnings
- ID Verification warnings catalogue
- Create Session API and Retrieve Session API
- Didit data models reference
- Didit pricing page and pricing in the docs, read November 26, 2026
Your next step: open a free sandbox application at business.didit.me, send one driver's license front and back, and read the barcodes array yourself. No sales call.
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 barcode decoding for document authentication?
It is the process of reading the machine-readable code printed on an identity document and comparing the decoded payload with the human-readable fields and the MRZ. A disagreement between the copies is evidence of tampering. Didit returns the payload in barcodes on the ID Verification response, alongside a status and a warnings list.
Which barcode types does Didit decode?
Document AI returns QR_CODE, CODE_128, EAN_13, DATA_MATRIX and PDF_417 among supported codes. ID Verification decodes the codes found on identity documents, including the PDF417 on driver's licenses, and returns them as an array. Each entry carries the symbology, the side, the parsed data and the raw reader output.
How much does barcode decoding cost?
Nothing on its own. Inside a workflow the ID Verification step is $0.15 per check and barcode decoding runs as part of it. The standalone ID Verification API is $0.20 per call, and Document AI, which is the route for non-ID documents, is $0.20 per document.
Does a decoded barcode prove the document is genuine?
No. It proves what the code says, which is useful only when it is compared with the visual zone and the MRZ. A forger who edits the front and not the back creates the mismatch, but a good forgery that edits both needs the tamper checks, and document liveness adds a further signal when you enable it with perform_document_liveness=true. Read the barcode as one signal among several.
What happens if the barcode is damaged or unreadable?
Didit does not guess. In Document AI a damaged code can come back with its location and parsed_payload: null, and a failure in code detection does not fail the request. In ID Verification, when the reader gets no usable code, the barcodes array comes back empty for that document.
Can I decode a barcode on a document that is not an ID?
Yes, with Document AI at POST https://verification.didit.me/v3/document-ai/. Send the file plus 1 to 30 field definitions as one JSON array string, and the response includes document_ai.detected_codes for every processed page. It is built for proof of funds, payslips, bank statements, tax documents and invoices.
How do I interpret a barcode mismatch?
Compare the decoded payload with the printed fields and the MRZ. If they disagree, the document was edited after issue or the code was rebuilt. With inconsistent_data_action=DECLINE the call returns Declined with INCONSISTENT_DATA in warnings. When no code is returned, treat the empty barcodes array as an absence of barcode output and evaluate the document using its status and warnings.
Where do I find the barcode data in a session decision?
At id_verifications[].barcodes, which is always an array. Each entry preserves the reader output, including type, position, data, data_raw and side. Documents without barcode output return [], so you never have to handle a null in place of a list.
How do I test all of this without paying?
Create a sandbox application at business.didit.me. Sandbox testing is free and unlimited on every plan, and the Free plan adds $10 of credit each month for live calls. You can send real document images and read the actual response shape before you spend anything.
Do I need both sides of a driver's license?
Yes. ID cards and driver's licenses are two-sided documents, so back_image is required, and the PDF417 usually sits on the back. Sending only the front leaves the barcode unread and returns an empty barcodes array for that document.
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


