BETA

alOCR

Extract text from documents with advanced Arabic and English OCR. Supports PDFs and images with automatic deskewing and layout detection.

Path
/v1/ocr
Key scope
ocr

Supported file formats

PDF, JPG, PNG, TIFF, BMP, WEBP

Supports Arabic and English text extraction with automatic language detection

POSTRead an identity document

Reads a passport, a Saudi national ID, a residence permit (iqama) or a visa and returns its fields. Send one JPG, PNG or PDF of up to 10 MB and 4 pages, as the request body or as a multipart part named file. The answer comes back in about a second, and nothing you send or get back is stored.

Available on request: the ID reader is turned on per account. Until then, calls answer 403 service_not_enabled. Contact us to turn it on.

Billed at 100 SAR per 1,000 pages on which a document was found, from your plan or your wallet. A page with no document is free. The ordinary OCR routes never return these fields.

Endpoint:

curl
curl -X POST https://alapi.deep.sa/v1/id/read \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-binary @card.jpg

Response (200 OK):

{
  "pages": [{
    "page_num": 1,
    "document": {
      "type": "national_id",
      "country": "SAU",
      "sides": ["front"],
      "fields": {
        "id_number": "1000000008",
        "name_ar": "نورة بنت عبدالرحمن أحمد",
        "birth_date": "1992-04-28",
        "expiry_date": "2032-01-19"
      },
      "confidence": { "id_number": 0.99 },
      "checks": { "id_number": true },
      "expired": false,
      "needs_review": []
    }
  }]
}

type is passport, national_id, residence_permit, visa or id_card. fields holds what the document shows (names, numbers, dates in ISO order, nationality); a field it does not show is absent or null. confidence is the chance, from 0 to 1, that each field is exactly right; checks reports check digits and date agreement; document is null on a page with no identity document.

Send a read to a person when needs_review is not empty or a field's confidence is below your bar. When the page has a machine-readable zone, document.mrz carries it as read; add ?mrz=0 to leave it out.

  • 403 service_not_enabled · the ID reader is not turned on for your account
  • 422 no_identity_document · no passport, ID card, residence permit or visa was found; not charged
  • 422 unreadable_file · the file could not be read as an image or PDF; not charged
  • 400 too_many_pages · 413 file_too_large · 415 unsupported_file · over 4 pages, over 10 MB, or not a JPG, PNG or PDF
  • 402 insufficient_balance · nothing left in your plan or wallet to pay for the pages
  • 502 upstream_unavailable · the reader is briefly unavailable; safe to send again, not charged

Ready to Get Started?

Generate an API key from your dashboard and start building

Activate account?

Activate this account?