Argentina DNI OCR Python SDK

Instantly extract visual data, CUIL/CUIT, and validate cryptographic MRZ checksums from Argentine IDs using our native Python library.

AI extracting Spanish text, CUIL, and TD1 MRZ data from an Argentina DNI card
StructOCR engine extracting Visual Zone (VIZ) and validating MRZ on an Argentine DNI in real-time.

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.

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`. 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)
  • 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 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

Country Tutorial

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.

Python · Passport
Country Tutorial

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.

Python · Passport
Country Tutorial

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.

Python · eid
Country Tutorial

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.

Python · Passport
Country Tutorial

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.

Python · National ID
Country Tutorial

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.

Python · Passport
Country Tutorial

Saudi Arabia Passport OCR with Python SDK

Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Saudi Arabia passports with a server-side integration.

Python · Passport
Country Tutorial

Senegal Carte d'Identité CEDEAO OCR Python SDK

Python Tutorial: Automate KYC in Senegal. Extract data from Carte d'Identité CEDEAO using StructOCR Python SDK. Supports native text and MRZ extraction.

Python · carte d'identité cedeao
Country Tutorial

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.

Python · carte de identitate
Country Tutorial

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.

Python · cartão de cidadão

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