Romania Carte de Identitate OCR Python SDK

Instantly extract data and MRZ from the latest Romanian IDs (Front & Back) using our native Python library.

Parsing Carte de Identitate Challenges

Parsing Romanian Carte de Identitate presents unique challenges. The documents often feature inconsistent print quality, especially on older cards. Furthermore, variations in layout across generations, handling dual-sided verification, and the presence of both Latin and Romanian-specific characters require robust OCR capabilities.

Why StructOCR for Romania

StructOCR's model is specifically trained on a large dataset of Romanian Carte de Identitate, ensuring high accuracy even with variations in print quality and layout. This advanced national id ocr capability facilitates efficient information parsing. Furthermore, it fully supports reading the Machine Readable Zone (MRZ) for rigorous global compliance and identity verification. Fully supports the latest Romanian ID card format, enabling seamless data extraction from both front and back sides, specifically optimized for the newest versions featuring the MRZ on the back. Our Python SDK simplifies the integration process, allowing you to extract data with just a few lines of code.

Common Use Cases in Romania

  • Digital Onboarding: Verify users for Fintech apps in Romania.
  • Telecom Registration: Automate SIM card registration with Carte de Identitate.
  • Hotel Check-in: Speed up guest registration workflows.
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`. Then use the following code.

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

from structocr import StructOCR

# Get 200 free credits:
# 👉 https://structocr.com/register
# Initialize with your API Key
client = StructOCR("YOUR_API_KEY_HERE")

def scan_romania_id():
    # Note: Supports JPG, PNG, WebP (Max 4.5MB)
    # Target: Carte de Identitate (Supports front, back, and latest MRZ version)
    image_path = "romania_national_id_back.jpg"

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

            # Machine Readable Zone (MRZ) - Found on the back of latest Romanian IDs
            additional = data.get('additional_fields', {})
            if additional.get('mrz_line_1'):
                print("\n--- MRZ Data (Reverse Side) ---")
                print(additional.get('mrz_line_1'))
                print(additional.get('mrz_line_2'))
                if additional.get('mrz_line_3'):
                    print(additional.get('mrz_line_3'))
        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_romania_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) — Supports Front & Back images
  • •Output: JSON (Structured Data with MRZ support)

Key Features

  • •Latest Romanian ID Support: Fully supports the newest Romanian ID cards, processing both front and back sides, with explicit capability for the reverse side containing the MRZ.
  • •Native Script Support: Reads English and local characters.
  • •MRZ Parsing: Accurately extracts and validates the Machine Readable Zone lines for cross-checking.
  • •Blur Detection: Automatically rejects blurry images.
  • •Fraud Check: Validates Carte de Identitate number format (CNP).
  • •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": "ROU",
    "nationality": "ROMÂNĂ",
    "document_number": "123456",
    "card_series": "RX",
    "personal_number": "1900101123456",
    "surname": "POPESCU",
    "given_names": "ANDREI",
    "sex": "M",
    "date_of_birth": "1990-05-15",
    "place_of_birth": "MUN. BUCUREȘTI",
    "address": "Str. Mihai Eminescu nr. 10, Bl. A2, Sc. 1, Ap. 4, București",
    "date_of_issue": "2020-01-01",
    "date_of_expiry": "2030-01-01",
    "issuing_authority": "SPCEP Sector 1",
    "additional_fields": {
      "phone_number": null,
      "tramite_number": null,
      "ejemplar": null,
      "mrz_line_1": "IDROU123456<0<<<<<<<<<<<<<<<<",
      "mrz_line_2": "9005155M3001018ROU19001011234562",
      "mrz_line_3": null
    }
  }
}

Frequently Asked Questions

Does the Python SDK handle image uploads?

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

Is data stored?

Only briefly. Uploaded images and results are kept for at most 24 hours for quality spot-checks, then deleted.

How to handle errors?

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

You May Also Like

Related tutorials, platform guides, and comparisons

Country Tutorial

Romania Passport OCR with Python SDK

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

Python · Passport
Country Tutorial

Netherlands Passport OCR with Python SDK

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

Python · Passport
Country Tutorial

Canada Driver License OCR with Python SDK

Extract structured fields from a Canada provincial driver licence with the StructOCR Python SDK and FastAPI.

Python · Driver License
Country Tutorial

Algeria CNIBE (Biometric ID) OCR Python SDK

Python Tutorial: Automate KYC in Algeria. Extract bilingual text and validate TD1 MRZ from CNIBE (Biometric ID) using StructOCR Python SDK.

Python · cnibe (biometric id)
Country Tutorial

Irish Passport OCR with Python SDK

Use the StructOCR Python SDK and FastAPI to extract visible identity, validity and MRZ fields from Irish passports.

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

Brazil CIN OCR Python SDK: Extract CPF & MRZ

Python Tutorial: Automate KYC in Brazil. Extract Portuguese text, CPF numbers, and validate TD1 MRZ from the new CIN using the StructOCR Python SDK.

Python · carteira de identidade (cin)
Country Tutorial

Chile Cédula OCR Python SDK

Python Tutorial: Automate KYC in Chile. Extract data from the Chilean Cédula de Identidad using StructOCR Python SDK. Supports RUN/RUT extraction and native Spanish text parsing.

Python · cédula de identidad
Country Tutorial

Bulgaria Lichna karta (Лична карта) OCR Python SDK

Python Tutorial: Automate KYC in Bulgaria. Extract Cyrillic/Latin text, EGN (ЕГН), and validate TD1 MRZ from Lichna karta using StructOCR Python SDK.

Python · lichna karta (лична карта)
Country Tutorial

Colombia Cédula OCR Python SDK

Python Tutorial: Automate KYC in Colombia. Extract data from the Colombian Cédula de Ciudadanía using StructOCR Python SDK. Supports NUIP extraction and complex address parsing.

Python · cédula de ciudadanía

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 No Credit Card