Skip to main content
Build dynamic emails with variables, conditionals, loops, and formatting helpers that resolve at send time. There are two ways to send with variables, each with its own rendering engine:

Basic concepts

Variables

Insert dynamic values into your template with {{variableName}}. In the template:
In the request body (public v1 API):
Rendered result:
In /v1/send-template-email (the variables field), additionally:
  • {variableName} with a single brace is equivalent to {{variableName}}.
  • You can define a fallback with {variable || "default value"} for when the variable doesn’t exist.
  • Values are HTML-escaped by default; use {!variable} to insert unescaped HTML.
  • Variables with no value (and no fallback) render as an empty string.
In the advanced API (/send-email, the data field), always use double braces {{variable}}. Single braces and || fallbacks are not available, and values are inserted without HTML escaping.

Conditionals

Available only in the advanced API (POST /send-email, the data field). /v1/send-template-email does not support {{#if}} blocks.
Use {{#if variable}}...{{/if}} to show content only when a variable exists and is truthy. Use {{else}} for the opposite case. In the template:
In the request body:
Note: Handlebars evaluates the values false, undefined, null, "", 0, and empty arrays [] as falsy.

Loops

Use {{#each array}}...{{/each}} to iterate over a list. Available in both APIs, with different syntax inside the block. In the advanced API (/send-email, the data field), {{this}} is the current item. Access its properties with {{this.property}} and use helpers:
In the request body:
Special variables inside loops (advanced API): In /v1/send-template-email (the variables field), the current item’s properties are exposed directly: use {{name}}, not {{this.name}} (the this. notation is not supported). Special variables: @index, @first, @last, @odd, and @even. There are no formatting helpers: send the values already formatted.

Built-in helpers

RQE includes additional Handlebars helpers for common formatting in transactional emails.
Helpers are available only in the advanced API (POST /send-email, the data field). In /v1/send-template-email, send the values already formatted.

formatCurrency

Formats a number as currency using en-US formatting. Defaults to USD. Accepts an optional second parameter for the currency.
With "total": 61970 it produces: $61,970.00 To use another currency:

multiply

Multiplies two numeric values. The result is rounded to 2 decimals.

formatDate

Formats an ISO 8601 date into a human-readable Spanish format (es-ES). Accepts an optional second parameter for the format. Default format (short):
With "deliveryDate": "2025-03-15T00:00:00Z" it produces: 15/3/2025 Long format (long):
With "deliveryDate": "2025-03-15T00:00:00Z" it produces: sábado, 15 de marzo de 2025

default

Provides a default value when the variable is falsy (undefined, null, "", 0, or false).
If name is not defined in data, it renders as Hello, Customer!.

json

Serializes an object to JSON with indentation. Useful for debugging or including structured data in the email.
With "data": {"key": "value"} it produces:
The text helpers capitalize, uppercase, and lowercase are also available to transform strings.

Identifying a template

You can reference a template in two ways in the public API (/v1/send-template-email):
  • If the template doesn’t exist, the API returns a 404 error.
  • template_internal_id is resolved within the project associated with the API key used.
In the advanced API (/send-email), the templateId field accepts the template’s UUID or its numeric internal ID, always within the project associated with the API key.

The variables object

In /v1/send-template-email, the variables object is a JSON where each key is a template variable. Values are converted to strings when rendering. Variables the template uses but that don’t exist render as an empty string (or with their || fallback if defined).

Complete example

Request:
Corresponding template (v1 syntax):
This engine does not include formatting helpers: send prices and dates already formatted as strings. For conditionals, helpers, or nested properties, use the advanced API (POST /send-email) with templateId + data.

Accessing nested properties

In the advanced API (/send-email, the data field), use dot notation to access nested objects:
In /v1/send-template-email, dot notation is not supported: flatten the variables before sending them (for example address_city instead of address.city).

Best practices

  • Define default values for optional variables: in the advanced API use the default helper; in v1 use {variable || "value"} fallbacks. This avoids blank spaces in the email.
  • Validate your variables before sending. Variables the template expects but that don’t exist render as empty strings, without error.
  • Store the template_id (UUID) in your configuration, or use template_internal_id if you prefer short numeric IDs per project.
  • Test your templates with sample data before integrating. In the advanced API use dry_run: true to render without sending — see Dry Run.