Skip to content

Passport OCR API

New

Read an uploaded passport image and get the biographic page back as structured fields, including the machine-readable zone where the document carries one.

Overview

Passport OCR reads an uploaded passport image and returns the details printed on the biographic page as structured fields. That includes the machine-readable zone where the document carries one. It removes the step where a person opens a photograph of a booklet and retypes what it says. Onboarding, travel, forex and staffing teams collect passports as phone photographs, and every retyped number can introduce an error that shows up much later. Which fields are available in any response varies with image quality, the document layout and the underlying data source. A passport is sensitive personal data. Collect it with the holder's consent and a stated purpose, and use the reading only for that purpose. Reading the document is a capture step, and it does not confirm that the passport is genuine.

Coverage
Passport booklets presented in India; readable output depends on the image and the document layout
Input
A passport image or scan uploaded by the holder, or captured inside your own onboarding flow
Output
Structured identity and document fields read from the biographic page, including the machine-readable zone where present
Typical users
Banks and NBFCs, forex and remittance desks, travel and hospitality platforms, overseas staffing agencies, insurers
Coverage note
Available fields vary by image quality, document layout and data source. A reading captures the document; it does not verify identity.

The overview and the sections after the reference are the FinSour API catalog’s own record for this service, rendered unaltered.

Endpoint URL and method

POSThttps://gateway.staging.finsour.io/v1/documents/passport

Supplied by FinSour platform API contract (finsour development at 80e8b83bf) on . OpenAPI document at commit 436311c32, API version 2026-11-01. The beta is served from the staging gateway.

Authentication

Scheme API key travels in the X-Api-Key header

Send your API key in this header on every call, from your own server: a key sent from a browser is refused. A key starting fs_test_ calls the sandbox and one starting fs_live_ calls production, at the same address. Create keys in the FinSour console.

Supplied by FinSour platform API contract (finsour development at 80e8b83bf) on . OpenAPI document at commit 436311c32, API version 2026-11-01. The beta is served from the staging gateway.

Request parameters

Content type multipart/form-data

Headers

NameTypeRequiredDescriptionConstraints
Idempotency-KeystringRequiredA key you generate for each attempt. Sending the same key again returns the first answer instead of running the check twice; the same key with a different body is refused.8 to 255 characters. Matches ^[A-Za-z0-9._:-]+$
FinSour-VersionstringRequiredSend 2026-11-01 on this call and on every poll to get the receipt and the result described on this page. A call without it is served under 2026-09-01, whose job has a different shape.—

Body

NameTypeRequiredDescriptionConstraints
filefileRequiredThe document to read.—
payloadstring (JSON)RequiredA JSON string carrying the call's options.—
payload.optionsobjectRequiredSettings for this call. This API requires consent.—
payload.options.referencestringOptionalYour own reference for this call. It comes back unchanged as meta.reference.1 to 128 characters
payload.options.consentobjectRequiredThe person's consent to this check.—
payload.options.consent.obtainedbooleanRequiredSend true once the person has agreed to the check.Always true
payload.options.consent.atstring (date-time)RequiredWhen the person gave consent.—
payload.options.consent.purposestringRequiredWhat the check is for, for example kyc.1 to 64 characters

Request samples

cURL

curl -X POST https://gateway.staging.finsour.io/v1/documents/passport \
  -H "X-Api-Key: $FINSOUR_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "FinSour-Version: 2026-11-01" \
  -F "file=@<path-to-document>" \
  -F 'payload={"options":{"consent":{"obtained":"<obtained>","at":"<at>","purpose":"<purpose>"}}}'

Node.js

import { openAsBlob } from "node:fs";

const form = new FormData();
form.append("file", await openAsBlob("<path-to-document>"));
form.append("payload", JSON.stringify({
  "options": {
    "consent": {
      "obtained": "<obtained>",
      "at": "<at>",
      "purpose": "<purpose>"
    }
  }
}));

const response = await fetch("https://gateway.staging.finsour.io/v1/documents/passport", {
  method: "POST",
  headers: {
    "X-Api-Key": process.env.FINSOUR_API_KEY,
    "Idempotency-Key": crypto.randomUUID(),
    "FinSour-Version": "2026-11-01",
  },
  body: form,
});

console.log(response.status, await response.json());

Python

import os
import uuid
import json

import requests

response = requests.post(
    "https://gateway.staging.finsour.io/v1/documents/passport",
    headers={
        "X-Api-Key": os.environ["FINSOUR_API_KEY"],
        "Idempotency-Key": str(uuid.uuid4()),
        "FinSour-Version": "2026-11-01",
    },
    files={"file": open("<path-to-document>", "rb")},
    data={"payload": json.dumps({
        "options": {
            "consent": {
                "obtained": "<obtained>",
                "at": "<at>",
                "purpose": "<purpose>",
            },
        },
    })},
    timeout=30,
)

print(response.status_code, response.json())

Generated from the fields above. Replace each value in angle brackets with your own; the key is read from FINSOUR_API_KEY.

Supplied by FinSour platform API contract (finsour development at 80e8b83bf) on . OpenAPI document at commit 436311c32, API version 2026-11-01. The beta is served from the staging gateway.

Response schema

Status 202 · content type application/json

NameTypePresentDescriptionConstraints
dataobjectAlwaysThe job that will read the document.—
data.jobIdstringAlwaysThe job's id. Poll GET /v1/jobs/{jobId} with it.Matches ^[0-9A-HJKMNP-TV-Z]{26}$
data.statusstringAlwaysAlways queued: the job is accepted and has not started.Always "queued"

The result

Poll GET /v1/jobs/{jobId}. Once the job has finished, data holds these fields:

NameTypePresentDescriptionConstraints
jobIdstringAlways——
statusstringAlways—One of queued, processing, completed, needs_review, unreadable, failed, expired, cancelled
documentTypestring or nullAlwaysThe kind of document found, once it has been read; null before that.—
confidencenumber or nullAlwaysThe document's confidence, 0 to 1, to two places; null until it has been read.Minimum 0. Maximum 1
fieldsobjectAlwaysWhat was read. Every key is always present: null means the document does not carry it, or it could not be read with enough confidence.—
fields.maskedPassportNumberstring or nullAlways——
fields.surnamestring or nullAlways——
fields.givenNamesstring or nullAlways——
fields.nationalitystring or nullAlways——
fields.genderstring or nullAlways——
fields.dobstring or nullAlwaysISO date, YYYY-MM-DD; a year or month alone is YYYY or YYYY-MM.—
fields.placeOfBirthstring or nullAlways——
fields.placeOfIssuestring or nullAlways——
fields.dateOfIssuestring or nullAlwaysISO date, YYYY-MM-DD; a year or month alone is YYYY or YYYY-MM.—
fields.dateOfExpirystring or nullAlwaysISO date, YYYY-MM-DD; a year or month alone is YYYY or YYYY-MM.—
fields.mrzValidboolean or nullAlways——
fieldsToReviewarray of stringsAlwaysWhen status is needs_review, the fields a person should confirm; empty otherwise.—
failureReasonstringSometimesPresent only when status is unreadable or failed.One of UNREADABLE_IMAGE, LOW_CONFIDENCE, DOCUMENT_TYPE_MISMATCH, UNSUPPORTED_MEDIA_TYPE, FILE_TOO_LARGE, INPUT_CORRUPT, PAGE_LIMIT_EXCEEDED, TIMEOUT, PROCESSING_ERROR

Supplied by FinSour platform API contract (finsour development at 80e8b83bf) on . OpenAPI document at commit 436311c32, API version 2026-11-01. The beta is served from the staging gateway.

Error codes

CodeStatusMeaningRetrying
API_VERSION_UNSUPPORTED400That API version is no longer supported.Do not retry automatically
IDEMPOTENCY_KEY_INVALID400That Idempotency-Key does not meet the required format.Do not retry automatically
IDEMPOTENCY_KEY_REQUIRED400An Idempotency-Key header is required for this request.Do not retry automatically
REQUEST_MALFORMED400The request could not be parsed.Do not retry automatically
AUTH_KEY_EXPIRED401The API key is not valid.Do not retry automatically
AUTH_KEY_INVALID401The API key is not valid.Do not retry automatically
AUTH_KEY_MISSING401No API key was presented.Do not retry automatically
AUTH_KEY_REVOKED401The API key is not valid.Do not retry automatically
INSUFFICIENT_BALANCE402The available balance is not enough for this request.Do not retry automatically
AUTH_IP_NOT_ALLOWED403This API key may not be used from this address.Do not retry automatically
ENTITLEMENT_MISSING403This organization is not entitled to that product in this environment.Do not retry automatically
ORGANIZATION_SUSPENDED403This organization is not active.Do not retry automatically
PRODUCT_NOT_AVAILABLE403That product is not available.Do not retry automatically
PRODUCT_RETIRED403That product has been withdrawn.Do not retry automatically
SCOPE_INSUFFICIENT403This API key does not carry the scope this product requires.Do not retry automatically
PRODUCT_NOT_FOUND404No such product.Do not retry automatically
IDEMPOTENCY_KEY_REUSED409That idempotency key was already used for a different request.Do not retry automatically
PRICE_UNAVAILABLE409No active price covers this product right now.Safe to retry
REQUEST_IN_PROGRESS409An earlier attempt with this key is still running.Safe to retry
SETTLEMENT_PENDING409This request is awaiting reconciliation by an operator.Do not retry automatically
API_VERSION_SUNSET410That API version passed its announced sunset date.Do not retry automatically
REQUEST_TOO_LARGE413The request body is too large.Do not retry automatically
OCR_UNSUPPORTED_MEDIA_TYPE415That document format is not accepted.Do not retry automatically
UNSUPPORTED_MEDIA_TYPE415That content type is not accepted on this route.Do not retry automatically
CONSENT_REQUIRED422This product requires an explicit consent flag.Do not retry automatically
SANDBOX_FIXTURE_MISSING422No sandbox fixture exists for this input. Use a different test value.Do not retry automatically
UPSTREAM_REJECTED422The upstream source rejected the input.Do not retry automatically
VALIDATION_FAILED422The request payload is invalid.Do not retry automatically
CONCURRENCY_LIMIT429Too many simultaneous requests.Safe to retry
OCR_QUEUE_SATURATED429The document queue is full. Retry shortly.Safe to retry
QUOTA_EXCEEDED429The allowance for this window is spent.Do not retry automatically
RATE_LIMITED429Too many requests.Safe to retry
INTERNAL_ERROR500An unexpected error occurred.Safe to retry
OUTCOME_UNCERTAIN502The outcome of this request is not yet known. Retry with the same Idempotency-Key.Do not retry automatically
UPSTREAM_UNAVAILABLE502The upstream source is unavailable. Retry shortly.Safe to retry
MAINTENANCE_MODE503The service is in a maintenance window.Safe to retry
NO_PROVIDER_AVAILABLE503No provider can serve this product right now.Safe to retry
OCR_UNAVAILABLE503Document reading is unavailable right now. Retry later.Safe to retry
SERVICE_OVERLOADED503The service is shedding load. Retry shortly.Safe to retry
UPSTREAM_TIMEOUT504The upstream source did not respond in time.Safe to retry

Supplied by FinSour platform API contract (finsour development at 80e8b83bf) on . OpenAPI document at commit 436311c32, API version 2026-11-01. The beta is served from the staging gateway.

Rate limits

ScopeLimitWindowAt the limit
Your API key, within your organisation's limitThe figure in X-RateLimit-LimitPer minute429 RATE_LIMITED, with Retry-After in seconds. Every answer past authentication carries X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset.

Supplied by FinSour platform API contract (finsour development at 80e8b83bf) on . OpenAPI document at commit 436311c32, API version 2026-11-01. The beta is served from the staging gateway.

Use cases

  • Banking: capture passport fields when a passport is the identity document offered at onboarding
  • Forex and remittance: read traveler passport details during currency purchase and intake
  • Travel platforms: capture passport details for international booking and check-in
  • Hospitality: read foreign-guest passport details when a property must file a guest record
  • Staffing and overseas recruitment: capture candidate passport details for deployment paperwork
  • Insurance: read passport fields on travel and expatriate policy proposals

What this service does

  • Reads the MRZ where the booklet has one

    The MRZ is printed in a fixed international layout with check digits, which makes it the steadiest part of the page to read. Where a booklet is older, worn or cropped out of frame, the reading falls back on the printed text above it. The fields available vary by document and data source.

  • Biographic page fields instead of retyping

    Name, passport number, dates of birth, issue and expiry, nationality and other available attributes come back as data your form can fill. An operations team no longer reads a photograph and types what it sees.

  • Built for the images people actually send

    Passports arrive as phone photographs taken at a desk, in a car or under a ceiling light. The workflow is built around retries and correction. It never assumes a clean flatbed scan.

  • A capture step you can audit

    Keeping the submitted image alongside the structured reading gives a later reviewer both the source and the result. That is what a file needs when a decision made on it is questioned.

How a check runs

  1. Ask the holder for the biographic page

    The holder photographs or scans the full biographic page, with the machine-readable zone inside the frame, and uploads it through your application.

  2. Send the passport image to the API

    Your application submits the uploaded file in a single request, as part of the onboarding, booking or intake journey.

  3. Read back what the service could recover

    The response returns the identity and document fields that could be read. Available fields vary by image quality, document layout and data source.

  4. Let the holder fix what the image hid

    Show the values that were read and let the holder correct anything the image obscured, before you commit the record.

  5. Carry the confirmed data forward

    The confirmed fields fill your onboarding file, booking record or case, and you can keep the image alongside them for review.

Questions

What is a Passport OCR API?
An interface that accepts a passport image and returns the details printed on the biographic page as structured fields. Your application captures them directly. That removes the manual read-and-retype step.
What is the machine-readable zone on a passport?
The MRZ is the block of uppercase characters and chevrons printed along the foot of the biographic page in a fixed international layout. The positions are known and the zone carries check digits, which usually makes it the steadiest part of the page to read. Not every document has a usable one.
Which passport fields can the response contain?
Depending on the document and the image, the response may carry the name, passport number, date and place of birth and nationality. It can also carry sex, the dates of issue and expiry, the place of issue and the machine-readable zone. The exact fields available vary by data source, document layout and image quality.
Does reading a passport confirm that it is genuine?
No. OCR reads what the document shows. Confirming that a document is valid, or that the person presenting it is its holder, calls for separate verification and liveness checks. Those can sit alongside the reading in the same workflow.
What happens when the passport photo is poor?
Glare, a cropped page, a heavy angle or a worn booklet can leave parts of the page unreadable, and those fields simply do not come back. The practical answer is a confirmation screen and a clear retry prompt that tells the person what to fix.
What consent do I need before collecting a passport image?
A passport is personal data. Collect it only for a stated, lawful purpose, and tell the person what you are collecting and why. Take their consent before the image leaves their device, use the reading only for that purpose, and keep it no longer than your policy and applicable law require.

Catalog entry last updated .