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.

require "poli_page"
client = PoliPage::Client.new(api_key: ENV.fetch("POLI_PAGE_API_KEY"))
pdf = client.render.pdf(
project: "getting-started",
template: "welcome",
data: { name: "SDK Demo" }
)

pdf is a binary-encoded String of PDF bytes. Write it to disk, upload it to S3, or return it from a Rails controller.

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.

require "poli_page"
client = PoliPage::Client.new(api_key: ENV.fetch("POLI_PAGE_API_KEY"))
pdf = client.render.pdf(
project: "getting-started",
template: "welcome",
data: { name: "SDK Demo" }
)
File.binwrite("welcome.pdf", pdf)