Senegal Carte d'Identité CEDEAO OCR Python SDK
Instantly extract data and MRZ from Senegalese IDs using our native Python library.
Parsing Carte d'Identité CEDEAO Challenges
Senegalese Carte d'Identité CEDEAO presents unique OCR challenges. Firstly, the document often features a mix of French and potentially some Wolof, requiring robust multilingual support. Secondly, layout variations and inconsistent print quality, particularly in older documents, can hinder accurate data extraction.
Why StructOCR for Senegal
StructOCR's model is specifically trained on a large dataset of Senegalese Carte d'Identité CEDEAO, ensuring high accuracy for id card parsing. It fully supports reading the Machine Readable Zone (MRZ) on the reverse side for rigorous identity verification and global compliance. Our Python SDK simplifies integration with a straightforward API, allowing you to quickly extract key information with minimal coding effort, including the 14 digits structure. We handle image pre-processing and format standardization, reducing complexity.
Common Use Cases in Senegal
- Digital Onboarding: Verify users for Fintech apps in Senegal.
- Telecom Registration: Automate SIM card registration with Carte d'Identité CEDEAO.
- Hotel Check-in: Speed up guest registration workflows.
Python SDK Integration
Install the SDK via pip: `pip install structocr`. Then use the following code.
Prerequisite: Python 3.6+ and `structocr` library installed.
from structocr import StructOCR
# 🔑 Need a key for Senegal? Get 200 free credits instantly:
# 👉 https://structocr.com/register
# Initialize with your API Key
client = StructOCR("YOUR_API_KEY_HERE")
def scan_senegal_id():
# Note: Supports JPG, PNG, WebP (Max 4.5MB)
# Target: Carte d'Identité CEDEAO
image_path = "senegal_national_id.jpg"
try:
print(f"Scanning {image_path}...")
# The SDK handles file upload and API communication
# It automatically detects that this is a Senegalese document
result = client.scan_national_id(image_path)
# Check success flag (SDK returns a dict matching the JSON response)
if result.get('success'):
data = result['data']
print("✅ Senegal 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 (CNP/CPF/NIN)
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')}")
# Machine Readable Zone (MRZ)
additional = data.get('additional_fields', {})
if additional.get('mrz_line_1'):
print("\n--- MRZ Data ---")
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_senegal_id()Technical Specs
- •Latency: < 4s (Average)
- •Availability: Served from Cloudflare's global edge network
- •Security: AES-256 Encryption & SOC2 Compliant
- •Input: JPG, PNG, WebP (Max 4.5MB)
- •Output: JSON (Structured Data)
Key Features
- •Native Script Support: Reads English and local characters.
- •MRZ Parsing: Accurately extracts and validates the Machine Readable Zone lines for cross-checking.
- •Blur Detection: Automatically rejects blurry images.
- •Fraud Check: Validates Carte d'Identité CEDEAO number format.
- •Smart Crop: Removes background noise automatically.
JSON Response Example
The SDK returns a Python dictionary matching this JSON structure.
{
"success": true,
"data": {
"type": "national_id",
"country_code": "SEN",
"nationality": "SENEGALAISE",
"document_number": "1 234 1990 12345",
"card_series": "",
"personal_number": "1 234 1990 12345",
"surname": "NDIAYE",
"given_names": "AMADOU",
"sex": "M",
"date_of_birth": "1990-05-15",
"place_of_birth": "DAKAR",
"address": "Medina Rue 11, Dakar",
"date_of_issue": "2020-01-01",
"date_of_expiry": "2030-01-01",
"issuing_authority": "Ministère de l'Intérieur",
"additional_fields": {
"phone_number": null,
"tramite_number": null,
"ejemplar": null,
"mrz_line_1": "I<SEN1234199012345<<<<<<<<<<<<",
"mrz_line_2": "9005152M3001017SEN<<<<<<<<<<<8",
"mrz_line_3": "NDIAYE<<AMADOU<<<<<<<<<<<<<<<<"
}
}
}Frequently Asked Questions
Does the Python SDK handle image uploads?
Yes, the SDK automatically handles base64 encoding and file uploads.
Is data stored?
Only briefly. Uploaded images and results are kept for at most 24 hours for quality spot-checks, then deleted.
How to handle errors?
The SDK result dictionary contains a 'success' boolean and an 'error' message if failed.
You May Also Like
Related tutorials, platform guides, and comparisons
Senegal Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Senegal passports with a server-side integration.
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 Invoice Line Item OCR API
Struggling with invoice line item extraction? Our Python OCR API delivers structured JSON in seconds, backed by SOC 2 Type II. Upload an image for a free test! Secure your data.
Malaysia MyKad OCR Python SDK
Python Tutorial: Automate KYC in Malaysia. Extract data from the Malaysian Identity Card (MyKad) using StructOCR Python SDK. Supports NRIC extraction and multi-line address parsing.
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.
Kazakhstan Identity Card (Udostoverenie) OCR Python SDK
Python Tutorial: Automate KYC in Kazakhstan. Extract dual-script data, the 12-digit IIN, and validate TD1 MRZ from Identity Card (Udostoverenie) using StructOCR Python SDK.
Ethiopia Fayda ID OCR Python SDK
Python Tutorial: Automate KYC in Ethiopia. Extract data from Fayda ID using StructOCR Python SDK. Supports native text.
Germany Personalausweis OCR Python SDK
Python Tutorial: Automate KYC in Germany. Extract data from Personalausweis and validate TD1 MRZ using StructOCR Python SDK. Supports native German text.
Czech Republic Občanský průkaz OCR Python SDK
Python Tutorial: Automate KYC in the Czech Republic. Extract Czech text with diacritics, Rodné číslo, and validate TD1 MRZ from Občanský průkaz.
Estonia ID-kaart OCR Python SDK
Python Tutorial: Automate KYC in Estonia. Extract data from the Estonian Identity Card (ID-kaart) using StructOCR Python SDK. Supports native text, Isikukood, and MRZ extraction.
Technical Comparisons & Integrations
Explore platform integrations and competitive analysis
Add Receipt OCR to Your Lovable.dev App in 5 Minutes
Step-by-step guide to integrating the StructOCR receipt API into a Lovable.dev app. No backend required — just paste a prompt and add your API key.
Add VIN OCR to Your Lovable.dev App in 5 Minutes
Step-by-step guide to integrating the StructOCR VIN scanner API into a Lovable.dev app. Build automotive and fleet tools with zero backend required.
Manual TOS Entry vs. Container OCR Automation API
Analyzing the ROI and operational efficiency of replacing manual gate checkers with an automated Container OCR API in logistics yards.
OpenALPR vs. StructOCR API for VIN Decoding
Why traditional License Plate Recognition (ALPR) engines are not suitable for scanning Vehicle Identification Numbers (VINs).
Add Container OCR to Your Replit App in 5 Minutes
Step-by-step guide to integrating the StructOCR shipping container API into a Replit application. Build logistics and yard management tools using Replit Agent and Secrets.
Add Driver's License OCR to Your Replit App in 5 Minutes
Step-by-step guide to integrating the StructOCR Driver's License scanner API into a Replit application. Build car rental and mobility onboarding flows using Replit Agent and Secrets.
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.