documents.thumbnails
documents.thumbnails(id: str, options: ThumbnailOptions | None = None) -> list[Thumbnail] Generate per-page thumbnails (spec §6.3).
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
id | str | required | The `document_id` of the stored document. |
options | ThumbnailOptions | None | — | Optional thumbnail options — `width`, `format` (`jpeg`, `png` or `webp`), `quality`, `pages`. Unset options take the API's defaults. |
Returns
Section titled “Returns”list[Thumbnail] — a list of Thumbnail objects in page order, base64-encoded.
Errors
Section titled “Errors”| Code | When |
|---|---|
DOCUMENT_NOT_FOUND | No stored document matches the supplied id. |
DOCUMENT_GONE | The document was deleted, or is a `sandbox` document older than 30 days. |
FORBIDDEN | The document belongs to another organization or another environment than the key's. |
THUMBNAILS_NOT_AVAILABLE | Thumbnails are not available on the organization's tier (Free). |
VALIDATION_ERROR | Thumbnail options are out of bounds. |
INVALID_API_KEY | The API key is malformed or revoked. |
INTERNAL_ERROR | The API returned 5xx. Retryable. |
Example
Section titled “Example”# Demonstrates: client.documents.thumbnails(id, options) — page thumbnails for a stored document.# Every option is optional: client.documents.thumbnails(id) uses the API defaults (400 px, jpeg).from poli_page import PoliPage
client = PoliPage()
thumbnails = client.documents.thumbnails( "doc_abc123", {"width": 840, "format": "png", "pages": [1, 2]},)
# Each entry includes the image bytes base64-encoded.for t in thumbnails: print( f"Page {t.page}: {t.width}x{t.height} {t.content_type} " f"({len(t.data)} base64 chars)" )