Côte d'Ivoire CNI OCR Python SDK
Instantly extract visual data, NNI numbers, and validate cryptographic MRZ checksums from Ivorian IDs using our native Python library.

Parsing CNI (Carte Nationale d'Identité) Challenges
Extracting data from the Côte d'Ivoire CNI presents specific challenges. First, the transition to the new biometric cards issued by ONECI means systems must handle modern polycarbonate layouts with complex security features and holograms that cause glare. Second, locating and accurately extracting the unique 11-digit NNI (Numéro National d'Identification) is critical for local compliance. Finally, manually parsing the Machine-Readable Zone (MRZ) on the back of the card to mathematically verify the document against identity fraud requires complex, error-prone regular expressions.
Why StructOCR for Côte d'Ivoire
StructOCR is specifically trained on a large dataset of modern Ivorian CNIs, ensuring superior accuracy with French typography and ONECI card layouts. Our Python SDK simplifies integration, automatically locating critical fields like the NNI. By abstracting away the complexities of image processing via our national ID parsing API, you can efficiently scale your KYC automation platform.
Common Use Cases in Francophone Africa
- Mobile Money Onboarding: Verify users for Mobile Money and Fintech apps in Côte d'Ivoire by pre-filling NNI data in < 2 seconds.
- Telecom Registration: Automate strict SIM card registration compliance with native French script extraction.
- Pan-ECOWAS Expansion: Seamlessly process users across West Africa. Our unified Python SDK automatically detects and extracts data from neighboring documents, such as the Senegal CNI or Mali NINA card, without requiring custom rules.
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 Côte d'Ivoire-specific fields (like the NNI) and parses the TD1 MRZ block.
Prerequisite: Python 3.6+ and `structocr` library installed.
from structocr import StructOCR
# 🔑 Need a key for Côte d'Ivoire? Get 200 free credits instantly:
# 👉 https://structocr.com/register
# Initialize with your API Key
client = StructOCR("YOUR_API_KEY_HERE")
def scan_cote_divoire_id():
# Note: Supports JPG, PNG, WebP (Max 4.5MB)
image_path = "cote_divoire_cni_front_back.jpg"
try:
print(f"Scanning {image_path}...")
result = client.scan_national_id(image_path)
if result.get('success'):
data = result['data']
print("✅ Côte d'Ivoire CNI Extraction Successful!")
# Basic Identity
print(f"Region: {data.get('country_code')}")
print(f"Name: {data.get('given_names')} {data.get('surname')}")
print(f"Document No: {data.get('document_number')}")
# Critical Local Field: NNI
print(f"NNI Number: {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 & Validated:")
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_cote_divoire_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
- •Native French OCR: Perfectly captures French characters and diacritics natively.
- •NNI Extraction: Automatically locates and formats the critical 11-digit Numéro National d'Identification.
- •Hybrid VIZ + MRZ AI: Cross-validates unstructured visual data against cryptographic TD1 MRZ checksums for zero hallucination.
- •Smart Crop: Removes background noise and deskews rotated images automatically, mitigating glare from the ONECI polycarbonate cards.
JSON Response Example
The SDK returns a Python dictionary containing the parsed visual data (VIZ), the NNI, and the raw Machine-Readable Zone (MRZ) block.
{
"success": true,
"data": {
"type": "national_id",
"country_code": "CIV",
"nationality": "IVOIRIENNE",
"document_number": "C0012345678",
"card_series": "",
"personal_number": "01234567890",
"surname": "KOUASSI",
"given_names": "YAO PASCAL",
"sex": "M",
"date_of_birth": "1990-05-15",
"place_of_birth": "ABIDJAN",
"address": "Cocody, Abidjan",
"date_of_issue": "2020-01-01",
"date_of_expiry": "2030-01-01",
"issuing_authority": "ONECI",
"additional_fields": {
"tramite_number": null,
"mrz_line_1": "IDCIVC001234567<<<<<<<<<<<<<<<",
"mrz_line_2": "9005156M3001018CIV<<<<<<<<<<<4",
"mrz_line_3": "KOUASSI<<YAO<PASCAL<<<<<<<<<<<"
}
}
}Frequently Asked Questions
Does the SDK validate the MRZ on the back of the Ivorian CNI?
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 extract the NNI (Numéro National d'Identification)?
Absolutely. The models natively target the 11-digit NNI required for official database verification in Côte d'Ivoire, mapping it directly to the `personal_number` field.
How does it handle the glare on the new biometric ONECI cards?
Our API includes an automatic image enhancement engine that performs denoising, contrast correction, and glare mitigation specifically optimized for polycarbonate identity cards before extraction.
You May Also Like
Related tutorials, platform guides, and comparisons
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.
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.
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.
Bangladesh Smart NID OCR Python SDK
Python Tutorial: Automate KYC in Bangladesh. Extract complex Bengali text and decode 2D barcodes from Smart NIDs 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.
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.
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.
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.
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.
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.
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 HIN OCR to Your Replit App in 5 Minutes
Step-by-step guide to integrating the StructOCR HIN (Hull Identification Number) scanner API into a Replit application. Build marine and boat management tools 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.