Iraq Unified National Card OCR API with Python

Extract the card number, names, and dates from the Iraq Unified National Card with the StructOCR Python SDK and a server-side integration.

Working with the Unified National Card

Iraq’s Unified National Card replaced older civil status IDs and is printed mainly in Arabic. Re-keying these values is slow, and generic OCR still leaves your team to map each text fragment to the right field.

Structured Extraction for Your Backend

The National ID OCR API returns the card number, names, dates, and address when they are printed on the submitted side of the card. Test it with the free ID card scanner.

Common Integration Scenarios

  • Customer onboarding: Pre-fill identity fields from the Unified National Card before the customer confirms them.
  • Account operations: Reduce manual transcription when staff enter identity data.
  • Document review: Store normalized output next to your own review decision.
Need more testing? Create a free account to get 200 free credits (equals 100 National ID scans).

Iraq Unified National Card OCR API with Python

The official Python SDK reads a local file and calls /v1/national-id from your backend.

Prerequisite: `pip install structocr`; set the server-side `STRUCTOCR_API_KEY` environment variable.

Prefer another stack? Open the Node.js SDK + Express integration.

import os
from structocr import StructOCR

client = StructOCR(os.environ["STRUCTOCR_API_KEY"])
result = client.scan_national_id("id-card.jpg")

if result.get("success"):
    data = result["data"]
    print(data.get("document_number"))
    print(data.get("given_names"), data.get("surname"))
else:
    print(result.get("error"))

Technical Specs

  • •Endpoint: POST /v1/national-id
  • •Input: Base64-encoded JPG, PNG, WebP, or PDF in JSON (Max 4.5MB)
  • •Authentication: Server-side x-api-key header handled by the SDK
  • •Cost: 2 credits per successful scan; failed requests are not billed
  • •Output: Structured JSON

Key Features

  • •Local document: Handles the Unified National Card as a national identity document.
  • •Identifier output: Returns the card number when visible.
  • •Normalized names and dates: Consistent JSON keys across countries.
  • •Server integration: The API key stays on your backend.

JSON Response Example

Fictional values showing the normalized shape for a readable Unified National Card; unavailable fields are null.

{
  "success": true,
  "data": {
    "type": "national_id",
    "country_code": "IRQ",
    "document_number": "000000000000",
    "personal_number": null,
    "surname": "DOE",
    "given_names": "ALEX",
    "sex": null,
    "date_of_birth": "1990-01-01",
    "place_of_birth": null,
    "date_of_issue": null,
    "date_of_expiry": null,
    "issuing_authority": null,
    "address": "BAGHDAD",
    "additional_fields": {}
  }
}

Frequently Asked Questions

Does the API validate the card number?

It extracts the number as printed. Database checks and authenticity verification require official channels or your own review.

Which inputs are supported?

JSON with a Base64-encoded JPG, PNG, WebP, or PDF up to 4.5MB; the SDK handles encoding.

Is there a version for the other SDK language?

Yes. A paired Node.js version of this tutorial covers the same document.

You May Also Like

Related tutorials, platform guides, and comparisons

Country Tutorial

Iraq Unified National Card OCR API with Node.js

Extract the card number, names, and dates from the Iraq Unified National Card with the StructOCR Node.js SDK and a server-side integration.

Node.js · National ID
Country Tutorial

Japan My Number card OCR: Extract Fields with Python

Extract visible fields from Japan my number card images into JSON. Map identifiers, names and dates, with a review workflow for incomplete results.

Python · National ID
Country Tutorial

El Salvador DUI OCR API with Python

Extract the DUI number, names, and dates from the El Salvador Documento Único de Identidad (DUI) with the StructOCR Python SDK and a server-side integration.

Python · National ID
Country Tutorial

South Korea resident registration card OCR: Extract Fields with Python

Extract visible fields from South Korea resident registration card images into JSON. Map identifiers, names and dates, with a review workflow for incomplete results.

Python · National ID
Country Tutorial

Bangladesh Smart NID OCR Python SDK

Python Tutorial: Automate KYC in Bangladesh. Extract complex Bengali text and decode 2D barcodes from Smart NIDs using StructOCR Python SDK.

Python · National ID
Tutorial

Node.js National ID OCR API

Extract National ID data with our Node.js SDK. Upload an image for a free test! Get clean, validated JSON output from any ID card image. Integrate KYC in minutes.

Node.js · National ID
Tutorial

Java National ID Parser API

Upload an image for a free test! Eliminate manual data entry for national IDs. Our Java ID card parsing API provides AES-256 encrypted JSON output in <4s average latency, ensuring SOC2 compliant verification.

Java · National ID
Country Tutorial

Israel Teudat Zehut OCR API with Node.js

Extract the identity number, names, and dates from the Israel Teudat Zehut (identity card) with the StructOCR Node.js SDK and a server-side integration.

Node.js · National ID
Tutorial

Go National ID OCR API

Upload an image for a free test! High-accuracy National ID data extraction for Go developers. Get structured JSON output via a simple API call, replacing unreliable open-source tools.

Go · National ID
Country Tutorial

Ireland Driver License OCR: Extract Fields with Python

Extract visible fields from Ireland driver license images into JSON. Map identifiers, names and dates, with a review workflow for incomplete results.

Python · Driver License

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