Skip to content

documents.get

documents.get(id: string): Promise<DocumentDescriptor>

Retrieve a stored document’s descriptor with a fresh presigned URL. Spec §6.1. GET /v1/documents/:id.

Name Type Required Description
id string required (no description)

Promise<DocumentDescriptor>

Code When
DOCUMENT_NOT_FOUND 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.get(id) — fetch a stored document.
import { PoliPage } from '@poli-page/sdk';
const client = new PoliPage({ apiKey: process.env.POLI_PAGE_API_KEY! });
const document = await client.documents.get('doc_abc123');
console.log(`Document ${document.documentId}: ${document.pageCount} pages, created ${document.createdAt}`);
// `presignedPdfUrl` has a 15-minute TTL. Call downloadPdf() to fetch bytes
// before it expires, or call documents.get(id) again to refresh.
const pdf = await document.downloadPdf();
console.log(`Downloaded ${pdf.byteLength} bytes`);