Documentation / API

Documents to text (OCR)

POST /v1/ocr reads a PDF or an image and gives back its text, page by page, in every EU language: å, ä, ö, ß, ł, ő and Greek or Bulgarian letters included. Pages of a digital PDF come straight from the text in the file. A digital page with 50 or more curved shapes (text drawn as shapes has them) or a picture over a quarter of the page is also read from its picture, up to 40 such pages a call, and the words missing from its text are added. Scanned pages and photos are read. Price: €0.003 / page, every page of the document. A page counts as 1,000 tokens of your free monthly tokens or of a Managed Endpoint or Coder plan's. The document is read in memory and not stored.

Send a document

Upload the file as a form field. Add lang with the document's language for the best result on scans.

curl -sS https://api.axforge.ai/v1/ocr \
  -H "Authorization: Bearer $AXFORGE_API_KEY" \
  -F file=@page-1.jpg \
  -F lang=en
import os
import requests

with open("page-1.jpg", "rb") as f:
    r = requests.post(
        "https://api.axforge.ai/v1/ocr",
        headers={"Authorization": f"Bearer {os.environ['AXFORGE_API_KEY']}"},
        files={"file": ("page-1.jpg", f)},
        data={"lang": "en"},
        timeout=330,
    )
r.raise_for_status()
print(r.json()["text"])

Or send JSON with the file in base64: {"base64": "...", "filename": "contract.pdf", "lang": "sv"}. Links to files are not fetched; send the file itself. Give your client a timeout of at least 6 minutes for long scans.

The answer

{
  "text": "INVOICE 2041\nBrodbod AB, Stockholm\nDate 2026-09-01\nBread flour 25 kg EUR 480.00",
  "pages": [
    {"page": 1, "text": "INVOICE 2041\nBrodbod AB, Stockholm\nDate 2026-09-01\nBread flour 25 kg EUR 480.00",
     "source": "ocr", "lang": "en", "agreement": 1.0}
  ],
  "check": {"agreement": 1.0, "reviewCount": 0, "review": []},
  "totalPages": 1,
  "ocrPages": 1,
  "chars": 79,
  "object": "ocr.result",
  "model": "ocr-eu",
  "usage": {"pages": 1}
}
  • text is the whole document; pages has each page on its own.
  • source is text-layer for a digital PDF page (its text as it is in the file), text-layer+ocr for a digital page read from its picture that gained words, and ocr for a page that was read.
  • check lists the places worth a second look (review: the page, the words before it, what was read, and why): on scanned pages, the words added to a digital page, and formulas drawn as shapes, which are not turned into text. It is null when no page was scanned and no digital page needed a look.
  • usage.pages is what was billed.

Languages

lang takes one of the 24 EU languages: bg, cs, da, de, el, en, es, et, fi, fr, ga, hr, hu, it, lt, lv, mt, nl, pl, pt, ro, sk, sl, sv. Without it the language is found page by page; a page that is mostly numbers is then read as English, so pass lang for tables and financial statements.

Limits

FilesOne PDF or one image per call (PNG, JPEG, TIFF, WebP, BMP or GIF). Save Word, Excel and PowerPoint files as PDF first.
Size20 MB per file
PagesUp to 80 scanned pages and 2,000 pages in all per call; split larger documents. Up to 40 digital pages are read from their picture per call; any more are named in check.
TimeAbout 3 to 7 seconds per scanned page in a call of many pages, and about 10 to 15 seconds for a page alone. Dense tables take the longest, so send up to 20 such pages a call. Digital pages are near instant, about a second for one read from its picture. A call waits up to 300 seconds.

Printed text is read; handwriting is not, and tables come back as lines of text. Pages must be upright. A multi-page TIFF is read from its first page only; send a PDF instead. On a digital page, a scanned part under a quarter of the page is not read, unless the page is read from its picture anyway.

Errors

StatusWhen
400No file, base64 that does not decode, or a lang outside the 24
413Over 20 MB, or more pages than one call reads (the answer says how many)
415Not a PDF or an image
422The PDF is password protected or damaged
503Reading is busy or starting up; try again after the Retry-After seconds. Nothing is charged.
Ask on the forum Markdown For AI Updated 2026-11-06

Anything unclear on this page?

Ask on the forum. The answer helps the next person too.

Ask about this page