Panama Documento de Identidad OCR Python API

Instantly extract data from Panamanian Identity Cards (Documento de Identidad) using our robust API and Python wrapper.

James | Technical LeadUpdated 2026-07-06
AI extracting data from a Panama Documento de Identidad
StructOCR engine analyzing a Panamanian Documento de Identidad in real-time.

Parsing Documento de Identidad Challenges

Extracting information from the Panamanian Documento de Identidad requires navigating specific layouts, reading Spanish date abbreviations (e.g., 'abr', 'dic'), and accurately capturing data fields issued by the Tribunal Electoral. Standard OCR engines often fail to normalize these regional nuances into standardized machine-readable formats.

Why StructOCR for Panama

StructOCR's model is specifically trained on a vast dataset of global ID images, ensuring superior accuracy for national id ocr processing. Built entirely as an API-first platform deployed on global Cloudflare Workers infrastructure, StructOCR guarantees ultra-low latency without the overhead of heavy SDKs. Our lightweight Python wrapper lets you effortlessly send file uploads, Base64 strings, or image URLs to fully automate your Panamanian verification workflows.

Common Use Cases in Panama

  • Banking & Fintech Onboarding: Verify users instantly for digital banking, mobile wallets, and financial services in Panama City's financial hub.
  • Logistics & Supply Chain: Automate driver and personnel identification at ports, warehouses, and the Panama Canal transit zones.
  • Real Estate & Legal Tech: Streamline background checks and contract drafting by instantly digitizing client credentials.

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 API Integration

Install our lightweight Python API wrapper via pip: `pip install structocr`. Then use the following code.

Prerequisite: Python 3.6+ and `structocr` library installed.

from structocr import StructOCR

# 💰 Note: Deposit via Crypto (USDT/USDC) to automatically receive a 10% credit bonus.
# Initialize with your API Key
client = StructOCR("YOUR_API_KEY_HERE")

def scan_panama_id():
    # Note: The API fully supports direct file uploads, Base64-encoded strings, and image URLs.
    # Target: Documento de Identidad (Panama)
    image_source = "panama_national_id.jpg"

    try:
        print(f"Scanning {image_source}...")
        
        # The Python wrapper handles communication with our Cloudflare-powered API
        result = client.scan_national_id(image_source)

        # Check success flag (Returns a dict matching the JSON API response)
        if result.get('success'):
            data = result['data']
            print("\u2705 Panama Extraction Successful!")
            
            # Basic Identity
            print(f"Region:      {data.get('country_code')}")
            print(f"Name:        {data.get('given_names')} {data.get('surname')}")
            
            # Critical Field: Document Number
            print(f"Document No: {data.get('document_number')}")
            
            # Demographics
            print(f"DOB:         {data.get('date_of_birth')} ({data.get('sex')})")
            print(f"Issued by:   {data.get('issuing_authority')}")
            
        else:
            print(f"\u274c Extraction Failed: {result.get('error')}")

    except Exception as e:
        # Handle API or Network errors
        print(f"An error occurred: {e}")

if __name__ == "__main__":
    scan_panama_id()

Technical Specs

  • Latency: < 5s (Average, powered by Cloudflare)
  • Uptime: 99.9% SLA
  • Security: AES-256 Encryption & SOC2 Compliant
  • Input: File Uploads, Base64 Strings, Image URLs (Max 4.5MB)
  • Output: JSON (Structured Data)

Key Features

  • Flexible Input Handling: Our API natively processes raw file uploads, Base64-encoded strings, and remote image URLs seamlessly.
  • Advanced Date Normalization: Intelligently parses Spanish abbreviations (e.g., 'abr', 'jul') and standardizes issue/birth dates into a clean `YYYY-MM-DD` format.
  • Authority Recognition: Reliably extracts issuing bodies like 'Tribunal Electoral' directly from the document.
  • Smart Crop & Blur Detection: Rejects blurry images and removes background noise automatically to ensure high precision.

JSON API Response Example

The API returns the following structured JSON data.

{
  "success": true,
  "data": {
    "type": "national_id",
    "country_code": "PAN",
    "nationality": "Panamanian",
    "document_number": "8-123-456",
    "card_series": null,
    "personal_number": null,
    "surname": "Perez Garcia",
    "given_names": "Juan Carlos",
    "sex": "M",
    "date_of_birth": "1985-10-15",
    "place_of_birth": "PANAMÁ",
    "address": null,
    "date_of_issue": "2020-05-10",
    "date_of_expiry": "2035-05-10",
    "issuing_authority": "Tribunal Electoral",
    "additional_fields": {
      "phone_number": null,
      "tramite_number": null,
      "ejemplar": null,
      "mrz_line_1": null,
      "mrz_line_2": null,
      "mrz_line_3": null
    }
  }
}

Frequently Asked Questions

Can I test the API with my own images for free?

Yes! You can easily create an account and utilize our free tier to upload and test your own Documento de Identidad images directly via the API.

Do I need to use an SDK to access the OCR engine?

No, StructOCR is built as a highly accessible API platform. While we offer lightweight wrappers for languages like Python, you can integrate directly via standard HTTP requests using file uploads, Base64 payloads, or URLs.

Is user data stored on your servers?

No. Images are processed entirely in-memory on our Cloudflare edge nodes and deleted immediately, ensuring full compliance with global data privacy and identity protection standards.

How to handle errors?

The JSON API response contains a 'success' boolean and an 'error' code (e.g., INVALID_BASE64, FILE_TOO_LARGE) if the request fails.

You May Also Like

Related tutorials, platform guides, and comparisons

Country Tutorial

Morocco Passport OCR with Python SDK

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

Python · Passport
Country Tutorial

Netherlands Identiteitskaart OCR Python SDK

Python Tutorial: Automate KYC in Netherlands. Extract data from Identiteitskaart using StructOCR Python SDK. Supports native text and MRZ extraction.

Python · identiteitskaart
Country Tutorial

Indian Passport OCR with Python SDK

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

Python · Passport
Country Tutorial

Côte d'Ivoire Passport OCR with Python SDK

Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Côte d'Ivoire passports with a server-side integration.

Python · Passport
Country Tutorial

Ukraine Passport OCR with Python SDK

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

Python · Passport
Country Tutorial

Slovakia Občiansky preukaz OCR Python SDK

Python Tutorial: Automate KYC in Slovakia. Extract data from Občiansky preukaz using StructOCR Python SDK. Supports native text and MRZ extraction.

Python · občiansky preukaz
Country Tutorial

UAE Emirates ID OCR Python SDK

Python Tutorial: Automate KYC in the UAE. Extract data from Emirates ID using the StructOCR Python SDK. Supports bilingual (Arabic/English) text, front/back sides, and 3-line MRZ extraction.

Python · emirates id
Country Tutorial

Switzerland ID Card OCR Python SDK

Python Tutorial: Automate KYC in Switzerland. Extract data from the Swiss Identity Card (Identitätskarte) using StructOCR Python SDK. Supports multi-lingual text and MRZ extraction.

Python · swiss id
Country Tutorial

Tajikistan ID Card (Karta) OCR Python SDK

Python Tutorial: Automate KYC in Tajikistan. Extract data from ID Card (Karta) using StructOCR Python SDK. Supports native text and MRZ extraction.

Python · id card (karta)
Country Tutorial

Thailand ID Card OCR Python SDK

Python Tutorial: Automate KYC in Thailand. Extract data from the Thai National Identity Card using StructOCR Python SDK. Supports Thai script, dual-language fields, and 13-digit Citizen ID extraction.

Python · thai id card

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