HTML templates with placeholders
An HTML template is HTML and CSS with {{placeholders}}. Each render fills them with your data, and the browser engine draws a PDF or an image.
Make one
In the editor, choose "New HTML template", or start from an HTML document under "Use a template": invoice, receipt, order confirmation, certificate, report or shipping label. The editor shows a preview with your sample data as you type. With the API:
curl
curl -X POST "https://mintrender.com/v1/templates" \ -H "Authorization: Bearer $MINTRENDER_KEY" \ -H "Content-Type: application/json" \ -d '{"name":"Order receipt","scene":{"kind":"html","html":"<h1>Order {{order}}</h1><table>{{#each items}}<tr><td>{{name}}</td><td>{{money price ../currency}}</td></tr>{{/each}}</table>","css":"h1 { font-family: \"Inter\"; color: #0f9f7a; }","page":{"size":"A5"},"sample":{"order":"#1042","currency":"GBP","items":[{"name":"Linen shirt","price":32}]}}}'JavaScript
const res = await fetch("https://mintrender.com/v1/templates", { method: "POST", headers: { Authorization: `Bearer ${process.env.MINTRENDER_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ name: "Order receipt", scene: { kind: "html", html: "<h1>Order {{order}}</h1><table>{{#each items}}<tr><td>{{name}}</td><td>{{money price ../currency}}</td></tr>{{/each}}</table>", css: "h1 { font-family: \"Inter\"; color: #0f9f7a; }", page: { size: "A5", }, sample: { order: "#1042", currency: "GBP", items: [ { name: "Linen shirt", price: 32, }, ], }, }, }),});const body = await res.json();if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message} (${body.error.request_id})`);console.log(body);Python
import os import requests res = requests.post( "https://mintrender.com/v1/templates", headers={"Authorization": f"Bearer {os.environ['MINTRENDER_KEY']}"}, json={ "name": "Order receipt", "scene": { "kind": "html", "html": "<h1>Order {{order}}</h1><table>{{#each items}}<tr><td>{{name}}</td><td>{{money price ../currency}}</td></tr>{{/each}}</table>", "css": "h1 { font-family: \"Inter\"; color: #0f9f7a; }", "page": { "size": "A5", }, "sample": { "order": "#1042", "currency": "GBP", "items": [ { "name": "Linen shirt", "price": 32, }, ], }, }, }, timeout=120,)body = res.json()if not res.ok: raise RuntimeError(f"{body['error']['code']}: {body['error']['message']} ({body['error']['request_id']})")print(body)Publish it, then render it like any template:
curl
curl -X POST "https://mintrender.com/v1/render" \ -H "Authorization: Bearer $MINTRENDER_KEY" \ -H "Content-Type: application/json" \ -d '{"template":"YOUR_TEMPLATE_ID","format":"pdf","data":{"order":"#1043","currency":"EUR","items":[{"name":"Canvas tote","price":20},{"name":"Linen shirt","price":32}]}}'JavaScript
const res = await fetch("https://mintrender.com/v1/render", { method: "POST", headers: { Authorization: `Bearer ${process.env.MINTRENDER_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ template: "YOUR_TEMPLATE_ID", format: "pdf", data: { order: "#1043", currency: "EUR", items: [ { name: "Canvas tote", price: 20, }, { name: "Linen shirt", price: 32, }, ], }, }),});const body = await res.json();if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message} (${body.error.request_id})`);console.log(body);Python
import os import requests res = requests.post( "https://mintrender.com/v1/render", headers={"Authorization": f"Bearer {os.environ['MINTRENDER_KEY']}"}, json={ "template": "YOUR_TEMPLATE_ID", "format": "pdf", "data": { "order": "#1043", "currency": "EUR", "items": [ { "name": "Canvas tote", "price": 20, }, { "name": "Linen shirt", "price": 32, }, ], }, }, timeout=120,)body = res.json()if not res.ok: raise RuntimeError(f"{body['error']['code']}: {body['error']['message']} ({body['error']['request_id']})")print(body)Placeholders
| Write | You get |
|---|---|
{{name}}, {{customer.name}} | The value, made safe for HTML. A missing value is empty. |
{{{description}}} | The value as HTML, not made safe (for text that is already HTML, like a Shopify description). |
{{#each items}} … {{/each}} | The part once for each row. Inside: the row's fields, {{this}}, {{@number}} (from 1), {{@index}} (from 0), {{@first}}, {{@last}}. |
{{../currency}} | A value from outside the list. A plain {{currency}} inside a list also finds it when the row has no such field. |
{{#if paid}} … {{else}} … {{/if}} | The first part when the value is there (not empty, false, 0 or an empty list), else the second. |
{{#unless paid}} … {{/unless}} | The part when the value is not there. |
A mistake in a placeholder is a 400 that names the line and the column, like {{#each}} is not closed; add {{/each}} (line 12, column 3).
Money, numbers and dates
| Write | You get (locale en-GB) |
|---|---|
{{money total "GBP"}} | £1,234.50 |
{{money_cents amount "usd"}} | US$19.99 from 1999: amounts in cents, as Stripe sends them |
{{number qty 2}} | 3.00 |
{{date created "long"}} | 8 November 2026. Styles: short, medium (default), long, full, iso. A number is read as seconds (Stripe) or milliseconds. |
{{upper code}}, {{lower code}} | Capitals or small letters |
{{default note "None"}} | The value, or the text when there is no value |
The language of money, numbers and dates is the template's locale (default en-GB), or locale in the data, like "ar-SA" for Arabic digits.
Data from Stripe, Shopify and sheets
- A Google Sheets row: map each column to a field. A list of rows from another sheet goes in a list field for
{{#each}}. - Stripe: send the payment or invoice object as it is, and use
money_centsfor its amounts anddatefor its times. - Shopify: send the order as it is.
{{#each line_items}}repeats each line; prices are text like"19.99", whichmoneyreads. - Fields in the data that the template does not use are ignored, so you can send whole objects.
Its fields in the API
GET /v1/templates/{id} lists the template's fields in params: type: "value" for one value, type: "list" with the row fields for a list. The Make and n8n apps build their forms from this list.
What is different
- An HTML template has one size,
main. Set the page size and the image window in the template. - It makes PDF, PNG, JPEG and WebP, not SVG. Signed links do not draw HTML templates; use the API.
- The editor's preview runs no scripts. The test files and the API run them in Chrome.
Seen MintRender used for content that breaks our terms? Report it. Questions about the API: support@mintrender.com, with the request id.