Indian Passport OCR with the StructOCR Python SDK
Install the official Python SDK, extract validated Indian passport fields, and add the same workflow to a FastAPI service.

Challenges with Indian Passport Verification
Extracting accurate information—specifically trying to get the OCR number and back-page address details in an Indian passport—presents unique challenges. A significant portion of circulating passports utilize thick, glossy laminates that cause severe glare and reflection issues right over critical data zones like the document number. Furthermore, handling bilingual field descriptors in both Hindi (Devanagari script) and English, alongside complex background motifs featuring national emblems, requires specialized parsing logic. Unlike standard passports, Indian KYC requires parsing non-standard, bilingual addresses and relationship data from the back page, making a specialized extraction API essential for reliable processing.
Why StructOCR for Indian Passports
StructOCR offers unparalleled accuracy for Indian travel documents, including full support for the crucial last-page annexure. Our core platform is provided as a highly scalable REST API, supported by convenient SDK wrappers for rapid integration. Whether you need a powerful passport extraction api or comprehensive automated B2B passport verification software, our engine overcomes common optical obstacles like heavy glare. Want to see it in action? Upload an image to our live demo widget below for a free test. For production volumes, check out our flexible pricing plans. For the fastest Python integration, install the official StructOCR SDK and see the Python SDK documentation.
Built for High-Compliance Industries
- Travel & Aviation: Our technology serves as a critical verification solution for travel, enabling seamless integration with e-Visa processing and automated check-in systems. This speeds up passenger throughput at major hubs like Indira Gandhi International Airport (DEL).
- Financial Services: By integrating our sophisticated API, financial institutions can automate their KYC and AML onboarding workflows with confidence, ensuring compliance with strict Reserve Bank of India (RBI) regulations while instantly validating passport numbers and verifying address proofs from the back page.
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
Indian Passport OCR with the Python SDK
The official Python SDK handles file encoding, API communication, and structured passport results. Use the SDK directly or open the FastAPI tab for a server endpoint. Keep your API key in STRUCTOCR_API_KEY.
Prerequisite: `pip install structocr`; set the server-side `STRUCTOCR_API_KEY` environment variable.
Prefer another stack? Open the Node.js SDK + Express integration.
import os
from structocr import StructOCR
# Initialize StructOCR Client
client = StructOCR(os.environ["STRUCTOCR_API_KEY"])
def scan_india_passport():
image_path = "india_passport_sample.jpg"
try:
print(f"Scanning {image_path}...")
result = client.scan_passport(image_path)
if result.get('success'):
data = result['data']
print("✅ Passport Extraction Successful!")
print(f"Passport #: {data.get('passport_number')}")
print(f"Name: {data.get('given_names')} {data.get('surname')}")
print(f"Nationality: {data.get('nationality')}")
print(f"DOB: {data.get('date_of_birth')}")
# Extract Country Specific (Indian Passport Last Page / Annexure)
country_specific = data.get('country_specific', {})
last_page = country_specific.get('last_page')
if last_page:
print(f"Father: {last_page.get('father_name')}")
print(f"Spouse: {last_page.get('spouse_name')}")
print(f"Address: {last_page.get('address')}")
else:
print(f"❌ Extraction Failed: {result.get('error')}")
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
scan_india_passport()Technical Specs
- •Latency: < 3s (Average)
- •Uptime: 99.9% SLA
- •Security: AES-256 Encryption & SOC2 Compliant
- •Input: JPG, PNG, WebP, PDF (Max 4.5MB)
- •Output: JSON (Structured Data)
Key Features
- •Bilingual & Script Support: Reliably parses descriptors and names across English and Hindi (Devanagari) texts.
- •Heavy Glare Reduction: Automatically corrects severe lighting issues and reflections common on the thick laminates of Indian passports.
- •Visual Extraction (VIZ): Reliably extracts the passport number directly from the visual inspection zone, bypassing intricate background security motifs.
- •MRZ Parsing: Validates and cross-references visual data with the Machine Readable Zone.
- •Indian Passport Last Page Support: Automatically detects and parses the bilingual Annexure/back page, extracting parental names, spouse details, and addresses natively.
JSON Response Example
The Python SDK returns a dictionary matching this normalized JSON structure.
{
"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
Can I test the Indian passport OCR for free?
Yes! Use the live demo widget on this page to upload an image and extract the OCR number, MRZ, and back-page address instantly for free.
Is StructOCR an API or just an SDK?
StructOCR is primarily a robust REST API platform. We provide SDK wrappers (like Python, Java, and Node.js) simply to make integration faster for developers, but you can integrate via any HTTP client.
Does it work with older passport formats?
Yes, our engine is trained to handle both older, heavily laminated formats and the newer generation of Indian e-passports, ensuring broad compatibility.
You May Also Like
Related tutorials, platform guides, and comparisons
Indonesia Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Indonesia passports with a server-side integration.
Estonia Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Estonia passports with a server-side integration.
Singapore Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Singapore passports with a server-side integration.
Norway Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Norway passports with a server-side integration.
Bangladesh Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Bangladesh passports with a server-side integration.
South Africa Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from South Africa passports with a server-side integration.
Vietnam Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Vietnam passports with a server-side integration.
C# Passport OCR API
Upload an image for a free test! High-accuracy C# Passport OCR API for parsing MRZ data. Get structured JSON output from passport images. Eliminate Tesseract errors and manual entry.
Go Passport OCR API
Upload an image for a free test! Extract passport data via a simple REST API in Go. Get high-accuracy, ICAO-compliant JSON output from noisy images. Eliminate manual entry errors.
PHP Passport & Visa OCR API
Enterprise-grade PHP Passport & Visa OCR API. Test our instant JSON extraction for free. Accurate ICAO 9303 & identity document parsing with zero RegEx required.
Technical Comparisons & Integrations
Explore platform integrations and competitive analysis
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.
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.
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.