smallapis

OCR API

Tesseract 5 with automatic pre-processing (deskew-free grayscale normalisation and upscaling of small scans). Also produces a searchable PDF with an invisible text layer.

4 endpoints

Click one to see its parameters and a ready-to-paste curl call.

POST /v1/ocr/image Read the text in an image

Read the text in an image

Returns: json

ParameterTypeDescription
file file Image to read.
url string Public URL instead of an upload.
lang string eng, fra, deu, spa, ita, por, nld. Combine with "+". Default: eng
words boolean Also return per-word bounding boxes and confidence. Default: false
psm integer Tesseract page segmentation mode, 0-13. Default: 3
curl -X POST "https://173-249-18-142.sslip.io/v1/ocr/image" \
  -H "X-API-Key: $SMALLAPIS_KEY" \
  -F "file=@input.jpg" \
  -F "lang=eng" \
  -F "words=false" \
  -F "psm=3"
POST /v1/ocr/pdf Read the text in a scanned PDF

Uses the embedded text layer when there is a usable one, and only falls back to OCR when the pages are images.

Returns: json

ParameterTypeDescription
file file PDF to read.
lang string OCR language. Default: eng
first integer First page, 1-based. Default: 1
last integer Last page. At most 20 pages per call.
force boolean OCR even when a text layer exists. Default: false
curl -X POST "https://173-249-18-142.sslip.io/v1/ocr/pdf" \
  -H "X-API-Key: $SMALLAPIS_KEY" \
  -F "file=@input.pdf" \
  -F "lang=eng" \
  -F "first=1" \
  -F "force=false"
POST /v1/ocr/searchable-pdf Add an invisible text layer to a scan

Takes an image or a scanned PDF and returns a PDF you can search and copy from.

Returns: binary pdf

ParameterTypeDescription
file file Image or PDF to process.
lang string OCR language. Default: eng
curl -X POST "https://173-249-18-142.sslip.io/v1/ocr/searchable-pdf" \
  -H "X-API-Key: $SMALLAPIS_KEY" \
  -F "file=@input.pdf" \
  -F "lang=eng" \
  --output result.bin
GET /v1/ocr/languages List the installed OCR languages

List the installed OCR languages

Returns: json

No parameters.

curl -H "X-API-Key: $SMALLAPIS_KEY" \
  "https://173-249-18-142.sslip.io/v1/ocr/languages" --output out.bin