Documentation menu

Passport OCR & MRZ

Extract passport fields, read machine-readable zones, and check whether the printed and MRZ data agree.

POST/passport/scanmultipart/form-data

Request

Upload the passport photo page using the front multipart form-data field. JPEG and PNG are supported, with a published maximum file size of 20 MB.

Form fieldTypeRequired
frontImage fileYes

Set RAPIDAPI_KEY and RAPIDAPI_HOST to the values from this API’s listing. The following example uses a POSIX shell. Replace the local filenames with your images.

cURL
curl --request POST \
  --url "https://$RAPIDAPI_HOST/passport/scan" \
  --header "X-RapidAPI-Key: $RAPIDAPI_KEY" \
  --header "X-RapidAPI-Host: $RAPIDAPI_HOST" \
  --form 'front=@./front.jpg'

Response example

JSON
{
  "fields": {
    "documentNumber": "L898902C3",
    "surname": "ERIKSSON",
    "givenNames": "ANNA MARIA",
    "nationality": "UTO",
    "issuingState": "UTO",
    "birthDate": "1974-08-12",
    "sex": "F",
    "expiryDate": "2012-04-15"
  },
  "rawFields": {
    "DocumentNumber": {
      "value": "L898902C3",
      "content": "L898902C3",
      "confidence": 0.99
    }
  },
  "verification": {
    "match": true,
    "mrzValid": true,
    "format": "TD3",
    "fields": [],
    "issues": []
  },
  "selfConsistent": true,
  "issues": []
}
Illustrative response excerpt using fictional specimen data; raw MRZ omitted.

Response fields

FieldTypeMeaning
fieldsobjectExtracted document fields used for verification. Undetected fields may be null. Dates use yyyy-MM-dd.
rawFieldsobjectProvider OCR fields, each with value, printed content, and confidence from 0 to 1.
mrzstring | nullRaw machine-readable zone text, or null when none is detected.
verificationobject | nullThe automatic field-to-MRZ comparison and MRZ validity result. Null when no MRZ is found.
selfConsistentbooleanWhether the extracted visual-zone fields and MRZ are consistent.
issuesarrayDetected consistency issues. An empty array indicates no reported issues in this example.
Interpreting the result

The response excerpt uses public fictional specimen data. An internally consistent MRZ does not establish that a physical passport is genuine. Low-quality captures should be retaken; field disagreements may need review.

Additional MRZ endpoints

You can validate an MRZ without uploading an image, or compare fields you already have against an MRZ. Both operations use the passport API host and JSON requests.

Validate an MRZ

POST/passport/mrz/validation

Send a mrz string containing complete MRZ lines separated by a newline. The API supports TD1, TD2, and TD3 formats.

JSON
{
  "mrz": "P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<\nL898902C36UTO7408122F1204159ZE184226B<<<<<10"
}
Fictional ICAO specimen. The dates are sample document data, not an unexpired travel document.

The response includes valid, format, parsed fields, field-level check results, compositeCheckValid, and issues.

Compare fields against the MRZ

POST/passport/mrz/match-verification
JSON
{
  "mrz": "P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<\nL898902C36UTO7408122F1204159ZE184226B<<<<<10",
  "passport": {
    "documentNumber": "L898902C3",
    "surname": "Eriksson",
    "givenNames": "Anna Maria"
  }
}

Provide at least one passport field. Only supplied fields are compared. The result includes match, mrzValid, per-field comparisons in fields[], and issues. A match can coexist with an invalid MRZ, so inspect both flags.

Limits and integration notes

  • The published image upload limit is 20 MB. Resize files that exceed the limit before sending them.
  • Keep keys server-side and use the correct host for the API. See authentication.
  • Handle bad inputs and temporary failures using the error guide.
  • Vision input images are processed in-request without storage by Tigrate. See data handling.
Try Passport OCR & MRZ on RapidAPI

Based on the published RapidAPI reference, checked September 2026. Consult the listing for the latest full schema, optional parameters, and plan limits.

Questions about this integration?Contact the team