Document OCR
Runs OCR on a document and returns structured page layout with text.#
/lmkit/v1/document-ocrPerforms Optical Character Recognition on the specified pages (or all pages) of the provided document, returning detected paragraphs, lines, words, and their bounding boxes. If processing exceeds the configured timeout, returns 202 Accepted with a job_id. Poll GET /lmkit/v1/jobs/ for status and results.
Request body
application/json ·
| Property | Type | Description |
|---|---|---|
inputrequired | string | The input document to OCR. When input_format is 'Base64EncodedFile', provide a base64-encoded file payload (supported: PDF, PNG, BMP, GIF, PSD, PIC, JPEG, PNM, HDR, TGA, WEBP, TIFF). When 'FileIdentifier', provide the file ID previously returned by the lmkit/v1/files/upload endpoint. |
input_format | How the input is provided. Accepted values: 'Base64EncodedFile' or 'FileIdentifier'. 'Base64EncodedFile' expects a base64-encoded document or image file. 'FileIdentifier' references a file previously uploaded via lmkit/v1/files/upload. Defaults to 'Base64EncodedFile'. | |
page_range | string | An optional page range to process (e.g. "1-3", "1,3,5", "2-"). When empty or not specified, all pages are processed. Page numbers are 1-based. |
Responses
| Status | Type | Description |
|---|---|---|
| 200 | OK | |
| 202 | Accepted | |
| 400 | Bad Request | |
| 404 | Not Found | |
| 500 | application/json | Internal Server Error |
curl -X POST "$LMKIT_ONE_URL/lmkit/v1/document-ocr" \
-H "Authorization: Bearer $LMKIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "",
"input_format": "Base64EncodedFile",
"page_range": ""
}'