Skip to content

documents.thumbnails

documents.thumbnails(id: string, options: ThumbnailOptions): Promise<Thumbnail[]>

Generate page thumbnails for a stored document. Spec §6.3. POST /v1/documents/:id/thumbnails.

Name Type Required Description
id string required (no description)
options ThumbnailOptions required (no description)

Promise<Thumbnail[]>

Code When
DOCUMENT_NOT_FOUND See [errors](../../../production/errors/) for the full description.
VALIDATION_ERROR See [errors](../../../production/errors/) for the full description.
INVALID_API_KEY See [errors](../../../production/errors/) for the full description.
INTERNAL_ERROR See [errors](../../../production/errors/) for the full description.
// Demonstrates: client.documents.thumbnails(id, options) — page thumbnails for a stored document.
import { PoliPage } from '@poli-page/sdk';
const client = new PoliPage({ apiKey: process.env.POLI_PAGE_API_KEY! });
const thumbnails = await client.documents.thumbnails('doc_abc123', {
width: 840,
format: 'png',
pages: [1, 2],
});
// Each entry includes the image bytes base64-encoded.
for (const t of thumbnails) {
console.log(`Page ${t.page}: ${t.width}×${t.height} ${t.contentType} (${t.data.length} base64 chars)`);
}