Services
National ID card OCR
Reads the front and back of the Iranian national ID card, checks the national code checksum and expiry, and can compare the card with what the customer typed.
Service codenational_card_ocr
What the customer provides
- Photo of the front of the national ID card.
- Photo of the back of the card, when
require_backis on. - National code (10 digits).
- Date of birth in the Persian calendar.
Outcomes
The step ends with one of these keys in steps[].outcome. In an advanced flow, each one can lead to a different step or end.
| Outcome | Meaning |
|---|---|
verified | The card was read and every check passed. |
unreadable | The card could not be read: wrong document, blur, glare or a side is missing. |
rejected | The card was read but a check failed, such as an expired card or a different national code. |
Settings
You set these per flow in the panel flow builder.
| Setting | Default | Meaning |
|---|---|---|
confirm_national_code | true | Ask for the national code; it must match the card. |
confirm_birth_date | false | Ask for the birth date; it must match the card. |
require_back | true | The back of the card is required. |
min_confidence | 8550–100 | A field read with lower confidence (percent) counts as unreadable. |
reject_expired | true | Reject expired cards. |
accept_old_card | false | Also accept old paper national cards. |
return_fields | true | Add the fields read from the card to the result. |
Result
The step result comes from the engine ai_engine
| Field | Meaning |
|---|---|
data.cardType | Card type the engine detected. |
data.fields | Fields read from the card (with return_fields): nationalCode, firstName, lastName, fatherName, birthDate, expiryDate, serial. |
data.issues | Image problems the engine found, such as blur or a photo of a screen. |
data.minConfidence | The minimum confidence that was applied. |
Reasons
national_code_mismatchbirth_date_mismatchnational_code_invalidcard_expiredold_card_not_acceptednot_a_national_cardfront_missingback_missingimage_<issue><field>_unreadable
Values in angle brackets stand for a family of reasons: provider_… means the engine could not be reached or returned an error, and the outcome is error.