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

Document Thumbnail

Returns the intrinsic size (width, height in points/pixels) of every page in a document.#

GET/lmkit/v1/document-thumbnail/{fileId}/page-sizes

Fast, non-rendering metadata call. Iterates the document's pages and reports their native dimensions so clients can pre-compute a viewer layout (reserved per-page heights, aspect ratios) before any page image is fetched. Works for PDFs and multi-page images (e.g. TIFF). Units are whatever the underlying format uses natively: PDF pages are in points (1pt = 1/72in), image frames are in pixels. Only the ratio matters for viewer layout.

Parameters

NameInTypeDescription
fileIdrequiredpathstring

The file ID of a previously uploaded file.

Responses

StatusTypeDescription
200

OK

404

Not Found

422

Unprocessable Entity

curl -X GET "$LMKIT_ONE_URL/lmkit/v1/document-thumbnail/$FILEID/page-sizes" \
  -H "Authorization: Bearer $LMKIT_API_KEY"

Lists file extensions the thumbnail endpoint can render.#

GET/lmkit/v1/document-thumbnail/supported-formats

Returns the union of PDF and image extensions supported by this endpoint. Clients should call this once at startup (cache the result) and use it to decide whether to route a document into a paginated viewer or fall back to a generic display. Using this endpoint avoids hard-coded extension lists drifting from server capabilities.

Responses

StatusTypeDescription
200

OK

curl -X GET "$LMKIT_ONE_URL/lmkit/v1/document-thumbnail/supported-formats" \
  -H "Authorization: Bearer $LMKIT_API_KEY"

Renders a page of a document (PDF or image) as an image.#

GET/lmkit/v1/document-thumbnail/{fileId}

Returns an image for a previously uploaded file. Supports PDF documents (any page) and image files including TIFF, BMP, PNG, JPEG, GIF, and WebP. For multi-page TIFF files, the 'page' parameter selects which frame to render. Output format is controlled by the 'format' parameter (jpeg, png, or webp; default jpeg). The response includes an 'X-Page-Count' header with the total number of pages in the document. Returns 422 Unprocessable Content if the file cannot be processed (e.g. encrypted PDF). The response includes the ProblemDetails error codes: 'password_required', 'invalid_format', 'unsupported_security', 'page_error'.

Parameters

NameInTypeDescription
fileIdrequiredpathstring

The file ID of a previously uploaded file.

pagequeryobject (int32)

Zero-based page index (for PDFs and multi-page TIFFs). Default: 0.

sizequeryobject (int32)

Target size in pixels for the image's LONGEST side (width or height, whichever is larger); the shorter side preserves the page's aspect ratio. A landscape page yields size x (sizeh/w); a portrait page yields (sizew/h) x size. Default: 400.

formatquerystring

Output format: 'jpeg' (default), 'png', or 'webp'.

qualityqueryobject (int32)

Compression quality (1-100). Applies to 'jpeg' and 'webp'. Default: 90.

Responses

StatusTypeDescription
200

OK

400

Bad Request

404

Not Found

422

Unprocessable Entity

curl -X GET "$LMKIT_ONE_URL/lmkit/v1/document-thumbnail/$FILEID" \
  -H "Authorization: Bearer $LMKIT_API_KEY"