Skip to main content
POST
Create a template

Phase

Phase 1 (Launch)

Request

string
required
Human-readable name for the template. Must be unique within your account. Used as the identifier in CLI commands (pdfbase templates push).
string
required
HTML content with Handlebars placeholders for dynamic data. Supports {{variable}}, {{#each items}}, {{#if condition}}, and all standard Handlebars helpers.
string
CSS stylesheet applied to the template. Kept separate from HTML for cleaner template management.
object
required
JSON Schema defining the expected data shape. PDFBase validates render requests against this schema and returns 422 on mismatch.Supported types: string, number, boolean, date, array, object.
object
Default rendering options applied every time this template is rendered. Can be overridden per-render.
  • format (string) — Page size
  • margin (string | object) — Margins
  • landscape (boolean) — Orientation
  • header (object) — Header HTML
  • footer (object) — Footer HTML
  • compress (string) — Compression level
object
Example data that satisfies the schema. Used by the CLI’s preview command and the dashboard’s template preview.
string
Optional description shown in the dashboard and CLI listings.

Response

integer
Auto-incrementing version number. Starts at 1, increments on every PATCH update. Useful for tracking which version of a template generated a specific PDF.

Example