Skip to content

Quick start

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

Create a sandbox key in your organization (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

Every organization gets a getting-started project, published into its sandbox environment, with a welcome template. A sandbox key renders it as-is:

<?php
require __DIR__ . '/vendor/autoload.php';
use PoliPage\PoliPage;
use PoliPage\RenderInput;
$client = PoliPage::client($_ENV['POLI_PAGE_API_KEY']);
$pdf = $client->render->pdf(new RenderInput(
project: 'getting-started',
template: 'welcome',
data: ['name' => 'SDK Demo'],
));

$pdf is a binary string. Write it to disk, stream it to S3, or send it back through an HTTP response.

getting-started is a normal, editable project. If your organization renamed it, deleted it or removed it from sandbox, the API answers 404 PROJECT_NOT_FOUND or 404 PROJECT_NOT_IN_ENVIRONMENT: use a fresh organization. To render your own templates, publish them to the key’s environment and swap the slugs.

<?php
require __DIR__ . '/vendor/autoload.php';
use PoliPage\PoliPage;
use PoliPage\RenderInput;
$client = PoliPage::client($_ENV['POLI_PAGE_API_KEY']);
$pdf = $client->render->pdf(new RenderInput(
project: 'getting-started',
template: 'welcome',
data: ['name' => 'SDK Demo'],
));
file_put_contents('./welcome.pdf', $pdf);