ISO 8601 Passport Date Parsing API

Stop wrestling with complex regex and localization bugs. Instantly extract and normalize passport birth dates, issue dates, and expiry dates into strict YYYY-MM-DD format.

Normalizing global passport dates into strict ISO 8601 YYYY-MM-DD format using a REST API.

The Nightmare of Global Date Formats

Extracting dates from international passports is notoriously difficult. Different countries use varying visual formats (e.g., DD MMM YY, DD/MM/YYYY) and localized month abbreviations (like 'FEV' for February or 'MAI' for May). Relying on heavy mobile SDKs or writing custom regex to parse these locally often leads to timezone bugs, application crashes, and rejected KYC applications. For a broader look at frictionless onboarding architectures, explore our travel identity verification solutions.

StructOCR: Deterministic Date Normalization

Powered by our core Passport OCR engine, StructOCR completely eliminates date parsing errors. We provide a pure, API-first architecture—meaning zero SDK bloat. Whether you upload a direct file or stream a Base64 string to our Cloudflare edge nodes, the engine intelligently parses both the MRZ and VIZ, automatically normalizing all dates into the universally accepted ISO 8601 (`YYYY-MM-DD`) standard before returning the JSON.

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 →

Core Developer Applications

Age Verification & KYC

Calculate a user's exact age deterministically for Crypto, Gaming, or FinTech onboarding without worrying about epoch conversion errors. We support Crypto/USDT payments for global Web3 developers. View our straightforward API pricing.

Airlines & APIS Validation

Instantly verify if a passport's expiry date meets the strict "6-month validity" rule required for international flight boarding.

Visa & Immigration Software

Autofill visa application forms accurately by converting complex visual date strings into standardized database fields.

Hotel Property Management (PMS)

Ensure all guest records maintain perfect database hygiene by standardizing date of birth and expiry entries across all properties.

Technical Specs

  • Strict ISO 8601 Normalization: Guarantees all extracted dates (`date_of_birth`, `date_of_issue`, `date_of_expiry`) are returned perfectly as `YYYY-MM-DD`.
  • API-First Architecture: 100% RESTful integration eliminates the need for OS-specific SDKs and version conflicts.
  • Edge Processing: Sub-1.2s latency globally, powered by Cloudflare's distributed edge network.
  • Base64 & File Native: Stream image data securely without exposing PII on public cloud storage.

Key Features

  • MRZ Checksum Validation: Automatically verifies the mathematical check digits tied to date fields in the MRZ to ensure 100% optical accuracy.
  • VIZ Language Translation: Intelligently maps localized month abbreviations (e.g., 'AOU', 'OCT', 'DEZ') found in the visual zone into standard numerical formats.
  • Zero Data Retention: Process-and-forget architecture instantly purges RAM, ensuring total GDPR and DPDP compliance.

Integration & AI Prompts

Integrate directly using standard HTTP requests. Avoid SDK compatibility issues by passing Base64 directly to the API. For complete payload schemas, consult our Passport OCR Developer Documentation.

import requests
import base64
from datetime import datetime

# 📚 Developer Docs: https://structocr.com/developers/passport-ocr

# Note: StructOCR is strictly API-first. Send Base64 natively 
# without installing any complex date-parsing SDKs.

with open("traveler_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:
    # Processed securely at the Cloudflare edge
    response = requests.post(url, headers=headers, json=payload)
    result = response.json()

    if result.get('success'):
        print("✅ ISO 8601 Extraction Complete!\n")
        core = result['data']
        
        dob = core.get('date_of_birth')
        expiry = core.get('date_of_expiry')
        
        print(f"Holder: {core.get('given_names')} {core.get('surname')}")
        print(f"DOB:    {dob} (Ready for DB insertion)")
        print(f"Expiry: {expiry}")
        
        # Easy deterministic date logic in Python
        if datetime.strptime(expiry, "%Y-%m-%d") > datetime.now():
            print("Status: 🟢 Document is currently valid.")
        else:
            print("Status: 🔴 Document has expired.")
    else:
        print(f"❌ Extraction Failed")
except Exception as e:
    print(f"Error: {e}")

Standardized JSON Output

Receive deterministic, cleanly structured MRZ and VIZ data with perfectly formatted date fields.

{
  "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

How does the API handle 2-digit years found in the MRZ?

The MRZ format uses a 2-digit format for years (e.g., '88' for 1988 or '24' for 2024). Our engine uses intelligent pivot-year logic based on the specific field (DOB vs Expiry) to accurately infer the century and normalize the output to a full 4-digit year (YYYY).

Does the API handle non-English month abbreviations in the visual zone?

Yes. When falling back to the Visual Inspection Zone (VIZ) for damaged passports, our NLP engine recognizes localized month abbreviations (e.g., French, Spanish, German) and accurately converts them into the standardized ISO 8601 month format.

Do I need to install an SDK to parse these dates?

No, StructOCR is strictly API-first. You simply send us a Base64 string or file upload via a standard HTTP POST request. Our backend handles all the heavy lifting and returns the cleaned ISO 8601 strings directly in the JSON response.

Explore More Travel & KYC Solutions

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