Identity & travel

Reading passports and national IDs with OCR

21 Jun 2026·Mahad OCR·3 min read

Reading passports and national IDs with OCR

Identity documents are the most common thing teams need to digitise — for onboarding, recruitment, KYC and travel. OCR reads them in seconds and validates the data automatically.

Passports: the MRZ is your friend

Every passport has a Machine-Readable Zone (MRZ) — the two lines of characters at the bottom. Mahad OCR parses the MRZ and validates its ICAO check digits, so you get the surname, given names, passport number, nationality, date of birth, sex and expiry with high confidence — and it runs free, on-server (no per-document AI cost).

National IDs, any country

For documents without an MRZ, the engine uses AI vision to detect the document type and extract the right fields — name, ID number, date of birth, expiry — with a confidence score on each.

Built-in fraud checks

Every upload runs a 5-check tamper panel (EXIF, MRZ checksum, error-level analysis, background noise, and re-upload detection) and returns a tamper score, so photoshopped IDs are flagged before a human sees them.

curl -X POST https://api.mahadocr.com/v1/documents/upload \
  -H "X-MahadDoc-API-Key: YOUR_KEY" \
  -F "file=@document.jpg"

# poll the result
curl https://api.mahadocr.com/v1/documents/DOC_xxx \
  -H "X-MahadDoc-API-Key: YOUR_KEY"

Try Mahad OCR on your own documents

Sign up free, get an API key, and read your first document in minutes — passports, IDs, invoices, statements and more.

Get your API key  or try the live demo →

More from the blog

Security

How OCR detects tampered or fake documents

3 min read
Automation

Automate document data entry with one API

3 min read
Finance & accounting

Digitizing bank statements into structured data

3 min read