Quickstart
Extract your first passport in a minute.
Subscribe on RapidAPI1. Get access
Subscribe to the Passport Extractor API on RapidAPI and use the code snippets on its API page: they include everything your requests need. The examples here show only the paths and fields, with this base URL:
export BASE_URL="https://passport-data-extraction-ai-ocr.p.rapidapi.com"2. Upload the front page
Send multipart/form-data with the passport's photo/data page in the front_page field.
curl -X POST "$BASE_URL/passport-extractor/v1/extract" \
-F "front_page=@passport-front.jpg"{
"success": true,
"data": {
"full_name": "JANE MARIE DOE",
"given_name": "JANE MARIE",
"surname": "DOE",
"date_of_birth": "1988-03-14",
"nationality": "UTO",
"passport_number": "X4821937",
"issue_date": "2023-07-22",
"expiry_date": "2033-07-21",
"issuing_country": "UTO",
"sex": "F",
"place_of_birth": "UTOPIA CITY",
"place_of_issue": "UTOPIA CITY",
"father_name": null,
"mother_name": null,
"spouse_name": null,
"address": null,
"file_number": null,
"previous_passport": null,
"mrz": {
"line1": "P<UTODOE<<JANE<MARIE<<<<<<<<<<<<<<<<<<<<<<<<",
"line2": "X4821937<9UTO8803148F3307216<<<<<<<<<<<<<<00",
"check_digits_valid": true
}
},
"meta": {
"document_type": "passport",
"request_id": "req_3f2a9c1e7b4d4e0a",
"pages": [{ "label": "front_page", "file_type": "image/jpeg" }]
}
}The sample data is fictional (UTO is the specimen country code used in travel-document standards). The last-page
fields are null because no last page was uploaded.
3. Add the last page
Some passports print the holder's address and family details on the last page (for example Indian passports). Add it
in the last_page field. Each page is read separately and the results are combined into one response.
curl -X POST "$BASE_URL/passport-extractor/v1/extract" \
-F "front_page=@passport-front.jpg" \
-F "last_page=@passport-last.jpg"{
"father_name": "JOHN DOE",
"mother_name": "MARY DOE",
"spouse_name": null,
"address": "12 EXAMPLE STREET, OLD TOWN, UTOPIA CITY 100001",
"file_number": "UT1067123456789",
"previous_passport": null
}(Only the last-page fields of data are shown.) See Fields and MRZ for what each field means, and
Errors and limits for file types and sizes.