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

PDF Merge

Merges multiple PDF documents and images into a single PDF.#

POST/lmkit/v1/pdf-merge

Combines two or more PDF documents and/or images into a single merged PDF. Accepts PDF files and image formats (PNG, JPEG, TIFF, BMP, WEBP, GIF). Image sources are automatically converted to PDF pages before merging. Multi-page images (e.g. TIFF) produce one page per frame. Pages from all sources are concatenated in the order provided. The merged PDF is stored on the server and a file ID is returned. Use the file ID to download the result or pass it to other endpoints (document-to-markdown, pdf-search, pdf-layout) 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
sourcesrequired[]

The list of PDF documents to merge, in order. Each source can be a base64-encoded PDF or a file identifier. At least two sources are required. Pages from all sources are concatenated in the order provided.

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-merge" \
  -H "Authorization: Bearer $LMKIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "sources": [
    {
      "input": "",
      "input_format": "Base64EncodedFile"
    }
  ]
}'