Global ID Verification API
Send images of a foreign passport or ID card (and a selfie if you like). We read the fields, validate the MRZ, score how genuine the document looks and match the face.
- Source
- The document image itself: OCR, MRZ check digits and visual security-feature analysis. No live foreign government lookup.
- Turnaround
- Real time, usually a few seconds per document
- Endpoint
- POST /v1/global-id/verify
- Who can use it
- Any business onboarding non-Indian customers or NRIs, with their consent.
Overview
When the customer isn't Indian, the usual government sources don't apply. This API reads the document, validates the machine-readable zone, looks for signs of tampering and matches the photo to a selfie. It suits NRI onboarding, foreign students and cross-border sellers.
Good to know
This is a document check, not a government database check. A real passport that was reported stolen will still pass unless you add a sanctions or watchlist screen.
What you get
- MRZ validationCheck digits in the MRZ catch many crude forgeries and mistyped numbers.
- Wide document coveragePassports from almost every country, plus common national ID cards and residence permits.
- Authenticity scoreSignals like font, layout and photo tampering roll up into one score you can threshold.
- Optional face matchSend a selfie in the same call to tie the person to the document.
Request
POST https://api.ampletrails.com/v1/global-id/verify
| Field | Type | Status | Description |
|---|---|---|---|
front_image_base64 | string | Required | Front of the document (or passport data page), base64 encoded |
back_image_base64 | string | Optional | Back of the ID card, if applicable |
country | string | Optional | ISO country code of the issuing country, if known |
selfie_base64 | string | Optional | Optional selfie to match against the document photo |
Response
Fields inside data. Every response also carries status, request_id and, on errors, message. See error codes.
| Field | Meaning | Example |
|---|---|---|
document_type | Detected document type | PASSPORT |
issuing_country | Issuing country (ISO code) | AE |
full_name | Name on the document | RAVI KUMAR |
document_number | Document number | X1234567 |
dob | Date of birth | 1990-04-12 |
expiry_date | Document expiry date | 2031-05-09 |
mrz_valid | Whether the MRZ check digits are valid | true |
authenticity_score | Confidence score that the document is genuine, from 0 to 100 | 92 |
face_match_score | Selfie-to-document face match score, if a selfie was sent | 95 |
Example
curl -X POST https://api.ampletrails.com/v1/global-id/verify \
-H "Authorization: Bearer $AMPLE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"front_image_base64": "/9j/4AAQSkZJRg...", "back_image_base64": "/9j/4AAQSkZJRg...", "country": "AE", "selfie_base64": "/9j/4AAQSkZJRg...", "consent": "Y"}'import os, requests
resp = requests.post(
"https://api.ampletrails.com/v1/global-id/verify",
headers={"Authorization": f"Bearer {os.environ['AMPLE_API_KEY']}"},
json={
"front_image_base64": "/9j/4AAQSkZJRg...",
"back_image_base64": "/9j/4AAQSkZJRg...",
"country": "AE",
"selfie_base64": "/9j/4AAQSkZJRg...",
"consent": "Y"
},
timeout=30,
)
resp.raise_for_status()
print(resp.json()["data"])const resp = await fetch("https://api.ampletrails.com/v1/global-id/verify", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AMPLE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"front_image_base64": "/9j/4AAQSkZJRg...",
"back_image_base64": "/9j/4AAQSkZJRg...",
"country": "AE",
"selfie_base64": "/9j/4AAQSkZJRg...",
"consent": "Y"
}),
});
const { data } = await resp.json();$ch = curl_init("https://api.ampletrails.com/v1/global-id/verify");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("AMPLE_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode(["front_image_base64" => "/9j/4AAQSkZJRg...", "back_image_base64" => "/9j/4AAQSkZJRg...", "country" => "AE", "selfie_base64" => "/9j/4AAQSkZJRg...", "consent" => "Y"]),
]);
$data = json_decode(curl_exec($ch), true)["data"];{
"status": "success",
"request_id": "req_7f3a9c21e4",
"data": {
"document_type": "PASSPORT",
"issuing_country": "AE",
"full_name": "RAVI KUMAR",
"document_number": "X1234567",
"dob": "1990-04-12",
"expiry_date": "2031-05-09",
"mrz_valid": true,
"authenticity_score": 92,
"face_match_score": 95
}
}Example data. The exact field list for your account comes with your sandbox documentation.
Use cases
NRI banking and investment
Verify the foreign passport or residence card alongside Indian documents.
Cross-border marketplaces
Onboard foreign sellers or buyers who don't have Indian ID.
Hospitality and education
Hotels, hostels and universities check foreign nationals' documents at arrival.
Questions about this API
Is this checked against the issuing government?
No. We verify the document itself. For high-risk products, add AML screening and, where possible, a second source.
Which image quality works best?
A flat, well-lit photo with all four corners visible and no glare on the photo page. Blurry images lower the score.
Do you support residence permits and visas?
Many residence permits, yes. Visas vary a lot; send us samples of the ones you see and we'll confirm.
Does it work for Indian passports?
It reads them, but for Indian passports the Passport Verification API checks the official record, which is stronger.
Try the Global ID Verification API
Sandbox keys, the full field reference and a Postman collection, usually within a working day.