Templates
Template syntax
Write Mustache templates and render them with JSON data.
Create and edit templates at app.revecto.dev/templates. A template is an HTML document with Mustache tags.
Syntax
| Tag | Renders |
|---|---|
{{name}} | The value, HTML-escaped. |
{{{name}}} | The value, unescaped. |
{{#items}}…{{/items}} | A section: loops over a list, or renders the block as a conditional. |
{{^items}}…{{/items}} | An inverted section: renders the block when the section would not. |
{{> partial}} | Nothing: partials are not supported. |
- A missing variable renders empty.
- A syntax error is refused with 400
template_render_failed.
<h1>Invoice {{invoice_number}}</h1>
<p>Billed to {{customer_name}}</p>
<table>
{{#items}}
<tr><td>{{description}}</td><td>{{amount}}</td></tr>
{{/items}}
</table>
{{^items}}<p>No items.</p>{{/items}}Render a template
Post the template id and data to /v1/render. data must be a JSON object. Replace the template_id below with your template's id from the dashboard.
curl https://api.eu.revecto.dev/v1/render \
-H "Authorization: Bearer $REVECTO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"engine": "forme",
"template_id": "e5b9c8d7-a6f5-4e4d-9c3b-2a1f0e9d8c7b",
"data": {
"invoice_number": "INV-2026-0042",
"customer_name": "Acme GmbH",
"items": [{ "description": "Consulting", "amount": "1,200.00" }]
}
}' \
--fail-with-body \
-o invoice.pdfBehavior
| Rule | Detail |
|---|---|
| Version | The template's current version is rendered. |
| Billing | A render counts as one conversion, like /v1/convert. |
| Engines, limits | The same as /v1/convert. |
| Size | The template filled with data must stay within the plan's request body limit, or the call is refused with 413 request_body_too_large. |
| Unknown template | 404 template_not_found. |