LM-Kit OneDocs2026.10.10lm-kit.comEULA
AI Extraction

Document Parsing

Parses a document into typed, positioned elements with the AI document parser.#

POST/lmkit/v1/document-parsing

Parses a PDF, a scan or an image with the AI document parser: every page becomes a list of elements in reading order, each with its role (title, text, table, formula, figure, caption, header, footer), its bounding box, its confidence and its typed content: tables as HTML with their spans, formulas as LaTeX, and charts as the data table they plot. One setting, 'effort' (Low, Medium, High), trades time for fidelity; the parser selects and verifies its own models. The result is returned as lossless JSON (default, parsed-document schema v1), Markdown, semantic HTML or DocLang. With 'include_figure_images', the picture of every figure is embedded too. With 'include_markdown' and 'Json', the response also carries the Markdown of the same parse for the document, each page and each element. This endpoint runs vision models on every page and is slower than document-to-markdown, which stays the fast path for text-layer documents. 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 ·

PropertyTypeDescription
inputrequiredstring

The document to parse: a PDF, a scan or an image. When input_format is 'Base64EncodedFile', provide a base64-encoded file payload. When 'FileIdentifier', provide the file ID previously returned by the api/v1/files/upload endpoint.

input_format

How the input is provided: 'Base64EncodedFile' (default) or 'FileIdentifier'.

effort

How much work the parser puts into each page. 'Minimal' loads no model: the text each page carries, with OCR for scans; 'Low' is the fastest level that reads with the model, for high-volume ingestion; 'Medium' (default) balances time and fidelity; 'High' gives the most faithful result, where every table, chart and heading counts. The parser selects and verifies its own models for each level.

pagesstring

An optional 1-based page range to parse (e.g. "1-3", "1,3,5", "2-"). When empty, every page is parsed.

output_format

The format of the result. 'Json' (default) returns the lossless parsed document in 'document'; 'Markdown', 'Html' and 'DocLang' return the rendering as text in 'content'.

include_figure_imagesboolean

When true, the picture of every figure and chart is cut from the page and embedded in the result (base64 PNG in the JSON, data URIs in HTML and DocLang). Adds one page render per page that holds a figure. Defaults to false.

include_markdownboolean

With output_format 'Json' only: when true, the response also carries the Markdown rendering of the same parse, for the document ('markdown'), each page ('page_markdown') and each element ('element_markdown'), aligned with the pages and elements of 'document'. The structure and its rendering then come from one parse. Defaults to false.

markdown_scripts

Markdown rendering only: how superscripts and subscripts are written. 'HtmlTags' (default, m2) or 'Latex' (inline math m${2}$ in running text, bare m{2} inside table cells and formulas).

markdown_table_cell_emphasisboolean

Markdown rendering only: whether table cells keep their emphasis tags (bold, italic, underline). Defaults to true.

markdown_underlineboolean

Markdown rendering only: whether running text keeps the underline tags of underlined words. Defaults to true.

markdown_underscore_emphasisboolean

Markdown rendering only: whether emphasis a reading writes between underscores (word) keeps them; false writes it between asterisks (word). Defaults to true.

markdown_running_text

Markdown rendering only: where page headers, footers and page numbers go. 'HeadersFirstFootersLast' (default), 'ReadingOrder' or 'Omitted'.

markdown_charts

Markdown rendering only: how each chart reads. 'DataTable' (default), 'PrintedText' or 'DataTableAndPrintedText'.

markdown_task_list_markersboolean

Markdown rendering only: whether printed check boxes are written as task markers '[ ]' and '[x]'. Defaults to true.

markdown_page_separatorstring

Markdown rendering only: text written on a line of its own between pages (e.g. "---"). When empty, pages are separated by a blank line.

Responses

StatusTypeDescription
200

OK

202

Accepted

400

Bad Request

404

Not Found

500application/json

Internal Server Error

curl -X POST "$LMKIT_ONE_URL/lmkit/v1/document-parsing" \
  -H "Authorization: Bearer $LMKIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": "",
  "input_format": "Base64EncodedFile",
  "effort": 1,
  "pages": "",
  "output_format": 0
}'