> For the complete documentation index, see [llms.txt](https://docs.cw.crisisworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cw.crisisworks.com/security-and-support/technical-reference/merge-template-reference.md).

# Merge Template Reference

## Overview

The [Mail Merge Templates](/system-administration/configuring-the-system/mail-merge-templates.md) system uses basic HTML along with some mail merge tokens and simple CSS to build the templates.

{% hint style="info" %}
For more information on general configuration see the [Mail Merge Templates](/system-administration/configuring-the-system/mail-merge-templates.md) page.
{% endhint %}

### Capabilities

The templating system has the following capabilities

* Fully customisable using HTML templates and CSS styles
* Insert any content from the merged record, including photos
* Insert a background image for your letterhead
* Loop on related content and photos to output lists
* Add conditional logic to control content based on data in the item, as well as the item's presence in counters, lists or custom search CQL.
* A default (and extensible) CSS starter pack to control the most common document layouts and formats

### Example

The following example shows a basic format for a multi-page letter. This forms the basis for the examples on this page.

<div><figure><img src="/files/I0kD3jwTCNIZe3Xlcgxn" alt="" width="563"><figcaption></figcaption></figure> <figure><img src="/files/c5SFUxUF0Pl2jyyP0L35" alt="" width="563"><figcaption></figcaption></figure> <figure><img src="/files/6Cih1eGYFoUloRSzTc4N" alt="" width="563"><figcaption></figcaption></figure></div>

### Register-specific tokens

Each token has its own set of tokens that map to that register's fields. For information specific to registers, such as Fire Prevention Notices, Permits or Cases, refer to the relevant guides.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.cw.crisisworks.com/security-and-support/technical-reference/merge-template-reference.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
