Egypt National ID OCR Python SDK
Instantly extract data from Egyptian IDs. Test our ID OCR engine live for free below.

Parsing National ID Challenges
1. Dual-Language Script: Egyptian IDs contain both right-to-left Arabic script for names and addresses, and left-to-right numerals. Standard OCR models often fail to correctly parse this mixed-script layout. 2. Encoded Data & Quality: The 14-digit National ID number embeds the date of birth, governorate, and gender. Validating this requires specific logic, not just text extraction. Furthermore, physical card wear, tear, and variable print quality can degrade accuracy.
Why StructOCR for Egypt
Our AI model is specifically pre-trained on tens of thousands of Egyptian National ID cards, ensuring exceptional accuracy with Arabic script and complex layouts for national id ocr. The Python SDK eliminates boilerplate code by handling API requests and image encoding, allowing you to seamlessly implement KYC automation into your application in minutes. Want to see it in action? Use the live demo widget below to test our ID OCR engine for free. For production usage, view our flexible pricing.
Common Use Cases in Egypt
- Digital Onboarding: Verify users for Fintech apps, digital banks, and online services in Egypt.
- Telecom Registration: Automate SIM card registration and user verification with National ID data.
- Hotel Check-in: Speed up guest registration and compliance workflows for the hospitality industry.
Live Demo: ID card 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
Ready to use this in production? Get 20 free API calls — no credit card needed.
Get 20 Free API Calls →Python SDK Integration
Install the SDK via pip: `pip install structocr`. Then use the following code to connect to our ID OCR API. Prefer raw HTTP requests? Read the official API documentation.
Prerequisite: Python 3.6+ and `structocr` library installed.
from structocr import StructOCR
# Initialize with your API Key
client = StructOCR("YOUR_API_KEY_HERE")
def scan_egypt_id():
# Target: National ID
image_path = "egypt_national_id.jpg"
try:
print(f"Scanning {image_path}...")
# The SDK handles file upload and API communication
result = client.scan_national_id(image_path)
if result.get('success'):
data = result['data']
print("✅ Egypt Extraction Successful!")
# Basic Identity
print(f"Region: {data.get('country_code')} (Series: {data.get('card_series')})")
print(f"Name: {data.get('given_names')} {data.get('surname')}")
print(f"ID Number: {data.get('document_number')}")
# Critical Field: Personal Identity Number
print(f"Personal #: {data.get('personal_number')}")
# Demographics
print(f"DOB: {data.get('date_of_birth')} ({data.get('sex')})")
print(f"Address: {data.get('address')}")
else:
print(f"❌ Extraction Failed: {result.get('error')}")
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
scan_egypt_id()Technical Specs
- •Latency: < 4s (Average)
- •Uptime: 99.9% SLA
- •Security: AES-256 Encryption & SOC2 Type II Compliant
- •Input: JPG, PNG, WebP (Max 5MB)
- •Output: JSON (Structured Data)
Key Features
- •Arabic & English Support: Accurately reads native Arabic script and transliterated English names.
- •Blur & Glare Detection: Automatically rejects low-quality images to ensure data integrity.
- •National ID Number Validation: Cross-validates the encoded date of birth and gender within the 14-digit ID number.
- •Smart Crop: Intelligently isolates the ID card from any background, improving focus and accuracy.
JSON Response Example
The SDK returns a Python dictionary matching this JSON structure. Note the corrected dates for data consistency.
{
"success": true,
"data": {
"type": "national_id",
"country_code": "EGY",
"nationality": "EGYPTIAN",
"document_number": "JA1234567",
"card_series": "null",
"personal_number": "29101011200078",
"surname": "محمد",
"given_names": "أحمد حسن",
"sex": "M",
"date_of_birth": "1991-01-01",
"place_of_birth": "null",
"address": "١٥ ميدان التحرير، القاهرة",
"date_of_issue": "null",
"date_of_expiry": "null",
"issuing_authority": "null"
}
}Frequently Asked Questions
Can I test the ID OCR API for free?
Yes! You can use the live testing widget on this page to upload an ID image and see the extracted JSON data instantly. To get your own API key with 20 free credits, visit our registration page.
Does the Python SDK handle image uploads?
Yes, the SDK automatically handles file reading, base64 encoding, and the multipart/form-data upload process. You only need to provide the file path.
Is our customers' data stored on your servers?
No. Images and extracted data are processed in-memory and permanently deleted immediately after the API response is sent. We are a stateless processing API.
More OCR Tutorials
Python National ID OCR API
High-accuracy National ID OCR for Python. Get structured JSON output via our dedicated Python SDK. Automate KYC and data entry with 99%+ accuracy.
Python Shipping Container OCR API
Tutorial: Learn how to use the StructOCR Python SDK for shipping container OCR. Extract ISO 6346 container numbers with 99% accuracy. Includes code samples and JSON schemas.
Python Driver License OCR SDK & API
Stop struggling with manual data entry. Integrate our driver license OCR SDK (Python wrapper) to extract structured JSON in <1s. Secure, accurate, and developer-friendly.
Python HIN (Hull Identification Number) OCR API SDK
Tutorial: Extract Hull Identification Numbers (HIN) using the StructOCR Python SDK. Perfect for marine data pipelines, ETL workflows, and automated watercraft valuations.
Precise Data Extraction and Seamless
Integration with AI-powered OCR API.
Empower your solutions with automated data extraction by
integrating best-in class StructOCR via API seamlessly.
No credit card required • Full API access included