Passport OCR API

Passport OCR API for ICAO 9303 MRZ & Field Extraction

Send a passport image to a single REST endpoint and get clean JSON back β€” MRZ string, passport number, full name, dates of birth, issue and expiry, place of birth, place of issue and nationality. ICAO 9303 compliant, 200+ countries, built for KYC, onboarding and check-in automation.

  • ICAO 9303 compliant
  • 200+ countries
  • TD1 / TD2 / TD3 MRZ
  • JSON in seconds
Passport image being processed into structured JSON output

Try the Passport OCR API in 10 seconds

One endpoint, one document type, one POST. Send a passport image as multipart/form-data, get back a normalised JSON payload you can store directly. Pick your language β€” the response shape is identical.

Request
curl -X POST "https://pictotext.io/api/v1/ocr" \
-H "Authorization: Bearer sk_live_YOUR_API_KEY" \
-F "documentType=passport"
JSON responseJSON
{
"passportNumber": "P12345678",
"name": "JOHN MICHAEL DOE",
"gender": "Male",
"birthDay": "1990-01-01",
"birthPlace": "NEW YORK, USA",
"issueDay": "2020-01-01",
"expiryDay": "2030-01-01",
"issuePlace": "WASHINGTON D.C.",
"nationality": "UNITED STATES OF AMERICA",
"mrz": "P<USADOE<<JOHN<MICHAEL<<<<<<<<<<<<<<<<<<<<<\n1234567890USA9001011M3001012<<<<<<<<<<<<<<08"
}

Every successful request returns the same shape. Dates are normalised to ISO 8601 (YYYY-MM-DD) and the MRZ string preserves its original line break as \n so you can re-validate the check digits client-side if you want to.

Fields extracted from every passport

The passport endpoint returns the same ten fields for every supported document. No optional flags, no field-by-field add-ons β€” what you see below is exactly what comes back in the JSON.

passportNumber

Document number printed on the data page and encoded in the MRZ.

name

Full name as printed in the visual inspection zone (surnames + given names).

gender

Sex/gender field from the data page, normalised to Male / Female / X.

birthDay

Date of birth, normalised to YYYY-MM-DD.

birthPlace

Place of birth as printed on the data page (where present).

issueDay

Date the passport was issued, normalised to YYYY-MM-DD.

expiryDay

Date the passport expires, normalised to YYYY-MM-DD.

issuePlace

Place of issue / issuing authority as printed on the data page.

nationality

Nationality, returned as the country name (or ISO 3-letter code where the data page does not print a long form).

mrz

Raw Machine Readable Zone string, two or three lines joined with \n exactly as printed.

Need extra fields like portrait crop, signature region or per-field confidence scores? Drop us a note β€” these are on our roadmap and we ship by use case.

How the passport OCR engine works

Under the hood, every passport image goes through three stages before the JSON lands in your response. Understanding what happens at each stage helps you debug edge cases β€” and explains why MRZ-based extraction is the most reliable signal you can ask for.

  1. Image preprocessing

    The engine first detects the passport data page inside whatever you send β€” phone snapshot, flatbed scan, photo of a screen. It deskews the page so MRZ lines are horizontal, normalises contrast to reduce glare and shadow, and crops out the bezel so the OCR model only looks at the document. Most real-world failures come from this stage, which is why we pre-process aggressively rather than expect a clean input.

  2. MRZ decoding (ICAO 9303)

    The Machine Readable Zone at the bottom of the data page is a deterministic, fixed-format string defined by ICAO Document 9303. We parse the two or three MRZ lines (TD3 for standard passports, TD1 and TD2 for ID-card-format travel documents) and validate the embedded check digits against the algorithm in the spec. Because the MRZ is OCR-A font designed to be machine-read, this stage is dramatically more reliable than reading the printed VIZ fields β€” and it surfaces tampering: a passport with mismatched check digits is suspect by definition.

  3. Visual inspection zone cross-check

    The engine then reads the printed visual fields above the MRZ β€” passport number, name, date of birth, expiry β€” and cross-validates them against the decoded MRZ. When the two agree, the response is high-confidence. When they disagree (a tampered or low-quality scan), the engine falls back to the more reliable signal: MRZ for structured fields, VIZ for fields the MRZ does not encode (place of birth, place of issue). The final JSON is one merged record, not two separate sources.

What teams build with the passport OCR API

The same endpoint powers identity onboarding, hospitality check-in, mobility, travel and cross-border commerce. A handful of patterns we see most often:

KYC and customer onboarding

Fintech, neobanks, crypto exchanges and remittance apps use the API as the document-extraction step inside a broader KYC flow: capture the passport in the mobile app, run OCR, surface the MRZ and visual fields to the user for confirmation, then push to a sanctions or PEP screening service. The structured JSON and MRZ check-digit signal make it straightforward to plug into an AML decisioning engine.

Hotel check-in automation

Property management systems and self-service kiosks read the passport once at arrival to pre-fill registration cards, send guest data to local police reporting systems (where required), and link the stay to a loyalty profile. Replacing manual typing at the front desk cuts check-in time by roughly two minutes per guest and removes a frequent data-entry error source.

Car and equipment rental

Rental companies pair passport OCR with driver-licence OCR to verify identity at counter pickup or on a mobile app before key handover. The passport endpoint contributes the long-form name and nationality; the driver-licence endpoint contributes the licence number and class. Both flow into the same booking record.

Airline and travel APIs

Airlines and OTAs collect Advance Passenger Information (API) and Secure Flight data from passport scans during booking or web check-in. Because the MRZ is the canonical source for nationality, document number, date of birth and expiry, OCR-then-MRZ-decode is more reliable than asking the passenger to retype the same fields manually.

Insurance claims and verification

Travel insurers and claims processors use passport OCR to verify the claimant identity, parse the date of birth for premium calculation, and confirm the document is still in date before a policy pays out. Pairing this with selfie liveness gives a remote-first claims flow that does not need a branch visit.

Cross-border e-commerce and customs

High-value cross-border shipments often require an identity document tied to the consignee for customs clearance. Sellers extract the passport details once at checkout, cache the structured record (with the buyer's consent) and reuse it for repeat international orders, removing manual paperwork from every subsequent purchase.

Passport OCR β€” frequently asked questions

Answers to the questions we get most often from engineering, product and compliance teams evaluating the passport OCR API.

Start extracting passport data in 3 minutes

Sign up, grab an API key from the dashboard, and POST your first passport image. The free trial includes 100 calls so you can validate the JSON shape against your own document distribution before committing.