The official Python SDK for StructOCR API - Passport, ID card, Driver License OCR, Invoice, Receipts, VIN, HIN and Container OCR.
Project description
StructOCR Python SDK
The official Python client for StructOCR.
StructOCR is a powerful API tailored for developers to extract structured data from complex documents and physical assets with high accuracy. This SDK helps you integrate Passport OCR, National ID OCR, Driver License OCR, Invoice OCR, Receipt OCR, VIN OCR, HIN OCR, and Container OCR into your Python applications in minutes.
🚀 What's New in 1.2.0
We've massively expanded our expense automation and marine capabilities! The SDK now natively supports:
- Receipt OCR: Parse retail and dining receipts to extract merchants, individual line items, taxes, and totals.
- HIN OCR: Extract, parse, and validate Hull Identification Numbers from boats and watercraft.
- Previous 1.1.6 additions (Container OCR, VIN OCR, Invoice OCR) remain fully supported.
Check out the Quick Start below to see how easy it is to use them!
Features
- Passport OCR API: Instantly extract MRZ, name, DOB, and expiry date from passports of 200+ countries.
- National ID OCR: Support for ID cards with automatic field mapping.
- Driver License OCR: Extract vehicle class, license number, and personal details.
- Invoice OCR: Extract invoice number, currency, merchant, customer, and financial totals.
- Receipt OCR: Extract merchants, dates, line items, taxes, and totals for expense management.
- VIN OCR: Extract VIN (Vehicle Identification Number) from windshield or engine bay images.
- HIN OCR: Validate and extract Hull Identification Numbers from marine vessels.
- Container OCR: Extract shipping container numbers accurately from images.
- Secure & Fast: Enterprise-grade encryption, SOC2 compliance, and sub-second response times with zero data retention.
Installation
Install the package via pip:
pip install structocr
Quick Start
1. Initialize the Client
from structocr import StructOCR
# Initialize with your API Key
client = StructOCR(api_key="sk_live_xxxxxxxx")
2. Scan a Passport (Passport OCR)
# Pass the path to the passport image file
result = client.scan_passport('./docs/passport_sample.jpg')
print(f"Name: {result['data']['name']}")
print(f"Passport Number: {result['data']['document_number']}")
3. Scan Other Documents and Assets
# National ID OCR
id_data = client.scan_national_id('./docs/id_card.png')
# Driver License OCR
license_data = client.scan_driver_license('./docs/license.jpg')
# Invoice OCR
invoice_data = client.scan_invoice('./docs/invoice.jpg')
# Receipt OCR (New in 1.2.0)
receipt_data = client.scan_receipt('./docs/receipt.jpg')
# VIN OCR
vin_data = client.scan_vin('./docs/vin.jpg')
# HIN OCR (New in 1.2.0)
hin_data = client.scan_hin('./docs/boat_hin.jpg')
# Container OCR
container_data = client.scan_container('./docs/container.jpg')
Documentation
For full API documentation, response examples, and error codes, please visit the StructOCR Developer Docs.
Requirements
- Python 3.7+
requestslibrary
License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file structocr-1.2.0.tar.gz.
File metadata
- Download URL: structocr-1.2.0.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d899d9eb636da06489468d59c8a59a4c1bb274fec0c67df387cd3acd59004e0
|
|
| MD5 |
7b60cd1b14faeb2cef718885a53eb974
|
|
| BLAKE2b-256 |
491d6142fb72432b6917fc0817737b5f3e1349f96d8e54a2e821f3c148015249
|
File details
Details for the file structocr-1.2.0-py3-none-any.whl.
File metadata
- Download URL: structocr-1.2.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aec27d02c478d766c15de2cf24f37c748e76efd62a50bc1bd5632f6a61def228
|
|
| MD5 |
87cfcab01b4bee66e65e4ccea9472ace
|
|
| BLAKE2b-256 |
530996eea9b676e099438ce942e7415ae426de14275d0900bcdb13e962a4e0bc
|