Skip to content

Quick start

This page walks through your first render — from key to PDF — without touching the dashboard. It uses the getting-started project that every organization gets in its sandbox environment.

Create a key in your organization’s sandbox environment (it starts with pp_sandbox_) and export it into the environment your script runs in:

Terminal window
export POLI_PAGE_API_KEY=pp_sandbox_x # replace with your full key

See Authentication for the key format and what each environment does.

from poli_page import PoliPage
client = PoliPage() # picks up POLI_PAGE_API_KEY from the environment
pdf = client.render.pdf({
"project": "getting-started",
"template": "welcome",
"data": {"name": "SDK Demo"},
})

pdf is bytes. Write it to disk, upload it to S3, or return it directly from a web handler.

Every organization gets a getting-started project, published into its sandbox environment when the organization is created, with a welcome template, so this runs as-is on a fresh organization. It is a normal, editable project: in an organization that renamed it, deleted it or removed it from sandbox, the API answers 404 PROJECT_NOT_FOUND or 404 PROJECT_NOT_IN_ENVIRONMENT, so use a fresh organization to follow along.

There is no version to pick: a render uses the project’s copy published in the API key’s environment. Publish your project to the environment of the key you render with, then swap the slugs. To preview a template or render inline HTML while you design it, use the playground at play.poli.page.

from pathlib import Path
from poli_page import PoliPage
client = PoliPage() # picks up POLI_PAGE_API_KEY from the environment
pdf = client.render.pdf({
"project": "getting-started",
"template": "welcome",
"data": {"name": "SDK Demo"},
})
Path("./welcome.pdf").write_bytes(pdf)