Serbia Lična karta OCR Python SDK
Instantly extract data and MRZ from Serbian IDs using our native Python library.
Parsing Lična karta Challenges
Parsing Serbian Lična karta presents unique challenges. Firstly, the use of both Latin and Cyrillic scripts requires robust character recognition. Secondly, variations in card layout across different issuing authorities can complicate accurate data extraction.
Why StructOCR for Serbia
StructOCR's model is specifically trained on a large dataset of Serbian Lična karta images, ensuring high accuracy. The Python SDK provides a simple and efficient way to integrate our OCR engine into your applications, abstracting away the complexities of image processing and data extraction. Our id parsing api enables structured data extraction with only a few lines of code, facilitating efficient information parsing for Serbian identity documents, and fully supports reading the Machine Readable Zone (MRZ) for global compliance.
Common Use Cases in Serbia
- Digital Onboarding: Verify users for Fintech apps in Serbia.
- Telecom Registration: Automate SIM card registration with Lična karta.
- 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.
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_serbia_id():
# Note: Supports JPG, PNG, WebP (Max 4.5MB)
# Target: Lična karta
image_path = "serbia_national_id.jpg"
try:
print(f"Scanning {image_path}...")
# The SDK handles file upload and API communication
# It automatically detects that this is a Serbian 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("✅ Serbia 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)
additional = data.get('additional_fields', {})
if additional.get('mrz_line_1'):
print("\n--- MRZ Data ---")
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_serbia_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)
- •Output: JSON (Structured Data)
Key Features
- •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 Lična karta 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": "SRB",
"nationality": "SRPSKO",
"document_number": "123456789",
"card_series": "",
"personal_number": "0101990710123",
"surname": "JOVANOVIĆ",
"given_names": "NIKOLA",
"sex": "M",
"date_of_birth": "1990-05-15",
"place_of_birth": "BEOGRAD",
"address": "Bulevar kralja Aleksandra 10, Beograd",
"date_of_issue": "2020-01-01",
"date_of_expiry": "2030-01-01",
"issuing_authority": "PU za Grad Beograd",
"additional_fields": {
"phone_number": null,
"tramite_number": null,
"ejemplar": null,
"mrz_line_1": "IDSRB1234567895<<<<<<<<<<<<<<<",
"mrz_line_2": "9005156M3001014SRB010199071012",
"mrz_line_3": "JOVANOVIC<<NIKOLA<<<<<<<<<<<<<"
}
}
}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
Serbia Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Serbia passports with a server-side integration.
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.
Tajikistan Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Tajikistan passports with a server-side integration.
Python National ID OCR API
High-accuracy National ID OCR for Python. Upload an image for a free test! Get structured JSON output via our dedicated Python SDK. Automate KYC and data entry.
UK Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from UK passports with a server-side integration.
Senegal Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Senegal passports with a server-side integration.
Hungary Személyazonosító OCR Python SDK
Python Tutorial: Automate KYC in Hungary. Extract data from Személyazonosító and validate TD1 MRZ using StructOCR Python SDK. Supports native Hungarian text and accents.
Greece Deltio Taftotitas OCR Python SDK
Python Tutorial: Automate KYC in Greece. Extract dual-script data from Deltio Taftotitas and validate TD1 MRZ using StructOCR Python SDK.
India Aadhaar & PAN Card OCR Python SDK
Python Tutorial: Automate KYC in India. Extract data from Indian Aadhaar and PAN Cards using StructOCR Python SDK. Supports Hindi/English parsing and secure format validation.
Ghana Ghana Card OCR Python SDK
Python Tutorial: Automate KYC in Ghana. Extract data, Personal ID Number, and validate TD1 MRZ from Ghana Card using StructOCR Python SDK.
Technical Comparisons & Integrations
Explore platform integrations and competitive analysis
Tesseract OCR vs. StructOCR API for ISO 6346 Container Numbers
A technical comparison for developers evaluating open-source Tesseract vs. a dedicated cloud API for extracting shipping container numbers.
Add Container OCR to Your v0 App in 5 Minutes
Step-by-step guide to integrating the StructOCR shipping container API into a v0 by Vercel app. Build logistics and yard management tools with zero backend.
Add Driver's License OCR to Your v0 App in 5 Minutes
Step-by-step guide to integrating the StructOCR Driver's License scanner API into a v0 by Vercel app. Build car rental and mobility onboarding flows with zero backend.
Add HIN OCR to Your v0 App in 5 Minutes
Step-by-step guide to integrating the StructOCR HIN (Hull Identification Number) scanner API into a v0 by Vercel app. Build marine and boat management tools with zero backend.
Add Invoice OCR to Your v0 App in 5 Minutes
Step-by-step guide to integrating the StructOCR invoice API into a v0 by Vercel app. Build accounts payable and expense tracking tools with zero backend.
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.
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.