Use case · National ID cards
ID card OCR API
ID card OCR with Mahad OCR reads a national identity or residence card — front, back or both — and returns the ID number, names (including the Arabic name where printed), nationality, date of birth, sex, issue and expiry dates as JSON. Every field is marked ✓ confirmed or ⚠ check it: a value is confirmed when two independent readers agree on it, when the card’s machine-readable zone (MRZ) check digits prove it, or when a country number rule confirms it. The card is never “guessed”; a value nobody could confirm goes to a person.
Fields returned
| Key | What it holds |
|---|---|
| id_number | Required |
| full_name, surname, given_names | full_name required; the split where printed |
| name_arabic | Where the card prints the name in Arabic |
| date_of_birth, expiry_date | Required |
| nationality, sex, place_of_birth | Where printed |
| issue_date, place_of_issue | Where printed |
| occupation, employer, serial_number | Where printed (residence and work-permit cards) |
id_number, full_name, date_of_birth and expiry_date are required; a missing one is listed in missing_required and the card goes to review.
How ✓ and ⚠ work here
- ✓ Values both readers agree on (two independent readers read every card).
- ✓ Cards with a 3-line machine-readable zone (ICAO TD1, for example the Emirates ID back) get the number, date of birth and expiry checked against the MRZ check digits on our servers.
- ✓ Country number rules where we have them: Qatar ID, Emirates ID, Saudi Iqama, Aadhaar and PAN (see their own pages).
- ⚠ A value only one reader saw, or two readers disagree on, is marked for a person to check.
- ⚠ A card whose expiry date is in the past is “Needs review” with the reason “Document expired”, for every country.
Many countries, one result shape
The same request reads printed ID cards from different countries. The fields above are the same for every card, so your code maps one shape — not one per country.
Countries with extra checks (number structure, MRZ) get more ✓ fields automatically. Cards without them still get the two-reader check; you simply see more ⚠ fields for a person to confirm.
Front and back
Send the side that carries the details you need. Many cards print the MRZ only on the back; if you send that side, the MRZ checks apply. A single PDF with both sides is read as one document (up to 5 pages).
Example request and response
Fictional data, real response shape (trimmed to the keys that matter here). Full field list in the API reference.
curl -X POST https://api.mahadocr.com/v1/documents/upload \
-H "X-MahadDoc-API-Key: mk_live_YOUR_KEY" \
-F "[email protected]" \
-F "doc_type=id"
# 202 Accepted
# { "id": "DOC_3f9a1c7e2b40", "status": "processing", ... }
curl https://api.mahadocr.com/v1/documents/DOC_3f9a1c7e2b40 \
-H "X-MahadDoc-API-Key: mk_live_YOUR_KEY"{
"id": "DOC_3f9a1c7e2b40",
"status": "verified",
"result": {
"document_type": "id",
"values": {
"id_number": "784-1990-1234567-1", "full_name": "SAMPLE TEST PERSON",
"nationality": "IND", "date_of_birth": "1990-04-12", "expiry_date": "2028-03-01"
},
"field_evidence": { "id_number": "mrz", "date_of_birth": "mrz", "expiry_date": "mrz",
"full_name": "corroborated", "nationality": "corroborated" }
}
}Limits
- There is no lookup in any government register. Checks prove the card was read correctly, not that the card or person is genuine.
- Photos should be sharp, flat and without glare. A cut-off card edge or strong reflection sends fields to ⚠.
- Files: PNG, JPG, PDF or Word, up to 10 MB; a PDF is read up to its first 5 pages.
- The face photo is not compared with anything; there is no liveness or face matching.
How to do it
- 1POST the card image to /v1/documents/upload (doc_type=id is optional — the type is detected).
- 2Poll GET /v1/documents/{id} until result.status is not processing.
- 3Use result.field_evidence: “mrz”, “corroborated” and number-rule fields are confirmed; anything else needs a glance.
- 4Send cards whose status is review to a person, with the reasons listed in the result.
Frequently asked questions
Which countries’ ID cards can you read?
Printed ID and residence cards from many countries — test yours in the live demo first. Every card gets the two-reader check; Qatar ID, Emirates ID, Saudi Iqama, Aadhaar and PAN also get country number rules, and cards with an MRZ get check-digit verification.
Do you verify the card with the government?
No. The checks prove the values were read correctly. There is no government database lookup.
Should I send the front or the back?
The side with the details you need. If the back has an MRZ, sending it adds check-digit verification for the number and dates.
Is the Arabic name returned?
Yes, in name_arabic beside full_name when the card prints it. Names are never transliterated.
What happens with an expired card?
It is read normally and marked “Needs review” with the reason “Document expired”, so a person decides.
Can I try it without an account?
Yes — the live demo reads a card without an account, and the free Sandbox plan includes 50 documents a month.