Answer: POST /api/v1/tools/ocr runs OCRmyPDF with Tesseract on an uploaded PDF and returns a searchable PDF; three credits. Every option is optional and the defaults reproduce the original behaviour — OCR every page, English, no optimisation — so a request that sends none behaves exactly as before. A bad option is a 422 whose code and message name the field.
Request
Send the file as multipart files= and the options as a JSON options field. language (singular) is the field the dashboard and the published code samples send; languages is its plural form and wins when both are present.
curl -X POST https://www.ashdocs.com/api/v1/tools/ocr \
-H "X-API-Key: ash_test_xxxxxxxx" \
-F "files=@scan.pdf" \
-F 'options={"language":"eng+deu","fix_scan":{"deskew":true},"output":{"text_sidecar":true}}'Options
Generated from the OCR engine's command builder.
| Sent in | Key | What it does |
|---|---|---|
| options | languages | Tesseract language codes, as a list or a string joined by + or ,. Default eng. A code not installed on the server is refused by name. |
| options | language | Singular alias of languages — the field the dashboard and the published code samples send. languages wins when both are present. |
| options | mode | auto, skip, force or redo. Default force — OCR every page even if it already has text. |
| options | optimize | Output optimisation level 0–3. Default 0. |
| options | fix_scan.rotate | true rotates pages to the detected orientation. |
| options | fix_scan.deskew | true straightens skewed scans. |
| options | fix_scan.clean | true cleans the page before OCR (needs unpaper on the server; refused by name when absent). |
| options | fix_scan.oversample_dpi | 0 (off), 300 or 400 — upsample low-resolution scans before OCR. |
| options | output.type | pdf (default) or pdfa. |
| options | output.text_sidecar | true also returns the recognised text as a .txt file. |
| options | output.words_json | true also returns per-word positions as JSON, for documents up to 50 pages. |
| options | pages | Page range such as 1-3,7. Default all pages. |
| options | psm | Tesseract page segmentation mode, 1 or 3–13. Default 3. |
| options | jpeg_quality | 1–100. Unset by default. |
| options | skip_big_mpixels | Skip OCR on images larger than this many megapixels. Unset by default. |
Frequently asked questions
Which languages can I use?
Any Tesseract code installed on the server. A code that is not installed is refused by name rather than ignored.
Can I get the text on its own?
Yes — output.text_sidecar: true returns a .txt alongside the PDF, and output.words_json: true returns per-word positions.
Will it OCR pages that already have text?
By default yes (mode force). Use mode skip to leave pages with text alone, or redo to replace an existing OCR layer.