Template Variables
The Template Variables API handles variable discovery and substitution for email and document templates using Handlebars.
Overviewโ
Template variables allow you to insert dynamic content into your templates. When a template renders, the API fetches entity data and resolves each variable to its actual value.
For a complete list of available variables and helpers, see the Variable Reference.
Quick Startโ
Basic Entity Variablesโ
Access entity attributes using the entity slug as a prefix:
System Variablesโ
Environment Variablesโ
Reference organization-level configuration. See Environments & Secrets.
Variable Pickerโ
The variable picker UI in the template editor lets users search and explore available variables. Use it to discover entity attributes, helpers, and custom variables.

Custom Variablesโ
Create reusable template logic in Configuration > Templates > Variable Builder (direct link).

Custom variables combine free text with Handlebars helpers. Reference them in templates with:
For details, see Custom Variables.
Order Table Variablesโ
Order table variables display line items from an Order with configurable columns, styling, and footers.

Reference order tables with the ~~ prefix:
Computed Metadata Fieldsโ
Some entity fields store identifiers (slugs or UUIDs). The API expands these into human-readable values using the :<field> suffix.
Tagsโ
Access resolved tag names from the _tags slug array:
Purposeโ
Access resolved purpose names from the _purpose UUID array:
Handlebars Helpersโ
epilot provides a rich set of Handlebars helpers for formatting, calculations, and logic. Here are the most commonly used:
Date Formattingโ
Currency Formattingโ
Address Formattingโ
Boolean Formattingโ
Tag-Based Filteringโ
For the complete helper reference, see Variable Reference - Handlebars Helpers.
Excel-like Formulasโ
Use the calc helper for Excel-like formulas:
Available Functionsโ
| Category | Functions |
|---|---|
| Math | ABS, CEIL, FLOOR, ROUND, SUM, AVERAGE, MIN, MAX, RAND |
| Logic | IF, AND, OR, NOT |
| Date | NOW, TODAY, DATEADD, DATEDIFF, YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, WEEKDAY, WEEKNUM |
For detailed formula documentation, see Variable Reference - Excel-like Formulas.
Where Variables Are Supportedโ
Template variables are supported across epilot:
| Feature | Description |
|---|---|
| Email templates | Subject lines and body content |
| Document templates | Word documents (.docx) with variable placeholders |
| Webhooks | URL, headers, and payload content |
| Automation actions | Action parameters and payloads |
| Entity mapping | Transformation rules |
| Customer Portal | Dynamic content and links |
| ERP integrations | Configuration and data transformation |
Related Documentationโ
- Variable Reference - Complete list of variables and helpers
- Custom Variables - Create reusable template logic
- Email Templates - Email template configuration
- Document Templates - Document generation
- Environments & Secrets - Organization-level variables