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.
Live Demo: ID card scanner
No registration required. Upload a file to test the extraction.
Drop files here or click to browse
JPG · PNG · WebP · up to 500 files · max 4.5 MB each
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
# 💰 Save 30%+ vs competitors. Get 200 free credits instantly:
# 👉 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)
- •Uptime: 99.9% SLA
- •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?
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.
You May Also Like
Related tutorials, platform guides, and comparisons
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.
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.
Canada Driver License OCR with Python SDK
Extract structured fields from a Canada provincial driver licence with the StructOCR Python SDK and FastAPI.
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.
Irish Passport OCR with Python SDK
Use the StructOCR Python SDK and FastAPI to extract visible identity, validity and MRZ fields from Irish passports.
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.
Czech Republic Občanský průkaz OCR Python SDK
Python Tutorial: Automate KYC in the Czech Republic. Extract Czech text with diacritics, Rodné číslo, and validate TD1 MRZ from Občanský průkaz.
Côte d'Ivoire CNI (Carte Nationale d'Identité) OCR Python SDK
Python Tutorial: Automate KYC in Côte d'Ivoire. Extract French text, NNI, and validate TD1 MRZ from the ONECI CNI using StructOCR Python SDK.
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.
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.
Technical Comparisons & Integrations
Explore platform integrations and competitive analysis
Add National ID OCR to Your Bolt.new App in 5 Minutes
Step-by-step guide to integrating the StructOCR National ID scanner API into a Bolt.new app. Build KYC and identity verification flows right in your browser.
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 National ID OCR to Your Lovable.dev App in 5 Minutes
Step-by-step guide to integrating the StructOCR National ID scanner API into a Lovable.dev app. Build KYC and identity verification flows with zero backend.
Add National ID OCR to Your Replit App in 5 Minutes
Step-by-step guide to integrating the StructOCR National ID scanner API into a Replit application. Build KYC and identity verification flows using Replit Agent and Secrets.
Add National ID OCR to Your v0 App in 5 Minutes
Step-by-step guide to integrating the StructOCR National ID scanner API into a v0 by Vercel app. Build KYC and identity verification flows with zero backend.
Add Receipt OCR to Your v0 App in 5 Minutes
Step-by-step guide to integrating the StructOCR receipt API into a v0 by Vercel app. Build expense tracking and receipt scanning tools right in your browser.
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.