Home/Documentation/POST /scan/extract_text
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.

ParameterDefaultWhat it does
file or filesrequiredOne image, or several images for a multi-page extraction.
ocr_langengLanguage 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

StatusMeaningWhat to do
400No fileSend file for one page or files for several pages.
401Missing API Key or Invalid API KeySend the X-API-Key header with a key from an active account.
402Insufficient creditsTop up credits in the dashboard.
429Rate limitWait for the seconds given in Retry-After, then retry.
500Text extraction failedThe recognition step did not return text for this input. Retry once, then send the image to support.