Back to blog
March 12, 20266 min read

Getting Started with Passport OCR: Extract Passport Data in Minutes

getting-startedapitutorialfree

Passport OCR lets you extract structured data from passport images with a single API call. No complex setup, no AI model to train, no infrastructure to manage — just upload an image and get back clean JSON.

In this guide, we'll walk through everything you need to start extracting passport data for free.

Try It Right Now — No Signup Required

The fastest way to see Passport OCR in action is to try the live demo below. Drop a passport image (or any document with an MRZ) and see the extracted data instantly.

Try It Now

Upload a passport image and see the extracted MRZ data instantly.

Drop your passport image here

or click to browse (max 10MB)

Need more? $0.01 per request

That's it — no API key, no account, no credit card. The demo uses the same POST /v1/ocr endpoint that powers production integrations.

How the Free Tier Works

Every user gets 10 free requests per day, no signup required. The free tier includes:

  • Full MRZ extraction (name, nationality, date of birth, document number, expiry, etc.)
  • Both file upload and base64 input
  • JSON response with all parsed fields
  • Zero data retention — your images are never stored

The daily limit resets at midnight UTC. There's no waitlist, no trial period — it's free forever.

Who is the free tier for?

  • Developers evaluating the API before committing
  • Side projects with low volume
  • Students and researchers working with travel document data
  • Anyone who needs occasional passport data extraction

Get 100 Free Credits When You Sign Up

For a limited time, creating a Passport OCR account gives you 100 free credits on top of your daily free requests. That's 100 additional API calls to use whenever you want — they never expire.

To claim your credits:

  1. Go to passport-ocr.com/auth/login
  2. Enter your email — we'll send a magic link (no password needed)
  3. Click the link in your email to sign in
  4. Your 100 credits are added automatically

Once signed in, you'll get an API key from the dashboard that unlocks:

  • Priority processing — paid requests get dedicated queue slots, so you're never waiting behind free-tier traffic
  • Idempotency support — send an Idempotency-Key header to safely retry requests without double-charging
  • Usage tracking — see your request history and credit balance in the dashboard

Integrating the API

Basic request — file upload

curl -X POST https://passport-ocr.com/v1/ocr \
  -F "[email protected]"

With an API key

curl -X POST https://passport-ocr.com/v1/ocr \
  -H "Authorization: Bearer passport_ocr_your_key_here" \
  -F "[email protected]"

Base64 input

curl -X POST https://passport-ocr.com/v1/ocr \
  -H "Content-Type: application/json" \
  -d '{"image": "data:image/jpeg;base64,/9j/4AAQ..."}'

Response

Every successful request returns the same clean JSON structure:

{
  "success": true,
  "data": {
    "documentType": "PASSPORT",
    "documentNumber": "L898902C3",
    "issuingCountry": "UTO",
    "lastName": "ERIKSSON",
    "firstName": "ANNA MARIA",
    "nationality": "UTO",
    "dateOfBirth": "1974-08-12",
    "sex": "female",
    "expirationDate": "2012-04-15",
    "personalNumber": "ZE184226B"
  }
}

JavaScript / Node.js

const form = new FormData();
form.append("image", fileInput.files[0]);
 
const response = await fetch("https://passport-ocr.com/v1/ocr", {
  method: "POST",
  headers: {
    "Authorization": "Bearer passport_ocr_your_key_here"
  },
  body: form,
});
 
const { data } = await response.json();
console.log(data.firstName, data.lastName);

Python

import requests
 
with open("passport.jpg", "rb") as f:
    response = requests.post(
        "https://passport-ocr.com/v1/ocr",
        headers={"Authorization": "Bearer passport_ocr_your_key_here"},
        files={"image": f},
    )
 
data = response.json()["data"]
print(f"{data['firstName']} {data['lastName']}")

Pricing: Pay Only for What You Use

After your free credits, pricing is simple: $0.01 per request. No subscriptions, no monthly minimums.

Free TierPay-as-you-go
Daily free requests10/day10/day
Signup bonus100 credits (limited time)
Price per requestFree$0.01
Minimum purchase$10 (1,000 credits)
Priority queueSharedDedicated
IdempotencySupported
Credits expire?N/ANever

Buy credits through Stripe whenever you need more — no recurring charges. See full details on the pricing page.

What Happens Under the Hood

When you send a passport image to the API, four things happen in sequence:

  1. Image loading — the raw image is decoded in memory
  2. MRZ detection — the two-line MRZ region at the bottom of the passport is located and cropped
  3. OCR — the cropped region is read using a model trained specifically on the MRZ font (OCR-B)
  4. Parsing and validation — the text is parsed into structured fields and check digits are verified

The entire process typically completes in under 2 seconds. No image data is ever stored — processing happens entirely in memory and is discarded after the response is sent.

For a deep dive into how the MRZ format works, check out our complete MRZ developer guide.

Download API Collections for Postman & Bruno

Want to skip the manual setup? We've prepared ready-to-use API collections that include every endpoint with example requests, pre-configured variables, and documentation.

Download Postman Collection — Import directly into Postman. Includes collection variables for baseUrl and apiKey.

Download Bruno Collection — Unzip and open the folder in Bruno. Includes a Production environment with pre-configured variables.

Both collections include:

  • Extract MRZ (File Upload) — multipart form upload
  • Extract MRZ (Base64) — JSON body with data URI
  • Extract MRZ (Dry Run) — validate without full OCR
  • Extract MRZ (With Idempotency Key) — safe retries for paid requests
  • Check Credit Balance — view remaining credits
  • Check Anonymous Usage — see today's free-tier usage
  • Health Check — server status and version

Importing into Postman

  1. Open Postman and click Import (top-left)
  2. Drop the .json file or click Upload Files
  3. The collection appears with all requests ready to use
  4. Update the apiKey variable in Collection Variables with your key

Importing into Bruno

  1. Download and unzip the Bruno collection
  2. Open Bruno and click Open Collection
  3. Select the passport-ocr folder
  4. Switch to the Production environment and update apiKey with your key

Quick Start Checklist

  • Try the demo above — no signup needed
  • Read the API docs for the full endpoint reference
  • Create an account at passport-ocr.com/auth/login to claim your 100 free credits
  • Get your API key from the dashboard
  • Make your first authenticated request using the code examples above
  • Buy credits when you're ready to scale — $10 gets you 1,000 requests

Need Help?

Ready to extract passport data?

Try Passport OCR free — 10 requests per day, no signup required.