Creating a Template
Templates are standard .docx
files (Microsoft Word format) that contain variables and repeatable sections.
You upload them once, and then reuse them to generate documents by passing dynamic data (usually in JSON
format).
You can create templates for various use cases, such as invoices, contracts, reports, and more.
You can find a bunch of template examples in the Templates Gallery.
Supported Format
Only .docx
files are supported (not .doc
, .odt
, or Google Docs).
To build a template:
- Open Microsoft Word (or a compatible editor).
- Insert plain text variables like
{name}
,{date}
,{company}
directly into the document. - Save it as a
.docx
file. - Upload the file to our platform.
We plan to support other formats to create templates in the future, such as html
, pptx
, xlsx
and more.
Variable Syntax
Below, you can find some examples of how to use variables in your templates. You can read more about the syntax for each type of variable in its respective section.
Delimiters
Variables in your template can be enclosed in either braces {.}
, double braces {{.}}
, double square brackets {{.}}
, or triple plus +++.+++
.
However, all the variables in the same template must use the same delimiter style.
Simple Values
These map directly to keys in your JSON input:
My name is {name}. I am {age} years old.
Nested Values
Use dot notation to access nested objects.
I work at {company.name} located in {company.address.city}.
Lists (Loops)
You can loop over arrays in your data to repeat sections of your template. You can use the {FOR ... IN ...}
syntax to iterate over items, and use {END-FOR}
to close the loop.
Make sure to use the $
prefix for the variable inside the loop to access the current item. For example, if you have an array of items, you can list them like this:
{FOR item IN items}
- {$item.name}: {$item.price}
{END-FOR items}
For more details on loops, such as how to create rows in tables or complex lists, see the Loops section.
Conditional Logic
You can include conditional logic to show or hide parts of your template based on data values.
{IF isPaid}
Your invoice is paid.
{END-IF}
Images
You can insert images dynamically by providing a URL or base64 encoded string.
Let’s say you want to include an image from a URL. You would define myImageUrl
like this:
{ "myImageUrl": "https://picsum.photos/200" }
Then, in your template, you can use the following syntax to include the image:
{IMAGE fromUrl(myImageUrl)}
If you have a base64 encoded image, you can define it like this:
{ "myBase64Image": "iVBORw0KGgoAAAANSUhEUgAAAAUA..." }
And use it in your template like this:
{IMAGE fromBase64(myBase64Image)}
You can find more details on how to use images in the Images section.
Tips & Best Practices
- Use consistent naming for variables (e.g.
snake_case
orcamelCase
). - Use the in-app preview to validate the layout and logic.
- Avoid using complex Word components in your templates (like SmartArt ), as it may not render correctly in all cases.
- Use the Template Gallery to find inspiration and examples of common templates.
Need help with a specific layout? Contact Support