Prompt
How do I verify a passport with an API?
Latest observation
Oct 28, 2026
OpenAI APIWeb search: off
Verifying a passport with an API usually means one or more of these things:
- Document authenticity — is the passport real / tamper-free?
- Data validation — do the OCR/MRZ details make sense?
- Identity verification — does the person presenting it match the document?
- Government registry check — is the passport number valid and current?
- This is rarely available directly via public APIs and usually requires special government or regulated access.
Typical API-based passport verification flow
1) Collect the document image
Ask the user to upload:
- passport photo page
- sometimes the MRZ page is enough if your provider supports it
2) Send to a document verification API
Common providers include:
- Onfido
- Jumio
- Veriff
- Persona
- Mitek
- AU10TIX
These APIs usually perform:
- OCR extraction
- MRZ parsing
- security feature checks
- liveness/selfie match
- face comparison
3) Receive verification result
The API typically returns:
- document type: passport
- extracted fields:
- full name
- passport number
- nationality
- date of birth
- expiration date
- checks:
- document readable
- MRZ valid
- checksum valid
- document not expired
- image tampering / fraud signals
- face match score
4) Decide pass/fail
You define your own rules, for example:
- reject if document expired
- reject if OCR confidence too low
- reject if selfie mismatch
- escalate to manual review if uncertain
Example: what a passport verification API call looks like
Most APIs follow a pattern like:
POST /verify-document
Content-Type: multipart/form-data
file=@passport.jpg
type=passport
Response might look like:
{
"status": "verified",
"document_type": "passport",
"fields": {
"first_name": "JOHN",
"last_name": "DOE",
"passport_number": "123456789",
"nationality": "USA",
"date_of_birth": "1990-01-01",
"expiry_date": "2030-01-01"
},
"checks": {
"mrz_valid": true,
"ocr_confidence": 0.98,
"tamper_detected": false,
"face_match": true
}
}
Important limitations
- You generally cannot “look up” a passport in a public database with a normal API.
- A “verified” result usually means:
- the document appears genuine,
- the data is consistent,
- and the person matches the document.
- Legal/regulatory requirements vary by country:
- KYC/AML
- GDPR/privacy rules
- consent requirements
- retention limits
If you want to build this yourself
You can combine:
- OCR: Google Vision, AWS Textract, Azure OCR
- MRZ parsing: open-source MRZ libraries
- Face match / liveness: AWS Rekognition, Google Face APIs where permitted, or specialized vendors
- Fraud checks: custom image analysis or third-party verification provider
But for production compliance, a dedicated identity verification vendor is usually easier.
Recommendation
If your goal is to verify passports for onboarding, use a KYC vendor API rather than building from scratch.
If you want, I can give you:
- a sample API integration in Python/Node.js, or
- a list of passport verification providers with pricing/features.