Skip to main content
Generate a PDF document from raw HTML or a saved template with dynamic data.

Endpoint

Authentication

Include your API key in the request headers:

Request Body

You must provide either htmlContent OR templateId, but not both.

Using Raw HTML

Using a Template

Parameters

Required (one of)

string
Raw HTML content to convert to PDF. Supports Handlebars syntax for dynamic content.
string
ID of a saved template to use. Find this in the template editor or templates list.

Optional

object
JSON object with data to inject into Handlebars placeholders.
string
Custom filename for the generated PDF (without .pdf extension). Max 255 characters.
object
PDF generation options. When using a template, these override template settings.

Options Object

string
default:"A4"
Paper size. One of: A0, A1, A2, A3, A4, A5, A6, Letter, Legal, Tabloid, Ledger, Custom
string
default:"portrait"
Page orientation. One of: portrait, landscape
number
Custom page width in millimeters. Only used when format is Custom.
number
Custom page height in millimeters. Only used when format is Custom.
object
Page margins in millimeters.
boolean
default:"true"
Include background colors and images in the PDF.
object
Page header configuration.
Page footer configuration.
string
Dynamic filename template using Handlebars syntax. Example: Invoice-{{invoiceNumber}}

Response

Success Response (200)

Response Fields

External Storage Response

When using external storage (S3 or Supabase), additional fields are included:

Error Codes

Error Response Format

Examples

Minimal Request

With Dynamic Data

Full Options

Using a Template