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.

AI extracting data from a Saudi Arabia National ID card
StructOCR engine analyzing a Saudi ID's Arabic/English fields and reverse-side 3-line MRZ in real-time.

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.

1
Upload
2
Results

Drop files here or click to browse

JPG · PNG · WebP  ·  up to 500 files · max 4.5 MB each

No files selected
Need more testing? Create a free account to get 200 free credits (equals 100 National ID scans).

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

Country Tutorial

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
Tutorial

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.

Python · National ID
Country Tutorial

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.

Python · National ID
Country Tutorial

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.

Python · National ID
Country Tutorial

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.

Python · National ID
Country Tutorial

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.

Python · National ID
Country Tutorial

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.

Python · National ID
Country Tutorial

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.

Python · National ID
Country Tutorial

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.

Node.js · National ID
Country Tutorial

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.

Node.js · National ID

Technical Comparisons & Integrations

Explore platform integrations and competitive analysis

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.

Instant Access Cancel Anytime 99.9% Uptime