How to OCR the Number in an Indian Passport

Instantly extract the passport number, visual data, and back-page annexure details via our core API. Upload an image to the widget below for a free live test.

AI extracting the OCR number in an Indian passport
StructOCR engine analyzing an Indian passport and extracting the number and structured data in real-time.

Challenges with Indian Passport Verification

Extracting accurate information—specifically trying to get the OCR number 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. These factors make a specialized extraction API essential for reliable processing.

Why StructOCR for Indian Passports

StructOCR offers unparalleled accuracy for Indian travel documents. 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 travel identity 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.

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.

Live Demo: Passport scanner

No registration required. Upload a file to test the extraction.

1
Upload
2
Results

Drop files here or click to browse

JPG · PNG · WebP  ·  up to 500 files · max 4.5 MB each

No files selected

Ready to use this in production? Get 20 free API calls — no credit card needed.

Get 20 Free API Calls →

API & Python Wrapper Integration

Our core platform is a powerful REST API. Below is an example using our Python SDK wrapper (`pip install structocr`) for quick setup. It demonstrates how to parse standard fields as well as specific data from the Indian passport's back page. If you prefer to make raw HTTP requests, please read our official API documentation.

Prerequisite: Python 3.6+ and `structocr` library installed.

PYTHON EXAMPLE
from structocr import StructOCR

# Initialize StructOCR Client
client = StructOCR("YOUR_API_KEY_HERE")

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: < 5s (Average)
  • Uptime: 98.5% SLA
  • Security: AES-256 Encryption & SOC2 Compliant
  • Input: JPG, PNG, WebP (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 API returns a JSON structure containing the extracted passport number, demographics, and back-page annexure details.

{
  "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 in an Indian passport 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.

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.

More OCR Tutorials

Precise Data Extraction and Seamless Integration with AI-powered OCR API.

Empower your solutions with automated data extraction by integrating best-in class StructOCR via API seamlessly.

No credit card required • Full API access included