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.

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.
Drop files here or click to browse
JPG · PNG · WebP · up to 500 files · max 4.5 MB each
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Technical Comparisons & Integrations
Explore platform integrations and competitive analysis
AWS Textract & Google Vision vs. StructOCR Passport API
Why generic cloud OCR APIs fail at structured KYC automation, and why developers choose specialized Passport APIs instead.
Add Passport OCR to Your Bolt.new App in 5 Minutes
Step-by-step guide to integrating the StructOCR Passport scanner API into a Bolt.new app. Build travel, hospitality, and global KYC flows right in your browser.
Add Passport OCR using Cursor in 5 Minutes
Step-by-step guide to integrating the StructOCR Passport scanner API using the Cursor AI code editor. Build travel, hospitality, and global KYC flows rapidly.
Extracting ECR Status & File Numbers: Generic OCR vs. StructOCR Indian Passport API
Learn why generic text extractors fail to capture critical Indian KYC fields like ECR status and File Numbers, and how a specialized API structures this data automatically.
Heavy KYC SDKs vs. StructOCR Passport API for Mobile Apps
Discover why modern app developers are abandoning bulky on-device OCR SDKs in favor of lightweight, edge-deployed Passport APIs.
Add Passport OCR to Your Lovable.dev App in 5 Minutes
Step-by-step guide to integrating the StructOCR Passport scanner API into a Lovable.dev app through a secure server-side function for travel and KYC flows.
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.