Egypt National ID OCR Python SDK

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

AI ID OCR engine extracting data from an Egypt ID card
StructOCR engine analyzing an Egyptian document in real-time.

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.

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 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 200 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.

You May Also Like

Related tutorials, platform guides, and comparisons

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

Saudi Arabia National ID & Iqama OCR Python SDK

Python Tutorial: Automate KYC in Saudi Arabia. Extract data from National IDs and Iqamas using the StructOCR Python SDK. Supports bilingual (Arabic/English) text, 10-digit ID numbers, and 3-line MRZ extraction.

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

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

Ukraine National ID OCR Python SDK

Python Tutorial: Automate KYC in Ukraine. Extract data from National ID using StructOCR Python SDK. Supports native text and MRZ extraction.

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

Philippines PhilID OCR with Node.js SDK

Extract PhilSys Card Number, names, dates and other visible fields from Philippine Identification Card (PhilID) with the StructOCR Node.js SDK and Express.

Node.js · National ID
Country Tutorial

Malaysia MyKad OCR with Node.js SDK

Extract identity number, names, dates and other visible fields from MyKad with the StructOCR Node.js SDK and Express.

Node.js · National ID
Country Tutorial

Pakistan CNIC OCR with Node.js SDK

Extract CNIC number, names, dates and other visible fields from Computerized National Identity Card (CNIC) with the StructOCR Node.js SDK and Express.

Node.js · National ID
Country Tutorial

Nigeria National ID OCR with Node.js SDK

Extract National Identification Number (NIN), names, dates and other visible fields from National Identity 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