REST API for Global Passport MRZ
Process passports from 195+ countries in milliseconds using a pure, high-performance REST API. Eliminate mobile SDK bloat and automate global identity verification instantly.

The Burden of Traditional OCR SDKs
For global SaaS and FinTech operators, extracting the Machine Readable Zone (MRZ) from international passports is critical for AML and KYC compliance. However, relying on heavy, proprietary mobile SDKs creates endless version conflicts, inflates app size, and forces developers to lock into specific frontend frameworks. For a broader look at frictionless onboarding architectures, explore our travel identity verification solutions.
StructOCR: The Pure REST API Solution
We believe in pure HTTP. Powered by our core Passport OCR engine, StructOCR delivers a stateless, high-concurrency REST API. Deployed across Cloudflare's ultra-fast edge network, our engine natively parses TD1, TD2, and TD3 MRZ formats. By supporting Base64 strings and direct file uploads, your architecture remains entirely under your control—keeping sensitive Personally Identifiable Information (PII) off public cloud URLs while achieving sub-1.2s extraction speeds.
Live Demo: Passport scanner
No registration required. Upload a file to test the extraction.
Drop files here or click to browse
JPG · PNG · WebP · up to 500 files · max 4.5 MB each
Global Industry Applications
Cross-Border FinTech & Web3
Scale your user onboarding globally without infrastructure bottlenecks. We natively support borderless Crypto/USDT payments for international SaaS operators. View our straightforward REST API pricing.
Airlines & OTA Booking
Automatically cross-reference extracted MRZ data with passenger PNRs (Passenger Name Records) to eliminate check-in errors and boarding friction.
Global HR & EOR Platforms
Verify Right-to-Work documents for remote hires across 195+ countries while maintaining strict GDPR and DPDP data compliance via our process-and-forget architecture.
Border Control & Logistics
Integrate seamlessly into custom Linux/Windows-based check-in kiosks where mobile SDKs cannot be deployed.
Technical Specs
- Pure REST Architecture: 100% HTTP/JSON based. Zero SDK dependencies, ensuring perfect compatibility with any backend language (Node.js, Python, Go, Rust).
- Edge Processing: Sub-1.2s latency globally, powered by Cloudflare's distributed edge network.
- Base64 & File Native: Stream image data directly to our endpoints securely without exposing PII on public cloud storage.
- Strict Normalization: Validates MRZ checksums and normalizes all dates to reliable ISO 8601 (`YYYY-MM-DD`) formatting.
Key Features
- Universal MRZ Parsing: Natively decodes ICAO Document 9303 standard formats including TD1, TD2, and TD3 strings.
- Checksum Validation: Automatically computes and verifies internal MRZ check digits to prevent tampering and optical errors.
- Zero Data Retention: Process-and-forget architecture instantly purges RAM, ensuring total GDPR and global privacy compliance.
Integration & AI Prompts
Call the REST API directly from any server environment using standard HTTP requests. For comprehensive payload schemas, consult our Passport OCR Developer Documentation.
import requests
import base64
# 📚 Developer Docs: https://structocr.com/developers/passport-ocr
# Note: StructOCR is strictly a REST API. Send Base64 natively
# from Python, Node.js, or Go without installing any SDKs.
with open("global_passport.jpg", "rb") as image_file:
base64_image = base64.b64encode(image_file.read()).decode('utf-8')
url = "https://api.structocr.com/v1/passport"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"img": base64_image
}
try:
# Relayed through Cloudflare Edge for sub-second MRZ parsing
print("Extracting MRZ Data via REST...")
response = requests.post(url, headers=headers, json=payload)
result = response.json()
if result.get('success'):
print("✅ Global MRZ Extraction Complete!\n")
# Standardized ISO 8601 Data
core = result['data']
print(f"Holder: {core.get('given_names')} {core.get('surname')}")
print(f"Document: {core.get('passport_number')} ({core.get('country_code')})")
print(f"Expires: {core.get('date_of_expiry')} (ISO 8601 Validated)")
else:
print(f"❌ Extraction Failed: {result.get('error')} - {result.get('message')}")
except Exception as e:
print(f"Error: {e}")Standardized JSON Output
Receive deterministic, cleanly structured MRZ data. When applicable, the API also intelligently captures country-specific VIZ (Visual Inspection Zone) annexures.
{
"success": true,
"data": {
"type": "passport",
"country_code": "IND",
"nationality": "INDIAN",
"passport_number": "Z1234567",
"surname": "SHARMA",
"given_names": "RAHUL",
"sex": "M",
"date_of_birth": "1988-07-22",
"place_of_birth": "NEW DELHI",
"date_of_issue": "2021-04-10",
"date_of_expiry": "2031-04-09",
"issuing_authority": "MINISTRY OF EXTERNAL AFFAIRS",
"country_specific": {
"last_page": {
"father_name": "AMIT SHARMA",
"mother_name": "SITA SHARMA",
"spouse_name": "PRIYA SHARMA",
"address": "FLAT 4B, GREENWOOD APARTMENTS, NEW DELHI PIN: 110001, INDIA",
"old_passport_number": "P7654321",
"old_passport_issue_date": "2010-01-05",
"old_passport_issue_place": "DELHI",
"file_no": "DL1076071103622",
"ecr_status": null
}
}
}
}Frequently Asked Questions
Why use a REST API instead of a mobile SDK for passport scanning?
A pure REST API eliminates mobile app bloat, prevents OS version conflicts, and allows you to centralize your KYC logic on the backend. You can build a fully custom frontend UI using your preferred framework and simply pass the Base64 image securely to our Cloudflare edge nodes.
Does the API validate the MRZ checksums?
Yes. Our engine automatically computes the check digits embedded within the MRZ strings (for dates, passport numbers, and the composite check digit) to ensure the optical reading is 100% accurate and mathematically valid.
What image formats are supported by the REST API?
The endpoint accepts direct file uploads (multipart/form-data) or Base64 encoded strings in standard data URI formats (JPG, PNG, WebP) up to a maximum payload size of 4.5MB.
Explore More Travel & KYC Solutions
Right-to-Work Passport Verification API
Automate global HR compliance. Extract passport data instantly with our zero-retention OCR API. No SDK required. Upload an image to test our free live demo.
Zero-Retention Passport OCR for Neo-Banks
Secure your digital onboarding with our zero-retention passport OCR API for neo-banks. Process global KYC data in-memory. Upload an image to test free.
Automated Hotel Check-In Passport Scanner API
Streamline hotel check-ins with our automated passport scanner API. Extract global guest data instantly without SDKs. Upload an image to test our free live demo.
Crypto KYC Passport API (No SDK Required)
Zero-retention Passport OCR API for Web3 and Crypto KYC. Extract global MRZ and VIZ data instantly without SDK bloat. Upload an image to test our free live demo.
DPDP Compliant Indian Passport OCR
DPDP-compliant, zero data retention OCR API for Indian passports. Securely extract back-page PII (Address, Parents' Names) for KYC workflows. File, Base64, and URL supported.
GDPR-Compliant Passport Data Extraction
Extract passport data securely with our GDPR-compliant, zero-retention OCR API. No data stored or logged. Upload an image to test our free live demo.
India Passport Address Extraction API
Extract highly complex address blocks and PII from Indian passport back pages. Zero-retention OCR API built for global KYC workflows. Supports Base64, URLs, and direct file uploads.
Indian Passport OCR for KYC & AML
Automate digital KYC. Extract MRZ, family, and address details from Indian Passports for RBI compliance. Upload a test image for a free live API demo.
Indian Passport Family Details OCR
Extract Father, Mother, and Spouse names from the back page of Indian passports for background verification. Zero-retention API-first integration.
ISO 8601 Passport Date Parsing API
Stop writing complex regex. Automatically extract and normalize passport dates to strict ISO 8601 (YYYY-MM-DD) format. Upload an image to test our free live demo.
Technical Comparisons & Integrations
Explore platform integrations and competitive analysis
Add Passport OCR to Your Lovable.dev App in 5 Minutes
Step-by-step guide to integrating the StructOCR Passport scanner API into a Lovable.dev app through a secure server-side function for travel and KYC flows.
Add Passport OCR to Your Replit App in 5 Minutes
Step-by-step guide to integrating the StructOCR Passport scanner API into a Replit application. Build travel, hospitality, and global KYC flows using Replit Agent and Secrets.
Tesseract & PassportEye vs. StructOCR Passport API
A technical evaluation for developers deciding between open-source MRZ scanners and a dedicated cloud-based Passport OCR API.
Add Passport OCR to Your v0 App in 5 Minutes
Step-by-step guide to integrating the StructOCR Passport scanner API into a v0 by Vercel app through a secure Next.js server route.
AWS Textract vs. StructOCR API for Indian Passport Back Page Extraction
Why generic OCR fails at parsing the back page of Indian passports, and how a dedicated KYC API instantly extracts structured addresses, PIN codes, and family details.
AWS Textract & Google Vision vs. StructOCR Passport API
Why generic cloud OCR APIs fail at structured KYC automation, and why developers choose specialized Passport APIs instead.
From tutorial to production in 5 minutes.
You've seen the code. Now get your API key, grab your 200 free credits, and see it work with your own images. No credit card required.