Template syntax
A safe Mustache subset, logic-light on purpose. Output is HTML-escaped by default, which rules out code execution and template injection.
The whole language
| Syntax | Meaning |
|---|---|
{{ name }} | Variable, HTML-escaped |
{{{ raw_html }}} | Variable, not escaped; use it only for HTML you generated yourself |
{{#items}} … {{/items}} | Section: repeats for arrays, renders once for truthy values |
{{^items}} … {{/items}} | Inverted section: renders when empty or falsy |
{{ user.name }} | Dotted path into nested objects |
Example
html_body
<h1>Hi {{ name }}</h1>
<p>Your {{ product }} order:</p>
<ul>
{{#items}}<li>{{ title }} — {{ price }}</li>{{/items}}
</ul>
{{^items}}<p>Your cart was empty?!</p>{{/items}}template_model
{
"name": "Ada", "product": "Acme",
"items": [{"title": "Plan Pro", "price": "€49" }]
}Subjects render too
The subject goes through the same renderer: Welcome to {{ product }} becomes Welcome to Acme. Fields set directly on the send request override the rendered values.
Preview before you send
POST /api/v2/server/templates/{permalink}/render
{ "template_model": { … } } # returns subject/html/text, sends nothingMissing variables render as empty strings, so preview with a complete model before shipping. Filters, arithmetic and includes are deliberately left out: put that logic in your application, where it can be tested. Endpoints: templates API.
