Endpoint reference
POST /scan/extract_text
The scan endpoints prepare the image; this one reads it. Send a document photo and get the recognised text back as JSON.
Request contract
POST https://api.scankit.io/scan/extract_text takes multipart/form-data with one image per page: file for a single page, files repeated for several pages.
| Parameter | Default | What it does |
|---|---|---|
| file or files | required | One image, or several images for a multi-page extraction. |
| ocr_lang | eng | Language hint for the recognition, for example eng, deu or fra. |
Cleaner text from a cleaned image
Recognition quality depends on the input. A straightened, evenly lit scan from POST /scan/crop is recognised more reliably than a photo taken at an angle, so the usual order is crop first, extract second.
Response
One page returns the text as a single string:
json
{
"success": true,
"text": "Invoice 2026-0417 ...",
"language": "eng"
}Several pages return one string per page, in the order you sent them:
json
{
"success": true,
"texts": ["first page text", "second page text"],
"page_count": 2,
"language": "eng"
}Example
bash
curl -X POST "https://api.scankit.io/scan/extract_text" \
-H "X-API-Key: YOUR_API_KEY" \
-F "file=@document.jpg" \
-F "ocr_lang=eng"The response is JSON with success, text and language. A page without recognisable characters is not an error: it returns an empty string.
Errors
| Status | Meaning | What to do |
|---|---|---|
| 400 | No file | Send file for one page or files for several pages. |
| 401 | Missing API Key or Invalid API Key | Send the X-API-Key header with a key from an active account. |
| 402 | Insufficient credits | Top up credits in the dashboard. |
| 429 | Rate limit | Wait for the seconds given in Retry-After, then retry. |
| 500 | Text extraction failed | The recognition step did not return text for this input. Retry once, then send the image to support. |