Skip to content

Quick start

This page walks through your first render — from key to PDF — without touching the dashboard.

Export your key into the environment your script runs in:

Terminal window
export POLI_PAGE_API_KEY=pp_test_...
import { PoliPage } from '@poli-page/sdk';
const client = new PoliPage({ apiKey: process.env.POLI_PAGE_API_KEY! });
const pdf = await client.render.pdf({
project: 'billing',
template: 'invoice',
data: { invoiceNumber: 'INV-001', total: 1280 },
});

pdf is a Uint8Array. Write it to disk, stream it to S3, or return it directly from an HTTP handler.

import { writeFile } from 'node:fs/promises';
import { PoliPage } from '@poli-page/sdk';
const client = new PoliPage({ apiKey: process.env.POLI_PAGE_API_KEY! });
const pdf = await client.render.pdf({
project: 'billing',
template: 'invoice',
data: { invoiceNumber: 'INV-001', total: 1280 },
});
await writeFile('./invoice.pdf', pdf);