Saudi Arabia National ID & Iqama OCR Python SDK
Instantly extract data, bilingual text, and MRZ from Saudi National IDs and Iqamas (Front & Back) using our native Python library.

Parsing Saudi ID Challenges
Parsing the Saudi Arabia National ID and resident Iqama presents unique challenges for global businesses. The documents feature complex bilingual layouts containing both Arabic and English text. Additionally, managing dual-sided verification, handling potential Hijri to Gregorian date conversions, extracting the standard 10-digit national identification number, and parsing the 3-line Machine Readable Zone (MRZ) require highly specialized OCR capabilities.
Why StructOCR for Saudi Arabia
StructOCR's model is specifically trained on a vast dataset of Saudi Arabian IDs, ensuring high accuracy across both Arabic and Latin scripts. This advanced national id ocr capability facilitates efficient information parsing for MENA region compliance. Fully supports the latest Saudi National ID formats, enabling seamless data extraction from both front and back sides, specifically optimized for the 3-line MRZ on the back. Our latest v1.4.0 Python SDK simplifies the integration process, allowing you to extract structured data in seconds.
Common Use Cases in the KSA
- Fintech & Crypto Onboarding: Verify users for trading apps and digital wallets in Riyadh and Jeddah.
- Real Estate (Ejar): Automate tenant identity verification for property management and Ejar compliance.
- Telecom & Utilities: Speed up SIM card registration and utility service applications across the Kingdom.
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
Python SDK Integration
Install the SDK via pip: `pip install structocr`. Then use the following code.
Prerequisite: Python 3.6+ and `structocr` v1.4.0+ library installed.
from structocr import StructOCR
# 💰 Deposit via Crypto (USDT/USDC) for a 10% credit bonus!
# 👉 https://structocr.com/pricing
# Initialize with your API Key
client = StructOCR("YOUR_API_KEY_HERE")
def scan_saudi_id():
# Note: Supports JPG, PNG, WebP (Max 4.5MB)
# Target: Saudi National ID / Iqama (Supports front, back, and 3-line MRZ)
image_path = "saudi_id_back.jpg"
try:
print(f"Scanning {image_path}...")
# The SDK handles file upload and API communication
# It automatically detects that this is a Saudi document
result = client.scan_national_id(image_path)
# Check success flag
if result.get('success'):
data = result['data']
print("✅ Saudi ID Extraction Successful!")
# Basic Identity
print(f"Region: {data.get('country_code')}")
print(f"Name: {data.get('given_names')} {data.get('surname')}")
print(f"Card Number: {data.get('document_number')}")
# Critical Field: Saudi Identity Number (10 digits)
print(f"Personal #: {data.get('personal_number')}")
# Demographics
print(f"DOB: {data.get('date_of_birth')} ({data.get('sex')})")
print(f"Nationality: {data.get('nationality')}")
# Machine Readable Zone (MRZ) - Found on the back
additional = data.get('additional_fields', {})
if additional.get('mrz_line_1'):
print("\n--- MRZ Data (Reverse Side) ---")
print(additional.get('mrz_line_1'))
print(additional.get('mrz_line_2'))
if additional.get('mrz_line_3'):
print(additional.get('mrz_line_3'))
else:
print(f"❌ Extraction Failed: {result.get('error')}")
except Exception as e:
# Handle SDK or Network errors
print(f"An error occurred: {e}")
if __name__ == "__main__":
scan_saudi_id()Technical Specs
- •Latency: < 3s (Average via Cloudflare edge routing)
- •Uptime: 99.9% SLA
- •Security: AES-256 Encryption & PDPL/GDPR Compliant
- •Input: JPG, PNG, WebP (Max 4.5MB) — Supports Front & Back images
- •Output: JSON (Structured Data with 3-line MRZ support)
Key Features
- •Bilingual Arabic & English: Native support for rendering and extracting dual-language fields accurately.
- •10-Digit ID Formatting: Automatically validates and formats the 10-digit personal number standard in Saudi Arabia.
- •Date Normalization: Intelligently maps document dates, ensuring all outputs are normalized to a YYYY-MM-DD structure.
- •3-Line MRZ Parsing: Accurately extracts and validates the Machine Readable Zone lines standard on Saudi IDs.
- •Smart Crop & Deskew: Automatically aligns and crops the document from complex backgrounds.
JSON Response Example
The SDK returns a Python dictionary matching this JSON structure.
{
"success": true,
"data": {
"type": "national_id",
"country_code": "SAU",
"nationality": "SAU",
"document_number": "9876543210",
"card_series": null,
"personal_number": "1098765432",
"surname": "AL-DOSARI",
"given_names": "MOHAMMED ABDULLAH",
"sex": "M",
"date_of_birth": "1988-07-22",
"place_of_birth": "RIYADH",
"address": "Riyadh, King Fahd Road",
"date_of_issue": "2020-01-15",
"date_of_expiry": "2030-01-14",
"issuing_authority": "Ministry of Interior",
"additional_fields": {
"phone_number": null,
"tramite_number": null,
"ejemplar": null,
"mrz_line_1": "IDSAU98765432104<<<<<<<<<<<<<<<",
"mrz_line_2": "8807225M3001148SAU<<<<<<<<<<<4",
"mrz_line_3": "AL<DOSARI<<MOHAMMED<ABDULLAH<<<"
}
}
}Frequently Asked Questions
Does the API support Arabic text extraction?
Yes, our engine is natively trained to handle the Arabic scripts present on the Saudi National ID and Iqama.
Are the ID images stored on your servers?
No. All images are processed securely in-memory and are discarded immediately after the JSON response is generated.
Can I pay for API credits using Cryptocurrency?
Yes! StructOCR supports USDT/USDC deposits. You also get an automatic 10% credit bonus when topping up with crypto.
You May Also Like
Related tutorials, platform guides, and comparisons
France Carte Nationale d'Identité OCR Python SDK
Python Tutorial: Automate KYC in France. Extract data from Carte Nationale d'Identité and validate TD1/TD2 MRZ using StructOCR Python SDK. Supports native text.
Python National ID OCR API
High-accuracy National ID OCR for Python. Upload an image for a free test! Get structured JSON output via our dedicated Python SDK. Automate KYC and data entry with 99%+ accuracy.
Tunisia CIN (Carte d'Identité Nationale) OCR Python SDK
Python Tutorial: Automate KYC in Tunisia. Extract data from CIN (Carte d'Identité Nationale) using StructOCR Python SDK. Supports native text.
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.
Tanzania NIDA Card OCR Python SDK
Python Tutorial: Automate KYC in Tanzania. Extract data from NIDA Card using StructOCR Python SDK. Supports native text and MRZ extraction.
Egypt ID OCR API & Python SDK
Python Tutorial: Automate KYC in Egypt. Extract data from National IDs using our SDK. Upload an image to test our ID OCR engine live for free.
Côte d'Ivoire CNI (Carte Nationale d'Identité) OCR Python SDK
Python Tutorial: Automate KYC in Côte d'Ivoire. Extract French text, NNI, and validate TD1 MRZ from the ONECI CNI using StructOCR Python SDK.
Uganda National ID Card OCR Python SDK
Python Tutorial: Automate KYC in Uganda. Extract data from National ID Card using StructOCR Python SDK. Supports native text and MRZ extraction.
Indonesia KTP OCR with Node.js SDK
Extract NIK, names, dates and other visible fields from Kartu Tanda Penduduk (KTP) with the StructOCR Node.js SDK and Express.
India Aadhaar OCR with Node.js SDK
Extract Aadhaar number, names, dates and other visible fields from Aadhaar card with the StructOCR Node.js SDK and Express.
Technical Comparisons & Integrations
Explore platform integrations and competitive analysis
Add National ID OCR to Your Bolt.new App in 5 Minutes
Step-by-step guide to integrating the StructOCR National ID scanner API into a Bolt.new app. Build KYC and identity verification flows right in your browser.
Add National ID OCR using Cursor in 5 Minutes
Step-by-step guide to integrating the StructOCR National ID scanner API using the Cursor AI code editor. Build KYC and identity verification flows rapidly.
Add National ID OCR to Your Lovable.dev App in 5 Minutes
Step-by-step guide to integrating the StructOCR National ID scanner API into a Lovable.dev app. Build KYC and identity verification flows with zero backend.
Add National ID OCR to Your Replit App in 5 Minutes
Step-by-step guide to integrating the StructOCR National ID scanner API into a Replit application. Build KYC and identity verification flows using Replit Agent and Secrets.
Add National ID OCR to Your v0 App in 5 Minutes
Step-by-step guide to integrating the StructOCR National ID scanner API into a v0 by Vercel app. Build KYC and identity verification flows with zero backend.
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.
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.