AI Document Splitting
AI-powered detection of logical document boundaries in a multi-page PDF.#
/lmkit/v1/document-splittingUses a vision-language model (VLM) to visually analyze each page of a multi-page PDF and automatically detect logical document boundaries. Unlike basic page-range splitting, this endpoint understands document types, layouts, and visual cues to identify where one document ends and another begins (e.g., an invoice followed by a contract followed by a receipt). Returns the detected segments with page ranges, labels, and a confidence score. Optionally splits the source PDF into separate files for each detected segment. When splitting is enabled, the split files are stored on the server and can be referenced by their file IDs in subsequent API calls using the 'FileIdentifier' input format. 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 |
|---|---|---|
model | string | The identifier of the vision language model to use for boundary detection. If not provided, the server's default vision model is used. |
inputrequired | string | The input PDF document to analyze. When input_format is 'Base64EncodedFile', provide a base64-encoded PDF payload. 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 PDF file. 'FileIdentifier' references a file previously uploaded via lmkit/v1/files/upload. Defaults to 'Base64EncodedFile'. | |
guidance | string | Optional guidance text to improve detection accuracy. For example: "The file contains a mix of invoices and purchase orders." |
split_documents | boolean | When true, the source PDF is physically split into separate files for each detected segment. Each segment in the response will include a 'file_id'. Download a split file: GET /lmkit/v1/files/. Use it as input in other endpoints (document-to-markdown, summarization, search/documents): set input_format to 'FileIdentifier' and pass the file_id as input. Delete a split file: DELETE /lmkit/v1/files/. Split files are automatically deleted after the server's configured file retention period. Defaults to false. |
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-splitting" \
-H "Authorization: Bearer $LMKIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "",
"input": "",
"input_format": "Base64EncodedFile",
"guidance": "",
"split_documents": false
}'