Passport MRZ OCR vs NFC Chip Reading
When to read a passport from a photo of the data page and when you need the e-passport chip, with the trade-offs for onboarding flows.
Photo-based OCR
Reads the data page from an image. It works on any device that can upload a photo, including desktops and kiosks, and returns the printed fields.
Extracting It Automatically
When you read this data from photos, the Passport OCR API returns it as structured JSON, and you can apply the rules on this page as validation. Try it with the free scanner.
Where This Fits
- NFC chip reading: Reads the signed data stored in the e-passport chip. It needs an NFC-capable phone or reader and the MRZ-derived access key, and it allows cryptographic checks of the data.
- Choosing: Use OCR when you need the data quickly with broad device support. Add chip reading when regulations or fraud risk require cryptographic proof that the data is genuine.
Extract It with the API
Read the document from a photo and validate the returned fields.
Prerequisite: Python 3.9+, `pip install requests`, and a STRUCTOCR_API_KEY
import base64
import os
import requests
with open("passport.jpg", "rb") as image_file:
image = base64.b64encode(image_file.read()).decode("ascii")
response = requests.post(
"https://api.structocr.com/v1/passport",
headers={"x-api-key": os.environ["STRUCTOCR_API_KEY"]},
json={"img": image},
timeout=30,
)
response.raise_for_status()
data = response.json()["data"]
print("passport_number:", data.get("passport_number"))
print("surname:", data.get("surname"))
print("given_names:", data.get("given_names"))
print("date_of_expiry:", data.get("date_of_expiry"))Technical Specs
- •Endpoint: POST https://api.structocr.com/v1/passport
- •Authentication: x-api-key request header
- •Inputs: JPG, PNG, or WebP as Base64 JSON; maximum 4.5MB
- •Price: 2 credits per successful request; failed requests are not billed
- •Free trial: 200 free credits on sign-up, no credit card required
Key Features
- •NFC chip reading: Reads the signed data stored in the e-passport chip. It needs an NFC-capable phone or reader and the MRZ-derived access key, and it allows cryptographic checks of the data.
- •Choosing: Use OCR when you need the data quickly with broad device support. Add chip reading when regulations or fraud risk require cryptographic proof that the data is genuine.
- •Validate after OCR: Apply these rules to API output before storing it.
Reference Summary
Key facts from this page in structured form, for quick lookup.
{
"Photo-based OCR": "Reads the data page from an image.",
"NFC chip reading": "Reads the signed data stored in the e-passport chip.",
"Choosing": "Use OCR when you need the data quickly with broad device support."
}Frequently Asked Questions
Does StructOCR read passport chips?
No. StructOCR reads images of the data page. Chip reading requires on-device NFC.
Can OCR output feed a chip read?
Yes. The passport number, date of birth, and expiry date from OCR are the inputs used to derive the chip access key.
You May Also Like
Related tutorials, platform guides, and comparisons
Belgium Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Belgium passports with a server-side integration.
Serbia Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Serbia passports with a server-side integration.
Lithuania Passport OCR: Extract Fields with Python
Extract visible fields from Lithuania passport images into JSON. Map identifiers, names and dates, with a review workflow for incomplete results.
Turkey Passport OCR with Node.js SDK
Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Turkey passports.
Algeria Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Algeria passports with a server-side integration.
Uzbekistan Passport OCR with Node.js SDK
Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Uzbekistan passports.
US Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from US passports with a server-side integration.
Uzbekistan Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Uzbekistan passports with a server-side integration.
US Passport OCR with Node.js SDK
Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from US passports.
Passport OCR API Pricing and Cost per Scan
What passport OCR costs with StructOCR: 2 credits per successful scan, prepaid credits that never expire, and no charge for failed requests.
Technical Comparisons & Integrations
Explore platform integrations and competitive analysis
AWS Textract & Google Vision vs. StructOCR Passport API
How AWS Textract AnalyzeID, Google Cloud Vision OCR, and the StructOCR Passport API differ for passport data, quoting each vendor’s own documentation.
Add Passport OCR to Your Bolt.new App in 5 Minutes
Step-by-step guide to integrating the StructOCR Passport scanner API into a Bolt.new app. Build travel, hospitality, and global KYC flows right in your browser.
Add Passport OCR using Cursor in 5 Minutes
Step-by-step guide to integrating the StructOCR Passport scanner API using the Cursor AI code editor. Build travel, hospitality, and global KYC flows rapidly.
Extracting ECR Status & File Numbers: Generic OCR vs. StructOCR Indian Passport API
Learn why generic text extractors fail to capture critical Indian KYC fields like ECR status and File Numbers, and how a specialized API structures this data automatically.
Heavy KYC SDKs vs. StructOCR Passport API for Mobile Apps
Discover why modern app developers are abandoning bulky on-device OCR SDKs in favor of lightweight, edge-deployed Passport APIs.
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.
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.