Argentina DNI OCR Python SDK
Instantly extract visual data, CUIL/CUIT, and validate cryptographic MRZ checksums from Argentine IDs using our native Python library.
Parsing Argentina DNI Challenges
Extracting data from Argentina's DNI (Documento Nacional de Identidad) presents unique challenges due to varying layout designs between different card versions. Standard OCR engines struggle to reliably extract critical, localized fields like the CUIL/CUIT or the Nro. de Trámite, which are often printed in small or varying fonts. Most importantly, manually parsing the Machine-Readable Zone (MRZ) on the back of the card to mathematically verify the document's authenticity is complex and adds significant engineering overhead.
Why StructOCR for Argentina
StructOCR is explicitly trained on a vast dataset of Argentine DNI cards, enabling unparalleled accuracy in id card parsing. Our Python SDK abstracts away the complexities of OCR, seamlessly extracting Spanish names, addresses, and local tax identifiers for enhanced kyc automation.
Common Use Cases in Latin America
- Digital Onboarding: Verify users for Fintech apps and digital wallets in Argentina by pre-filling DNI data in < 2 seconds.
- Government & Compliance: Automate the extraction of the Nro. de Trámite to instantly validate identity status with RENAPER databases.
- Pan-LatAm Expansion: Seamlessly process users across Mercosur and LATAM. Our unified Python SDK automatically detects and extracts data from neighboring documents, such as the Brazil CPF/RG or Chile RUN, without requiring any custom rules or new API endpoints.
Python SDK Integration
Install the SDK via pip: `pip install structocr`. The SDK automatically maps Argentina-specific fields (like CUIL and Nro. de Trámite) and parses the TD1 MRZ block.
Prerequisite: Python 3.6+ and `structocr` library installed.
from structocr import StructOCR
# 🔑 Need a key for Argentina? Get 200 free credits instantly:
# 👉 https://structocr.com/register
# Initialize with your API Key
client = StructOCR("YOUR_API_KEY_HERE")
def scan_argentina_id():
# Note: Supports JPG, PNG, WebP (Max 4.5MB)
image_path = "argentina_dni_front_back.jpg"
try:
print(f"Scanning {image_path}...")
result = client.scan_national_id(image_path)
if result.get('success'):
data = result['data']
print("✅ Argentina DNI Extraction Successful!")
# Basic Identity
print(f"Region: {data.get('country_code')} (Ejemplar: {data.get('card_series')})")
print(f"Name: {data.get('given_names')} {data.get('surname')}")
print(f"DNI Number: {data.get('document_number')}")
# Critical Local Fields
print(f"CUIL/CUIT: {data.get('personal_number')}")
additional = data.get('additional_fields', {})
print(f"Trámite No.: {additional.get('tramite_number', 'N/A')}")
# Demographics
print(f"DOB: {data.get('date_of_birth')} ({data.get('sex')})")
print(f"Address: {data.get('address', 'Extracted from back')}")
# Extract TD1 MRZ Data
if additional.get('mrz_line_1'):
print("\n🔍 MRZ Data Extracted & Validated:")
print(f"Line 1: {additional.get('mrz_line_1')}")
# ... (lines 2 & 3)
else:
print(f"❌ Extraction Failed: {result.get('error')}")
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
scan_argentina_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 + MRZ Block)
Key Features
- •Native Spanish OCR: Perfectly captures special characters, accents, and 'ñ' without encoding errors.
- •CUIL & Trámite Extraction: Automatically locates and formats the 11-digit CUIL/CUIT and the crucial 11-digit Nro. de Trámite.
- •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, ideal for user-submitted mobile photos.
JSON Response Example
The SDK returns a Python dictionary containing the parsed visual data (VIZ), local Argentina fields, and the raw Machine-Readable Zone (MRZ) block.
{
"success": true,
"data": {
"type": "national_id",
"country_code": "ARG",
"nationality": "ARGENTINA",
"document_number": "30123456",
"card_series": "A",
"personal_number": "20-30123456-7",
"surname": "GÓMEZ",
"given_names": "LUCAS MARTÍN",
"sex": "M",
"date_of_birth": "1985-08-20",
"place_of_birth": "CÓRDOBA",
"address": "AV. COLÓN 456, CÓRDOBA",
"date_of_issue": "2021-03-15",
"date_of_expiry": "2036-03-15",
"issuing_authority": "RENAPER",
"additional_fields": {
"tramite_number": "00123456789",
"mrz_line_1": "IDARG30123456<2<<<<<<<<<<<<<<<",
"mrz_line_2": "8508203M3603158ARG<<<<<<<<<<<6",
"mrz_line_3": "GOMEZ<<LUCAS<MARTIN<<<<<<<<<<<"
}
}
}Frequently Asked Questions
Does the SDK validate the MRZ on the back of the Argentine DNI?
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 Nro. de Trámite and CUIL?
Absolutely. The models are explicitly trained on RENAPER layouts, accurately identifying and extracting both the CUIL/CUIT (Personal Number) and the Nro. de Trámite required for official database verification.
How to handle blurry images or glare from laminates?
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 physical DNI cards.
You May Also Like
Related tutorials, platform guides, and comparisons
Argentina Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Argentina passports with a server-side integration.
Poland Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Poland passports with a server-side integration.
Belgium eID OCR Python SDK
Python Tutorial: Automate KYC in Belgium. Extract data from Electronic Identity Card (eID) using StructOCR Python SDK. Supports native text, National Register Number, and MRZ extraction.
New Zealand Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from New Zealand passports with a server-side integration.
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.
Greece Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Greece 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.
Romania Carte de Identitate OCR Python SDK
Python Tutorial: Automate KYC in Romania. Extract data from Carte de Identitate using StructOCR Python SDK. Supports native text, front/back sides, and MRZ extraction.
Portugal Cartão de Cidadão OCR Python SDK
Python Tutorial: Automate KYC in Portugal. Extract data from Cartão de Cidadão using StructOCR Python SDK. Supports native text and MRZ extraction.
Saudi Arabia 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 Saudi Arabia passports.
Technical Comparisons & Integrations
Explore platform integrations and competitive analysis
Add Invoice OCR using Cursor in 5 Minutes
Step-by-step guide to integrating the StructOCR invoice API using the Cursor AI code editor. Build accounts payable and expense tracking tools rapidly.
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 Passport OCR using Cursor in 5 Minutes
Step-by-step guide to integrating the StructOCR Passport scanner API using the Cursor AI code editor. Build travel, hospitality, and global KYC flows rapidly.
Add Receipt OCR using Cursor in 5 Minutes
Step-by-step guide to integrating the StructOCR receipt API using the Cursor AI code editor. Build expense tracking and receipt scanning tools rapidly.
Add VIN OCR using Cursor in 5 Minutes
Step-by-step guide to integrating the StructOCR VIN scanner API using the Cursor AI code editor. Build automotive and fleet tools rapidly.
Extracting ECR Status & File Numbers: Generic OCR vs. StructOCR Indian Passport API
Learn why generic text extractors fail to capture critical Indian KYC fields like ECR status and File Numbers, and how a specialized API structures this data automatically.
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.