LM-Kit OneDocs2026.8.10lm-kit.com
Document Utilities

PDF Split

Splits a PDF document into multiple parts by page ranges or on blank separator pages.#

POST/lmkit/v1/pdf-split

Splits a single PDF document into multiple parts based on the provided page ranges, or - with split_mode 'BlankPages' - on visually blank pages (the separator sheets of batch scans): the runs of non-blank pages become the parts and the blank pages are omitted; blank_tolerance (default 10) absorbs scanner noise, and a uniformly dark page is never blank. Blank detection is deterministic image analysis - no AI model is involved (for content-based boundaries, use the document-splitting endpoint instead). Each page range produces one output PDF stored on the server. Page ranges are 1-based and support formats such as '1-5', '3', '7-12', '2-'. Each resulting part is stored on the server and a file ID is returned. Use the file IDs to download the results or pass them to other endpoints (document-to-markdown, pdf-search, pdf-layout, pdf-merge) using the 'FileIdentifier' input format. This is a pure document processing operation that does not require an AI model. If processing exceeds the configured timeout, returns 202 Accepted with a job_id. Poll GET /lmkit/v1/jobs/ for status and results. Returns 422 Unprocessable Entity with an ErrorResponse body if the input file cannot be processed. The 'error' field contains one of: 'password_required' (encrypted PDF), 'invalid_format' (not a valid PDF), 'unsupported_security' (unsupported encryption), 'page_error' (content error).

Request body

application/json ·

PropertyTypeDescription
inputrequiredstring

The input PDF document to split. 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 or by another endpoint such as pdf-merge.

input_format

How the input is provided. Accepted values: 'Base64EncodedFile' or 'FileIdentifier'. Defaults to 'Base64EncodedFile'.

page_rangesstring[]

A list of page range strings defining how the PDF should be split (split_mode 'PageRanges'). Each range produces one output part. Ranges are 1-based and support formats such as '1-5', '3', '7-12', '2-'. Required in 'PageRanges' mode; must be omitted in 'BlankPages' mode.

split_mode

How the PDF is split. 'PageRanges' (default) cuts along the provided page_ranges. 'BlankPages' detects visually blank pages (batch-scan separator sheets) and cuts on them: the runs of non-blank pages become the parts, the blank pages are omitted. Blank detection is deterministic image analysis - no AI model is involved.

blank_toleranceobject (int32)

Per-channel noise tolerance (0-255) for blank detection in 'BlankPages' mode: a page counts as blank when every pixel matches the first within this tolerance AND the page is light (a uniformly dark page is content, never a blank). The default 10 absorbs typical scanner noise; use 0 for born-digital PDFs. Ignored in 'PageRanges' mode.

Responses

StatusTypeDescription
200

OK

202

Accepted

400

Bad Request

404

Not Found

422

Unprocessable Entity

500application/json

Internal Server Error

curl -X POST "$LMKIT_ONE_URL/lmkit/v1/pdf-split" \
  -H "Authorization: Bearer $LMKIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": "",
  "input_format": "Base64EncodedFile",
  "page_ranges": [
    "string"
  ],
  "split_mode": "PageRanges",
  "blank_tolerance": 10
}'