render.pdf
render.pdf(input: RenderInput) -> bytes Render a PDF and return its raw bytes (two HTTP calls: render + download).
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
input | RenderInput | required | Render input (`project`, `template`, `data`, plus optional `format`, `orientation`, `locale`, `metadata`, `idempotency_key`, `timeout`). The API renders the project's copy published in the key's environment. |
Returns
Section titled “Returns”bytes — the rendered PDF as raw bytes.
Errors
Section titled “Errors”| Code | When |
|---|---|
PROJECT_REQUIRED_FOR_DOCUMENT | Input without a `project`. Rejected locally before the HTTP call. |
VALIDATION_ERROR | The request body failed validation. |
INVALID_API_KEY | The API key is malformed or revoked. |
PROJECT_NOT_FOUND | No project with this slug in the organization. |
PROJECT_NOT_IN_ENVIRONMENT | The project is not published in the key's environment. |
TEMPLATE_NOT_FOUND | The template is not in the project's copy published in the key's environment. |
TEMPLATE_ERROR | The engine rejected the template or its data. |
TEMPLATE_UNSAFE | The template, a partial or an SVG asset holds an injection attempt; `detail` names it. |
EMPTY_DOCUMENT | The render produced zero pages. |
RENDER_BODY_TOO_LARGE | The request body is over the API's size limit (413). |
DOCUMENT_TOO_LARGE | The document exceeds an engine cap (413). |
QUOTA_EXCEEDED | Monthly quota reached (429). Not retried: it lasts until the monthly reset. |
OVERAGE_CAP_EXCEEDED | Overage cap reached on a paid tier (429). Not retried: it lasts until the monthly reset. |
RATE_LIMIT_EXCEEDED | Per-key render rate limit reached. Retryable. |
PUBLISH_IN_PROGRESS | The project is being published into this environment (503 with `Retry-After`). Retryable. |
RENDER_TIMEOUT | The engine's time budget expired (504). Retryable. |
timeout | Request exceeded the configured `timeout`. Retryable. |
network_error | TCP/TLS-level failure reaching the API. Retryable. |
STORAGE_ACCESS_DENIED | The organization's own storage bucket refuses access (502). Not retried: restore the bucket role, then call again. |
INTERNAL_ERROR | The API returned 5xx. Retryable. |
DOWNLOAD_FAILED | The S3 second-hop download for the rendered PDF failed. |
Example
Section titled “Example”# Demonstrates: client.render.pdf(input) — render a stored project template to PDF bytes.from poli_page import PoliPage
client = PoliPage() # picks up POLI_PAGE_API_KEY from the environment
pdf = client.render.pdf({ "project": "billing", "template": "invoice", "data": {"invoiceNumber": "INV-001", "total": 1280},})
# `pdf` is a `bytes` object containing the PDF.print(f"Rendered {len(pdf)} bytes")