UK Passport OCR with the StructOCR Node.js SDK

Install the official Node.js SDK, extract validated UK passport fields, and add the same workflow to a TypeScript Express service.

AI extracting data from a UK passport
StructOCR engine analyzing a British document in real-time.

Challenges with UK Passport Verification

Extracting accurate information from UK passports presents specific challenges, including the transition between the legacy burgundy EU format and the new post-Brexit blue passports. The intricate background designs featuring national floral emblems and modern polycarbonate data pages with advanced holographic overlays can hinder manual data entry and traditional OCR methods, making a specialized passport extraction api essential for reliable processing.

Why StructOCR for British Passports

StructOCR offers unparalleled accuracy for UK passport data extraction, thanks to our advanced machine learning models trained on a vast dataset. Our solution is specifically engineered to overcome the common obstacles found in HM Passport Office documents. Whether you need a powerful passport extraction api or a comprehensive fintech identity verification software, StructOCR delivers robust performance via our direct API service. For the fastest Node.js integration, install the official StructOCR SDK and see the Node.js SDK documentation.

Built for High-Compliance Industries

  • Travel & Aviation: Our technology serves as a critical verification solution for travel, enabling faster check-ins, eGate processing, and border control processes for British citizens. This speeds up passenger throughput and enhances the overall travel experience.
  • Financial Services: By integrating our sophisticated fintech identity verification software, financial institutions can automate their KYC onboarding workflows with confidence, ensuring compliance with strict FCA regulations. This reduces manual review times and mitigates fraud risk.

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
Need more testing? Create a free account to get 200 free credits (equals 100 Passport scans).

UK Passport OCR with the Node.js SDK

The official Node.js SDK handles file buffers, API communication, and structured passport results. Use the SDK directly or open the TypeScript + Express tab for a server endpoint. Keep your API key in STRUCTOCR_API_KEY.

Prerequisite: `npm install structocr`; set the server-side `STRUCTOCR_API_KEY` environment variable.

Prefer another stack? Open the Python SDK + FastAPI integration.

const StructOCR = require("structocr");

const apiKey = process.env.STRUCTOCR_API_KEY;
if (!apiKey) throw new Error("STRUCTOCR_API_KEY is not configured");

const client = new StructOCR(apiKey);

async function scanUkPassport() {
  const imagePath = "./uk_passport_sample.jpg";

  try {
    const result = await client.scanPassport(imagePath);

    if (result.success && result.data) {
      const data = result.data;
      console.log("UK passport extraction successful");
      console.log("Passport #:", data.passport_number);
      console.log("Name:", data.given_names, data.surname);
      console.log("Nationality:", data.nationality);
      console.log("DOB:", data.date_of_birth);
    } else {
      console.error("Extraction failed:", result.error);
    }
  } catch (error) {
    console.error("SDK error:", error.message);
  }
}

scanUkPassport();

Technical Specs

  • Latency: < 4s (Average)
  • Uptime: 99.9% SLA
  • Security: AES-256 Encryption & SOC2 Compliant
  • Input: JPG, PNG, WebP, PDF (file path, Buffer, or Uint8Array; SDK converts to Base64 JSON)
  • Max File Size: 4.5MB
  • Output: JSON (Structured Data)

Key Features

  • Format Adaptability: Seamlessly handles both the legacy burgundy and modern blue UK passport designs.
  • Visual Extraction (VIZ): Reliably extracts data directly from the visual inspection zone.
  • Glare Reduction: Automatically corrects lighting issues and reflections common on modern polycarbonate pages.
  • MRZ Parsing: Validates and cross-references data with the Machine Readable Zone.

JSON Response Example

The Node.js SDK returns an object matching this normalized JSON structure.

{
  "success": true,
  "data": {
    "type": "passport",
    "country_code": "GBR",
    "nationality": "GBR",
    "passport_number": "100200300",
    "surname": "SMITH",
    "given_names": "EMMA",
    "sex": "F",
    "date_of_birth": "1988-11-05",
    "place_of_birth": "LONDON",
    "date_of_issue": "2021-03-10",
    "date_of_expiry": "2031-03-10",
    "issuing_authority": "HMPO"
  }
}

Frequently Asked Questions

Where can I find the complete Node.js SDK documentation?

See the official Node.js SDK documentation for installation, authentication, supported methods, and Express examples.

Does it work with older passport formats?

Yes, our ocr passport api is trained to handle both legacy laminated formats and the modern polycarbonate British passports, ensuring broad compatibility.

You May Also Like

Related tutorials, platform guides, and comparisons

Country Tutorial

UK Passport OCR with Python SDK

Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from UK passports with a server-side integration.

Python · Passport
Country Tutorial

Saudi Arabia Passport OCR with Node.js SDK

Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Saudi Arabia passports.

Node.js · Passport
Country Tutorial

Côte d'Ivoire Passport OCR with Node.js SDK

Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Côte d'Ivoire passports.

Node.js · Passport
Country Tutorial

Senegal Passport OCR with Node.js SDK

Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Senegal passports.

Node.js · Passport
Country Tutorial

Germany Passport OCR with Node.js SDK

Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Germany passports.

Node.js · Passport
Country Tutorial

Tajikistan Passport OCR with Node.js SDK

Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Tajikistan passports.

Node.js · Passport
Country Tutorial

Portugal Passport OCR with Node.js SDK

Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Portugal passports.

Node.js · Passport
Country Tutorial

Poland Passport OCR with Node.js SDK

Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Poland passports.

Node.js · Passport
Country Tutorial

Poland Passport OCR with Python SDK

Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Poland passports with a server-side integration.

Python · Passport
Country Tutorial

Philippines Passport OCR with Python SDK

Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Philippines passports with a server-side integration.

Python · Passport

Technical Comparisons & Integrations

Explore platform integrations and competitive analysis

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.

Instant Access Cancel Anytime 99.9% Uptime