The Best Python Library for Shipping Container OCR
Stop using regex. Extract structured data from Shipping Containers with 99% accuracy using Python.

The Problem with Shipping Container Parsing
Shipping containers often present challenges for traditional OCR methods. Factors like glare, holograms, skewed angles, varying fonts, and damage degrade the accuracy of regular expression or template-based systems. Vertical text, common in port environments, is especially difficult. These systems struggle to cope with real-world variations, leading to high error rates.
The StructOCR Solution
StructOCR utilizes advanced deep learning models specifically trained on shipping container data, ensuring ISO 6346 compliant extraction is achieved. Our AI automatically handles deskewing, perspective correction, smart cropping, and vertical text reading, providing accurate and reliable results for applications such as logistics and port automation every time.
Common Use Cases
- KYC/Onboarding: Automate user verification flow.
- Data Entry Automation: Eliminate manual typing errors.
- Fraud Detection: Identify inconsistent data fields.
Live Demo: Container OCR
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
Python SDK Integration
Install the SDK via pip: `pip install structocr`. Then use the following code.
Prerequisite: Python 3.6+ and `structocr` library installed.
from structocr import StructOCR
from structocr.exceptions import APIError, InvalidAPIKeyError
# 💰 Save 30%+ vs competitors. Get 200 free credits instantly:
# 👉 https://structocr.com/register
# Initialize with your API Key
client = StructOCR("YOUR_API_KEY_HERE")
def scan_shipping_container():
# Note: Supports JPG, PNG, WebP (Max 4.5MB)
# Target: Shipping Container Number (ISO 6346)
image_path = "container_image.jpg"
try:
print(f"Scanning {image_path}...")
# The SDK handles file upload and API communication
result = client.scan_container(image_path)
if result and result.get('success'):
data = result['data']
print("✅ Container Extraction Successful!")
print(f"Container Number: {data.get('container_number')}")
print(f"Is Valid (Check Digit): {data.get('is_valid')}")
print(f"Confidence: {data.get('confidence')}")
parsed_data = data.get('parsed', {})
print(f"Owner Code: {parsed_data.get('owner_code')}")
print(f"Category: {parsed_data.get('category')}")
print(f"Serial Number: {parsed_data.get('serial_number')}")
print(f"Check Digit: {parsed_data.get('check_digit')}")
if data.get('is_valid'):
print("\nContainer number check digit is valid.")
else:
print("\nContainer number check digit is invalid. Please verify.")
else:
print(f"❌ Extraction Failed: {result.get('error')}")
except InvalidAPIKeyError as e:
print(f"Error: Invalid API Key. {e}")
except APIError as e:
print(f"Error communicating with the API: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
if __name__ == "__main__":
scan_shipping_container()Technical Specs
- •Latency: < 4s (Average)
- •Uptime: 99.9% SLA
- •Security: AES-256 Encryption & SOC2 Compliant
- •Input: JPG, PNG, WebP (Max 4.5MB)
- •Output: JSON (Structured Data)
Key Features
- •Smart Crop: Auto-detects document boundaries.
- •Field Validation: Cross-validates dates and checksums.
- •Specialized Models: Trained specifically on Shipping Containers.
Sample JSON Response
The API returns a clean JSON object with normalized fields.
{
"success": true,
"data": {
"container_number": "TTNU5194822",
"is_valid": true,
"confidence": "High",
"parsed": {
"owner_code": "TTN",
"category": "U",
"serial_number": "519482",
"check_digit": "2"
}
}
}Frequently Asked Questions
What file formats are supported?
JPG, PNG, and WebP images up to 4.5MB.
Is data stored?
No. Images are processed in-memory and deleted immediately.
How to handle errors?
Check the 'success' flag and 'error' message in the response.
You May Also Like
Related tutorials, platform guides, and comparisons
Java Shipping Container OCR API
Upload an image for a free test! Tutorial: Learn how to use the StructOCR Java Client to extract data from Shipping Containers. Extract ISO 6346 container numbers with 99% accuracy.
PHP Shipping Container OCR API
Tutorial: Learn how to use the StructOCR PHP Client via cURL for shipping container OCR. Upload an image for a free test! Extract ISO 6346 container numbers with 99% accuracy. Includes code samples and JSON schemas.
Node.js Shipping Container OCR API
Tutorial: How to use the StructOCR Node.js SDK to extract data from Shipping Containers. Upload an image for a free test! Includes code samples and JSON schema.
Go Shipping Container OCR API
Upload an image for a free test! Tutorial: Learn how to use the StructOCR Go Client to extract data from Shipping Containers. Extract ISO 6346 container numbers with 99% accuracy. Includes code samples and JSON schema.
C# Shipping Container OCR API
Upload an image for a free test! Tutorial: Learn how to use the StructOCR C# Client to extract data from Shipping Containers. Extract ISO 6346 container numbers with 99% accuracy. Includes code samples and JSON schemas.
Kenya National ID (Maisha Card) OCR Python SDK
Python Tutorial: Automate KYC in Kenya. Extract data, Maisha Namba (UPI), and validate TD1 MRZ from National ID (Maisha Card) using StructOCR Python SDK.
Serbia Lična karta OCR Python SDK
Python Tutorial: Automate KYC in Serbia. Extract data from Lična karta using StructOCR Python SDK. Supports native text and MRZ extraction.
Senegal Carte d'Identité CEDEAO OCR Python SDK
Python Tutorial: Automate KYC in Senegal. Extract data from Carte d'Identité CEDEAO using StructOCR Python SDK. Supports native text and MRZ extraction.
Romania Carte de Identitate OCR Python SDK
Python Tutorial: Automate KYC in Romania. Extract data from Carte de Identitate using StructOCR Python SDK. Supports native text, front/back sides, and MRZ extraction.
Portugal Cartão de Cidadão OCR Python SDK
Python Tutorial: Automate KYC in Portugal. Extract data from Cartão de Cidadão using StructOCR Python SDK. Supports native text and MRZ extraction.
Technical Comparisons & Integrations
Explore platform integrations and competitive analysis
Google Cloud Vision vs. StructOCR API for Shipping Containers
Comparing generic enterprise OCR solutions like Google Cloud Vision against StructOCR's purpose-built API for ISO 6346 shipping container recognition.
Add Container OCR to Your Lovable.dev App in 5 Minutes
Step-by-step guide to integrating the StructOCR shipping container API into a Lovable.dev app. Build logistics and yard management tools with zero backend.
Manual TOS Entry vs. Container OCR Automation API
Analyzing the ROI and operational efficiency of replacing manual gate checkers with an automated Container OCR API in logistics yards.
Add Container OCR to Your Replit App in 5 Minutes
Step-by-step guide to integrating the StructOCR shipping container API into a Replit application. Build logistics and yard management tools using Replit Agent and Secrets.
Tesseract OCR vs. StructOCR API for ISO 6346 Container Numbers
A technical comparison for developers evaluating open-source Tesseract vs. a dedicated cloud API for extracting shipping container numbers.
Add Container OCR to Your v0 App in 5 Minutes
Step-by-step guide to integrating the StructOCR shipping container API into a v0 by Vercel app. Build logistics and yard management tools with zero backend.
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.