create_template
Create reusable document templates with HTML/Handlebars markup and JSON schema for generating PDFs like invoices, contracts, and reports.
Instructions
Create a new reusable document template. Templates use HTML/Handlebars markup with a JSON schema defining the expected data fields. Once created, use the returned template ID with generate_document to produce PDFs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Display name for the template (e.g. 'Monthly Invoice'). | |
| slug | Yes | URL-friendly identifier (e.g. 'monthly-invoice'). Must be unique. | |
| description | No | Short description of what this template generates. | |
| category | No | Template category. Defaults to CUSTOM. | |
| markup | Yes | HTML/Handlebars markup for the template body. | |
| styles | No | CSS styles to apply to the template. | |
| schema | Yes | JSON schema defining the data fields the template expects. | |
| sample_data | No | Example data matching the schema, used for previews. | |
| paper_size | No | Paper size. Defaults to A4. | |
| orientation | No | Page orientation. Defaults to portrait. | |
| is_public | No | Whether the template is publicly visible. Defaults to false. |