Cyprus Passport OCR: Extract Fields with Python
Extract visible fields from Cyprus passport images into JSON. Map identifiers, names and dates, with a review workflow for incomplete results.
Cyprus document intake: what needs review
Review Greek or Latin name representations without treating different scripts as separate travellers. In a production intake, keep the uploaded document associated with the correct application record before extraction. A legible name alone does not establish that the number, dates and address were captured correctly. Avoid filling missing values from a previous booking or a customer profile without recording that separate source.
Map Cyprus document evidence into your backend
Capture the full identity page, including the visual fields and machine-readable area. Keep entry stamps and visa pages out of the input used for passport data. Compare ambiguous names or dates against the source; OCR is not chip authentication. Send the image to the passport API and keep extracted evidence separate from your approval decision. The same endpoint handles the submitted image; the article's country or state context does not force the API to return that jurisdiction. Compare the returned country with the source before saving the result.
A reviewable intake workflow
- Cyprus document intake: Review Greek or Latin name representations without treating different scripts as separate travellers.
- Map fields without losing their meaning: Store passport_number as text, keep surname and given_names in their own fields, and retain source images according to your document-handling policy. Date parsing failures should be reviewable instead of becoming today's date.
- Compare a resubmitted document: Keep a prior extraction and a new extraction as separate events. A change in number, name or expiry should produce a review item, not an automatic overwrite of a trusted record.
- Export only the fields your workflow uses: Map the response to your form explicitly. Keep nationality separate from issuing country and place of birth.
Python request for Cyprus passport OCR
This REST example sends a local image as Base64 JSON. Run it on a backend and keep the API key in an environment variable. The printed example below is deliberately synthetic and is not a valid document-number format specimen.
Prerequisite: Python 3, pip install requests; STRUCTOCR_API_KEY set on the server
import base64
import os
import requests
with open("cyprus-passport.jpg", "rb") as source:
encoded = base64.b64encode(source.read()).decode("ascii")
response = requests.post(
"https://api.structocr.com/v1/passport",
headers={"x-api-key": os.environ["STRUCTOCR_API_KEY"]},
json={"img": encoded},
timeout=60,
)
response.raise_for_status()
result = response.json()
if not result.get("success"):
raise RuntimeError("Extraction was not successful; inspect the response securely")
data = result.get("data") or {}
required = ["passport_number", "surname", "date_of_expiry"]
missing = [field for field in required if not data.get(field)]
# Queue incomplete records; do not log identity data in production.
print({"needs_review": bool(missing), "missing_fields": missing})Technical Specs
- •Endpoint: POST /v1/passport
- •Authentication: Server-side x-api-key header
- •Input: Base64 image in JSON img; use a readable JPG, PNG or WebP for this example
- •File size: Up to 4.5MB decoded
- •Standard processing: 2 credits per scan
- •Output: JSON; retain incomplete results for review
Key Features
- •Local extraction concern: Review Greek or Latin name representations without treating different scripts as separate travellers.
- •Identifiers: Keep strings intact; do not coerce document numbers into numeric spreadsheet columns.
- •Dates: Validate date syntax and labels. An unexpected value needs source review, not silent correction.
- •Image evidence: Preserve all card or page edges, reduce glare and avoid cropping small text.
Illustrative response fields
Synthetic subset of the response for mapping purposes. Values and dates are examples, not a real scan or an assertion about document validity periods. Actual fields depend on the submitted document.
{
"success": true,
"data": {
"country_code": "CYP",
"passport_number": "EXAMPLE-NOT-A-REAL-ID",
"surname": "EXAMPLE",
"given_names": "PERSON",
"date_of_birth": "1990-01-15",
"date_of_issue": "2024-04-12",
"date_of_expiry": "2029-04-12",
"issuing_authority": null,
"nationality": "CYP"
}
}Frequently Asked Questions
What is the main concern with Cyprus passport intake?
Review Greek or Latin name representations without treating different scripts as separate travellers.
Does extracting a number verify the document?
No. Extraction returns visible data. Authenticity checks, live registry checks and the final onboarding decision are separate processes.
What should happen when a date or name is unreadable?
Keep the record pending and request a clearer image or a manual review. Do not infer a date from an account profile or shorten a name to make it match.
Where should I check document-format references?
Use the ICAO Doc 9303 document specifications as a starting point for document-format research, together with the issuing authority. Public collections may not include every country or current card version.
Can the same workflow run without Python?
Yes. Any backend that can send an authenticated JSON request can call /v1/passport. See the API reference for the current response contract.
You May Also Like
Related tutorials, platform guides, and comparisons
Sweden Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Sweden passports with a server-side integration.
Hungary Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Hungary passports with a server-side integration.
Portugal Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Portugal passports with a server-side integration.
Argentina Passport OCR with Python SDK
Use the official StructOCR Python SDK and FastAPI to extract structured MRZ and VIZ data from Argentina 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.
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.
Netherlands Passport OCR with Node.js SDK
Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Netherlands passports.
Czech Republic Passport OCR with Node.js SDK
Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Czech Republic passports.
Morocco Passport OCR with Node.js SDK
Use the official StructOCR Node.js SDK with TypeScript and Express to extract structured MRZ and VIZ data from Morocco passports.
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.
Technical Comparisons & Integrations
Explore platform integrations and competitive analysis
Tesseract & PassportEye vs. StructOCR Passport API
A technical evaluation for developers deciding between open-source MRZ scanners and a dedicated cloud-based Passport OCR API.
Add Passport OCR to Your v0 App in 5 Minutes
Step-by-step guide to integrating the StructOCR Passport scanner API into a v0 by Vercel app through a secure Next.js server route.
AWS Textract vs. StructOCR API for Indian Passport Back Page Extraction
Why generic OCR fails at parsing the back page of Indian passports, and how a dedicated KYC API instantly extracts structured addresses, PIN codes, and family details.
AWS Textract & Google Vision vs. StructOCR Passport API
How AWS Textract AnalyzeID, Google Cloud Vision OCR, and the StructOCR Passport API differ for passport data, quoting each vendor’s own documentation.
Add Passport OCR to Your Bolt.new App in 5 Minutes
Step-by-step guide to integrating the StructOCR Passport scanner API into a Bolt.new app. Build travel, hospitality, and global KYC flows right in your browser.
Add Passport OCR using Cursor in 5 Minutes
Step-by-step guide to integrating the StructOCR Passport scanner API using the Cursor AI code editor. Build travel, hospitality, and global KYC flows rapidly.
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.