OCR API for scanned PDFs and images

POST a scanned PDF or a photo of a page, get the text back as plain text, Markdown or JSON. One REST call, the same API key as every other Sigli conversion.

What the OCR API does

  • Input: PDF, PNG, JPEG, WebP, TIFF, BMP or GIF, up to 20 MB per file — as a multipart upload, base64, a URL Sigli fetches for you, or an upload ID.
  • Engine: Tesseract. Scanned PDF pages are rasterised at 200 DPI; phone photos are turned upright from their EXIF orientation first.
  • Output: output_format=text (default, pages separated by a form feed), markdown, or json (the lines of each page). Every response carries a 0–1 confidence score and the page count.
  • Password-protected PDFs: pass password and Sigli decrypts before reading.
  • Nothing legible? A blank page or an image with no readable text returns HTTP 422 no_text_found, and no credits are charged.

Quick start

One endpoint for every conversion: POST /v1/process with X-Convert-Type: ocr. Authenticate with your key in X-API-Key.

API=${SIGLI_API_URL:-https://api.sigli.dev}

curl -sS "$API/v1/process" \
  -H "X-API-Key: $SIGLI_API_KEY" \
  -H "X-Convert-Type: ocr" \
  -F "file=@scan.pdf" \
  -F "language=eng" \
  -F "output_format=markdown"

A short document comes back inline. This is a typewritten, stamped 1960s scan; clean modern scans give higher confidence:

{
  "success": true,
  "meta": { "type": "ocr", "engine": "tesseract", "format": "markdown" },
  "data": {
    "format": "markdown",
    "text": "Toa-t0003-1004 [2025 RELEASE UNDER THE PRESIDENT JOHN F. KENNEDY ASSASSINATION RECORDS ACT OF 1992]\n…",
    "markdown": "Toa-t0003-1004 [2025 RELEASE UNDER THE PRESIDENT JOHN F. KENNEDY ASSASSINATION RECORDS ACT OF 1992]  \n…",
    "confidence": 0.52,
    "page_count": 1,
    "processing_ms": 1065,
    "document": null
  }
}

Working in Python? The OCR API Python guide has complete requests scripts for images, multi-page scans with job polling, and error handling.

Scans vs digital PDFs

Before running OCR, Sigli checks whether the PDF already has a text layer. If it does, you get that exact text back (engine pdf-extract, confidence 1.0) — faster and without OCR errors. Only image-only PDFs go through Tesseract. Pages whose text layer is garbled by a legacy or broken font encoding (common in older Hindi PDFs) are re-read with OCR at 300 DPI, and the response lists them in warnings. A PDF that mixes typed pages with blank scanned ones returns its text layer only.

Going the other way, the PDF to Markdown API refuses image-only PDFs with HTTP 422 and the code no_text_layer (no credits charged), so your code knows to send that file to OCR instead.

Long PDFs run as async jobs

Each scanned page is a separate OCR pass, so Sigli answers inline only for PDFs of up to 5 pages and 5 MB. Anything larger returns HTTP 202 with a job_id. Poll GET /v1/jobs/{job_id} until status is completed (or failed, with a code and error); the text is in the job's text field. Jobs are charged only if they complete. Async jobs return plain text — use an inline request when you need the Markdown or JSON output.

Languages

The hosted API reads 22 languages: English, Hindi, Bengali, Tamil, Telugu, Marathi, Gujarati, Kannada, Malayalam, Punjabi, Urdu, German, French, Spanish, Portuguese, Italian, Dutch, Arabic, Russian, Simplified Chinese, Japanese and Korean. Passlanguage=auto to detect the script and language from the document (sideways scans are turned upright), or combine codes with + (eng+hin) for bilingual documents. A language that isn't installed is rejected with HTTP 400 and the list of installed languages, rather than silently falling back.

Pricing and free use

  • OCR costs 2 credits per started 5 MB of input — not per page. A 7-page, 0.7 MB scan is 2 credits.
  • Failed requests are never charged; async jobs are charged when they complete.
  • New workspaces get a 14-day Starter trial with 3,000 credits. Starter is $29/month after that (all plans).
  • Sandbox: send sandbox: true or use a sig_test_ key for real output at no credit cost, up to 50 requests a day per workspace (sandbox docs).
  • If the trial ends without a paid plan, the workspace drops to the Free tier: 20 credits a month, with OCR included.

How it compares to typical OCR APIs

TopicSigli
Billing unitPer 5 MB of input, not per page
Digital PDFsText layer returned as-is; no OCR, no OCR errors
Other conversionsSame key and response shape for HTML to PDF, PDF to Markdown, PDF tools and GST invoices
ErrorsJSON with a stable code for every failure (error reference)
Not includedWord coordinates / bounding boxes, handwriting models, table structure from scans

Accuracy depends on the scan: clean, flat 200–300 DPI pages read well; skewed phone photos of receipts produce noisy text. Try your own documents in the OCR tool in the portal before you integrate.

FAQ

Is there a free OCR API tier?

Every new workspace gets a 14-day Starter trial with 3,000 credits; one OCR request costs 2 credits per started 5 MB of input. Sandbox requests (sandbox: true or a sig_test_ key) cost nothing and are capped at 50 a day per workspace. If the trial ends without a paid plan, the workspace drops to the Free tier: 20 credits a month, with OCR included.

Which OCR languages are supported?

22 languages: English, Hindi, Bengali, Tamil, Telugu, Marathi, Gujarati, Kannada, Malayalam, Punjabi, Urdu, German, French, Spanish, Portuguese, Italian, Dutch, Arabic, Russian, Simplified Chinese, Japanese and Korean. Pass language=auto to let Sigli detect the script and language (sideways scans are turned upright), or a Tesseract code such as hin or eng+hin. Asking for a language that isn't installed returns 400 with the list of installed languages.

What are the file size and page limits?

Up to 20 MB per file. PDFs of up to 5 pages and 5 MB are answered inline; larger ones are queued as an async job that you poll at GET /v1/jobs/{job_id}.

Does the API return word positions or bounding boxes?

No. The response has the text, a 0–1 confidence score, the page count and, with output_format=json, the lines of each page. There are no word coordinates.

Are digital (non-scanned) PDFs OCR'd too?

No. If the PDF already has a text layer, Sigli returns that text directly (engine pdf-extract) without running OCR. Only pages whose text layer is garbled by a broken font encoding are re-read with OCR. A PDF mixing text pages and blank scanned pages returns only its text layer.

Try it on your own files

New workspaces start with a 14-day Starter trial (3,000 credits). Create an API key on the API Keys page and run the examples above as they are.