Use case · Qatar residency ID
Qatar ID (QID) OCR API
Qatar ID OCR with Mahad OCR reads the Qatari residency card (QID) and returns the QID number, name, nationality, date of birth, expiry date, occupation and employer as JSON. Two independent readers read the card, and the 11-digit QID number is cross-checked against the card itself: its encoded birth year must match the date of birth and its country code must match the nationality, or the card goes to review.
Fields returned
| Key | What it holds |
|---|---|
| qid_number | The 11-digit QID number (also returned as id_number and document_number) |
| full_name | English name as printed; name_arabic is kept beside it where printed |
| nationality | As printed |
| date_of_birth, expiry_date | ISO dates |
| occupation, employer | As printed on the card |
| sex, issue_date, serial_number | Where printed |
id_number, full_name, date_of_birth and expiry_date must be settled before a card can be verified.
How ✓ and ⚠ work here
- ✓ Values both readers agree on (evidence reader_agree).
- Structure check on the QID number (11 digits: century, birth year, 3-digit country code, serial).
- Cross-checks: the birth year in the number against date_of_birth, and the country code against nationality. A mismatch fails data_correct and the card goes to review.
- ⚠ A single-reader or disputed value is marked for a person to check.
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=qid"
# 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": {
"status": "verified",
"decision": "verified",
"document_type": "qid",
"values": {
"qid_number": "29035612345", "id_number": "29035612345", "document_number": "29035612345",
"full_name": "RAVI SPECIMEN TESTKUMAR", "nationality": "INDIA",
"date_of_birth": "1990-04-15", "expiry_date": "2028-06-30",
"occupation": "PIPE WELDER", "employer": "TEST ENGINEERING W.L.L."
},
"field_evidence": { "full_name": "corroborated", "date_of_birth": "corroborated" },
"disputed_fields": [],
"review_reasons": [],
"verification": {
"evidence": [
{ "level": "L1", "rule": "qid_structure", "result": "passed", "fields": ["id_number"] },
{ "level": "L2", "rule": "qid_birth_year_matches_dob", "result": "passed",
"fields": ["id_number", "date_of_birth"], "detail": "number says 1990" },
{ "level": "L2", "rule": "qid_country_matches_nationality", "result": "passed",
"fields": ["id_number", "nationality"], "detail": "number says India" }
]
}
}
}Limits
- The QID number checks are consistency checks on what is printed. Mahad OCR does not query the Ministry of Interior or any Qatari government system.
- The country-code check only runs for country codes in the engine’s table; for others it is skipped, not passed.
- Upload the side that carries the data you need; the back of the card is a separate image.
- Files: PNG, JPG, PDF or Word, up to 10 MB.
How to do it
- 1Create an API key at app.mahadocr.com.
- 2POST the card image to /v1/documents/upload (doc_type=qid is optional).
- 3Poll GET /v1/documents/{id}; read result.values and result.verification.evidence.
- 4Route documents with result.decision = review to a person, showing result.review_reasons.
Frequently asked questions
What does the QID number encode?
The 11 digits hold a century digit, the last two digits of the birth year, a 3-digit ISO country code for nationality, and a serial number. Mahad OCR uses the first three parts as cross-checks against the printed card.
Does Mahad OCR verify a QID with the Qatari government?
No. The checks compare the number with the rest of the card. There is no government lookup.
Is the Arabic name returned?
Where the card prints it, the Arabic name is returned as name_arabic, shown beside the English full_name.
What makes a QID go to review?
A disputed or unreadable required field, a birth year or country code in the number that does not match the card, an expired card, or a photo that must be retaken.
Can I read QIDs in bulk?
Yes. POST /v1/documents/batch accepts up to 20 files per request; your plan quota is checked for the whole batch first.
Where can I learn how the QID number works?
See the Qatar ID guide in Guides, which explains the number layout and what Mahad OCR does with it.