Skip to Content
APIGeineAPIGeine

Fields and MRZ

What each field contains and how the MRZ is checked.

Subscribe on RapidAPI

Pages

FieldRequiredPage
front_pageYesThe photo/data page: the holder's photo, personal details and the MRZ
last_pageNoThe last page, on passports that print the holder's address and family details there

One file per field. Each page is read on its own and the results are combined. meta.pages lists the pages received, front_page first.

Fields

FieldPageFormatNotes
full_namefrontstringAs printed
given_namefrontstringGiven name(s)
surnamefrontstringSurname / family name
date_of_birthfrontYYYY-MM-DD
nationalityfront1–3 lettersCode used on travel documents, for example IND or D (Germany)
passport_numberfrontstringWithout spaces
issue_datefrontYYYY-MM-DD
expiry_datefrontYYYY-MM-DD
issuing_countryfront1–3 lettersIssuing country or authority code
sexfrontM, F or XX when the document shows an unspecified marker
place_of_birthfrontstringAs printed
place_of_issuefrontstringAs printed
father_namelaststringFather or legal guardian
mother_namelaststring
spouse_namelaststring
addresslaststringAs printed, lines joined with ,
file_numberlaststringWithout spaces
previous_passportlastobject{ number, issue_date, place_of_issue }, or null when none is listed
mrzfrontobjectSee below; null when no MRZ line was read

Every field is always present. It is null when the value is missing, unreadable or ambiguous, and last-page fields are null when no last_page was uploaded. The API never guesses:

  • Dates are converted to YYYY-MM-DD only when the printed date is unambiguous.
  • Look-alike characters (O/0, I/1) in passport and file numbers are never swapped.
  • Country fields contain codes only. When the code cannot be read but the MRZ verifies, the code printed in the MRZ is used.

MRZ

The machine readable zone is the two lines of <-padded text at the bottom of the photo page.

FieldMeaning
mrz.line1First line, as read (spaces removed), with one kind of correction: see below
mrz.line2Second line, as read (spaces removed), with two kinds of correction: see below
mrz.check_digits_validtrue when all five check digits match, false when any does not, null when line 2 was not read as a complete 44-character line

check_digits_valid is calculated by the API using the passport MRZ rules of ICAO Doc 9303. It is not an estimate. A false value usually means a character was misread: treat the MRZ, and the fields it covers (passport number, dates of birth and expiry), with care.

Corrections. The API corrects common reading errors only where the result can be confirmed:

  • Digits in line 2. Some positions can only hold digits (dates and check digits). A letter read there (for example Z instead of 2, or O instead of 0) is replaced with the digit it resembles, but only if every check digit is then valid.
  • Passport number in line 2. When the passport number in line 2 fails its check digit, the passport number printed on the page is tried in its place, and kept only if every check digit is then valid.
  • Start of line 1. Line 1 always starts with P and a type character. When these are missing and the issuing-state code that follows matches the nationality in line 2 or the issuing country on the page, they are restored.
  • Fillers. Missing or extra < fillers are fixed where their count is unambiguous.

Otherwise lines are returned as read. All check digits are in line 2, so check_digits_valid is based on line 2 alone. Line 1 (document type, issuing country and name) has no check digits, so a true result does not confirm it.

Tips for good results

  • Upload each page flat and in focus; on the front page, keep the whole MRZ visible.
  • Avoid glare and strong shadows; crop out the background if you can.
  • PDFs must contain selectable text. Scanned PDFs without text cannot be read: upload the scan as an image instead.

On this page