Argentina DNI OCR Python SDK

Instantly extract data from Argentine IDs using our native Python library.

Steve HarringtonUpdated 2026-01-22
AI extracting data from a Argentina ID card
StructOCR engine analyzing a Argentine document in real-time.

Parsing DNI Challenges

Argentina DNI OCR presents unique challenges due to varying layout designs between different card versions, requiring robust image processing techniques. Furthermore, older DNI cards often suffer from low print quality and faded text, demanding advanced OCR algorithms to accurately extract the necessary data.

Why StructOCR for Argentina

Our model is specifically trained on a large dataset of Argentine DNI cards, ensuring high accuracy even with layout variations and poor image quality. The Python SDK simplifies integration with just a few lines of code, abstracting away the complexities of image processing and OCR. It provides a clean and efficient way to extract data from Argentine documents.

Common Use Cases in Argentina

  • Digital Onboarding: Verify users for Fintech apps in Argentina.
  • Telecom Registration: Automate SIM card registration with DNI.
  • 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.

PYTHON EXAMPLE
from structocr import StructOCR

# 💰 Save 30%+ vs competitors. Get 200 free requests 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)
    # Target: DNI
    image_path = "argentina_national_id.jpg"

    try:
        print(f"Scanning {image_path}...")
        
        # The SDK handles file upload and API communication
        # It automatically detects that this is a Argentine 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("✅ Argentina 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')}")
        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_argentina_id()

Technical Specs

  • Latency: < 5s (Average)
  • Uptime: 98.5% SLA
  • 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.
  • Blur Detection: Automatically rejects blurry images.
  • Fraud Check: Validates DNI 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": "ARG",
    "nationality": "ARGENTINA",
    "document_number": "12.345.678",
    "card_series": "A",
    "personal_number": "20-12345678-9",
    "surname": "GARCÍA",
    "given_names": "MATEO ALEJANDRO",
    "sex": "M",
    "date_of_birth": "1990-05-15",
    "place_of_birth": "BUENOS AIRES",
    "address": "Av. 9 de Julio 1234, CABA",
    "date_of_issue": "2020-01-01",
    "date_of_expiry": "2030-01-01",
    "issuing_authority": "RENAPER"
  }
}

Frequently Asked Questions

Does the Python SDK handle image uploads?

Yes, the SDK automatically handles base64 encoding and file uploads.

Is data stored?

No. Images are processed in-memory and deleted immediately.

How to handle errors?

The SDK result dictionary contains a 'success' boolean and an 'error' message if failed.

More OCR Tutorials

Precise Data Extraction and Seamless Integration with AI-powered OCR API.

Empower your solutions with automated data extraction by integrating best-in class StructOCR via API seamlessly.

No credit card required • Full API access included