Tag Syntax

Docamint tags allow you to insert dynamic data, loop through arrays, and conditionally show content inside Word templates.

Basics
Interpolation
Interpolation inserts a value from your JSON or XML payload:
{{customer.name}} {{order.number}} {{invoice.total}}

Nested fields are supported:

{{customer.address.city}} {{order.shipping.method}}
Loops
Loops ({{#each}})
Use loops to repeat content for each item in an array:
{{#each order.items}} • {{this.name}} - Qty: {{this.qty}}, Total: {{this.total | currency}} {{/each}}

Inside loops, {{this}} refers to the current item.

{{#each payments}} Payment on {{this.date}}: {{this.amount | currency}} {{/each}}
Logic
Conditionals ({{#if}})
Show or hide content based on a condition:
{{#if customer.vip}} Thank you for being a VIP customer! {{/if}}

You can also check if a field exists:

{{#if order.discount}} Discount Applied: {{order.discount | currency}} {{/if}}
Advanced
Nested Loops & Conditionals
Docamint supports nested loops and nested conditionals:
{{#each customers}} Customer: {{this.name}} {{#each this.orders}} Order {{this.number}} - Total: {{this.total | currency}} {{/each}} {{/each}}
Escaping
Escaping Tags
If you need to show tag syntax literally (for documentation or training), escape it:
\{{customer.name}}

Docamint will output {{customer.name}} instead of replacing it.