Algeria CNIBE (Biometric ID) OCR Python SDK
Instantly extract bilingual data and validate cryptographic MRZ checksums from Algerian IDs using our native Python library.

Parsing CNIBE (Biometric ID) Challenges
Extracting data from Algerian CNIBE cards presents unique challenges. Firstly, the presence of both French and Arabic text requires robust multilingual OCR capabilities that standard engines like Tesseract struggle to handle simultaneously. Secondly, the varying print quality and the potential for glare on laminated cards can affect accuracy. Most importantly, manually parsing the Machine-Readable Zone (MRZ) on the back to verify identity mathematically is complex and error-prone.
Why StructOCR for Algeria
StructOCR is specifically trained on a vast dataset of Algerian CNIBE cards, enabling unparalleled accuracy in id card parsing. Our Python SDK abstracts away the complexities of OCR and seamlessly handles dual-language extraction for enhanced kyc automation. For comprehensive identity workflows, you can also seamlessly integrate our Algeria Passport OCR API to cross-reference user identities across multiple documents.
Common Use Cases in North Africa
- Digital Onboarding: Verify users for Fintech apps in Algeria by pre-filling data in < 2 seconds.
- Telecom Registration: Automate SIM card registration with CNIBE dual-language extraction.
- Pan-African Expansion: Seamlessly process users across the Maghreb region. Our unified Python SDK automatically detects and extracts data from neighboring documents, such as the Morocco National ID or Tunisia ID, without requiring any custom rules or new API endpoints.
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`. The SDK automatically maps Algerian specific fields (like the NIN) and parses the TD1 MRZ block.
Prerequisite: Python 3.6+ and `structocr` library installed.
from structocr import StructOCR
# 🔑 Need a key for Algeria? Get 200 free credits instantly:
# 👉 https://structocr.com/register
# Initialize with your API Key
client = StructOCR("YOUR_API_KEY_HERE")
def scan_algeria_id():
# Note: Supports JPG, PNG, WebP (Max 4.5MB)
image_path = "algeria_national_id.jpg"
try:
print(f"Scanning {image_path}...")
result = client.scan_national_id(image_path)
if result.get('success'):
data = result['data']
print("✅ Algeria CNIBE Extraction Successful!")
# Basic Identity
print(f"Region: {data.get('country_code')}")
print(f"Name: {data.get('given_names')} {data.get('surname')}")
print(f"ID Number: {data.get('document_number')}")
# Critical Field: NIN (Numéro d'Identification National)
print(f"NIN: {data.get('personal_number')}")
# Demographics
print(f"DOB: {data.get('date_of_birth')} ({data.get('sex')})")
print(f"Address: {data.get('address')}")
# Extract TD1 MRZ Data
additional = data.get('additional_fields', {})
if additional.get('mrz_line_1'):
print("\n🔍 MRZ Data Extracted:")
print(f"Line 1: {additional.get('mrz_line_1')}")
print(f"Line 2: {additional.get('mrz_line_2')}")
print(f"Line 3: {additional.get('mrz_line_3')}")
else:
print(f"❌ Extraction Failed: {result.get('error')}")
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
scan_algeria_id()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 + MRZ Block)
Key Features
- •Bilingual Extraction: Natively processes both Arabic and French text from CNIBE documents without manual language switching.
- •Hybrid VIZ + MRZ AI: Cross-validates unstructured visual data against cryptographic TD1 MRZ checksums for zero hallucination.
- •Fraud Check: Validates the Numéro d'Identification National (NIN) format natively.
- •Smart Crop: Removes background noise and deskews rotated images automatically.
JSON Response Example
The SDK returns a Python dictionary containing both the parsed visual data (VIZ) in French/Arabic and the raw Machine-Readable Zone (MRZ) block.
{
"success": true,
"data": {
"type": "national_id",
"country_code": "DZA",
"nationality": "ALGÉRIENNE",
"document_number": "192345678",
"card_series": "",
"personal_number": "190012345678901234",
"surname": "BOUAZIZ",
"given_names": "KARIM",
"sex": "M",
"date_of_birth": "1990-05-15",
"place_of_birth": "ALGER",
"address": "15 Rue Didouche Mourad, Alger",
"date_of_issue": "2020-01-01",
"date_of_expiry": "2030-01-01",
"issuing_authority": "Ministère de l'Intérieur",
"additional_fields": {
"mrz_line_1": "I<DZABOUAZIZ<<<<<<<<<<<<<<<<<<",
"mrz_line_2": "KARIM<<<<<<<<<<<<<<<<<<<<<<<<<",
"mrz_line_3": "1923456783DZA9005156M3001018<4"
}
}
}Frequently Asked Questions
Does the SDK validate the MRZ on the back of the Algerian CNIBE?
Yes. Our engine extracts the TD1 format MRZ lines and runs the ICAO 9303 checksum verification (modulus 10 with 7-3-1 weighting) on the document number and date of birth to ensure data integrity.
Can it read both Arabic and French simultaneously?
Absolutely. The models are explicitly trained on the bilingual layout of the Algerian ID, accurately mapping Arabic names and French addresses into the standardized JSON output.
How to handle blurry images?
Our API includes an automatic image enhancement engine that performs denoising and contrast correction before extraction, specifically optimized for the laminate glare often found on CNIBE cards.
You May Also Like
Related tutorials, platform guides, and comparisons
Algeria Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Algeria passports with a server-side integration.
Philippines UMID OCR Python SDK
Python Tutorial: Automate KYC in Philippines. Extract data from UMID using StructOCR Python SDK. Supports native text.
Singapore Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Singapore passports with a server-side integration.
Vietnam Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Vietnam passports with a server-side integration.
Italy Carta di Identità OCR Python SDK
Python Tutorial: Automate KYC in Italy. Extract data from Carta di Identità Elettronica (CIE) using StructOCR Python SDK. Supports native text, Codice Fiscale, and MRZ extraction.
South Korea Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from South Korea passports with a server-side integration.
Python HIN OCR API SDK
Tutorial: Extract HIN using the StructOCR Python SDK. Upload an image for a free test! Perfect for marine data pipelines, ETL workflows, and automated watercraft valuations.
Pakistan Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Pakistan passports with a server-side integration.
Pakistan Passport OCR with Node.js SDK
Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Pakistan passports.
Philippines Passport OCR with Node.js SDK
Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Philippines passports.
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.
AWS Textract vs. StructOCR API for Indian Passport Back Page Extraction
Why generic OCR fails at parsing the back page of Indian passports, and how a dedicated KYC API instantly extracts structured addresses, PIN codes, and family details.
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.