Quick start
This page walks through your first render — from key to PDF — without touching the dashboard.
Set your API key
Section titled “Set your API key”Create a sandbox key in your organization (it starts with pp_sandbox_) and export it into the environment your script runs in:
export POLI_PAGE_API_KEY=pp_sandbox_xRender a PDF
Section titled “Render a PDF”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.
Example
Section titled “Example”<?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);