Create a template
create_templateCreate a new template at version 1 from an HTML document with Liquid expressions, plus a JSON Schema for its data. Use this when nothing in list_templates fits. The name must be free on this account — publishing a change to an existing template is update_template, not this. Free.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Template name: lowercase letters, digits, dot, dash or underscore, 1-63 characters. Unique per account. Versions are separate — do not put `@1` here. | |
| engine | No | Rendering engine. `chromium` (default) is full HTML and CSS and is required for PDF. `satori` is a fast PNG path for simple flexbox card layouts — no page breaks, no floats, no external CSS — and costs us less, so prefer it for OG images and social cards. | |
| schema | No | JSON Schema (2020-12) for the `data` payload this template accepts. Strongly recommended: it is what turns a bad payload into a field-level error with a path, an expected type and a working example instead of a blank page. Use `required` and give each property a `description`. | |
| source | Yes | One self-contained HTML document with inline CSS and Liquid expressions (`{{ customer.name }}`, `{% for line in line_items %}`). No file includes: everything the render needs must be in this string, or at a public https URL. Two extra filters ship by default: `money` and `date_medium`. For a PDF, use `@page { size: Letter; margin: 18mm }` to control pagination. | |
| example | No | A payload that renders correctly. It is echoed back in validation errors, so include one. | |
| message | No | Change note for this version, like a commit message. | |
| options | No | Render options, merged over the template's own defaults. Options are part of the cache key, so two calls that differ only here are two different renders. | |
| description | No | One line on what this template is for. Shown in list_templates. | |
| expected_pages | No | How many PDF pages a typical payload renders. Default 1. This is the estimate the free tier and the spend cap are checked against before the render starts, so a template that runs to several pages must say so or a render that cannot fit the allowance will be started and then go over. It is not a limit: the render is billed on the pages it actually produced. |