Email

Templates

Build templates in the portal with the visual builder or raw HTML, then send them by id. The template language is compatible with Brevo and understands Sendy-style tags.

List templates

GET/v3/smtp/templatesPermission templates:read

Returns every template of the brand. Use the numeric id as templateId when sending. Only templates with isActive: true can be sent.

curl 'https://app.snappymails.com/v3/smtp/templates' \
  -H "api-key: $SNAPPYMAILS_API_KEY" \
  -H 'Accept: application/json'

200 OK

Response
{
  "count": 2,
  "templates": [
    {
      "id": 12,
      "name": "Order confirmation",
      "subject": "Order {{ params.ORDER_ID }} confirmed",
      "isActive": true,
      "createdAt": "2026-09-01T10:12:00Z",
      "modifiedAt": "2026-10-02T08:30:41Z"
    },
    {
      "id": 13,
      "name": "Password reset",
      "subject": "Reset your password",
      "isActive": true,
      "createdAt": "2026-09-03T14:00:00Z",
      "modifiedAt": "2026-09-03T14:00:00Z"
    }
  ]
}
FieldTypeDescription
countintegerNumber of templates returned.
templates[].idintegerBrevo-style numeric template id, used as templateId.
templates[].namestringTemplate name shown in the portal.
templates[].subjectstringDefault subject (may contain tags); empty if not set.
templates[].isActivebooleanInactive templates are rejected when sending.
templates[].createdAtdate-timeCreation time (RFC 3339).
templates[].modifiedAtdate-timeLast update time (RFC 3339).

Template language

Subjects, HTML and text bodies are rendered with a Django/Jinja-style engine (pongo2), compatible with Brevo templates. Output from {{ … }} is HTML-escaped automatically, so user data cannot inject markup.

Variables

TagValue
{{ params.KEY }}A value from the params object of the API request (nested: {{ params.customer.city }}).
{{ contact.FIRSTNAME }}A contact attribute of the recipient (FIRSTNAME, LASTNAME, EMAIL or any custom attribute).
{{ mirror }}URL of the web (browser) version of the email.
{{ unsubscribe }}One-click unsubscribe URL for the recipient.
HTML
<p>Hi {{ contact.FIRSTNAME | default:"there" }},</p>
<p>Your order <strong>{{ params.ORDER_ID }}</strong> ships today.</p>
<p><a href="{{ mirror }}">View in browser</a> · <a href="{{ unsubscribe }}">Unsubscribe</a></p>

Loops

Iterate over arrays passed in params. {% empty %} renders when the list is empty and forloop.Counter gives the 1-based index.

HTML
<table>
  {% for item in params.items %}
  <tr>
    <td>{{ forloop.Counter }}. {{ item.name }}</td>
    <td>{{ item.qty }} × {{ item.price | floatformat:2 }}</td>
  </tr>
  {% empty %}
  <tr><td>Your cart is empty.</td></tr>
  {% endfor %}
</table>

Conditions

{% if %}, {% elif %}, {% else %} and {% endif %} support comparisons (==, !=, <, >), and, or, not and truthiness checks.

HTML
{% if params.TOTAL > 100 %}
  <p>You qualify for free shipping!</p>
{% elif params.TOTAL > 50 %}
  <p>Add a little more for free shipping.</p>
{% else %}
  <p>Shipping: {{ params.SHIPPING | floatformat:2 }}</p>
{% endif %}

Filters

FilterEffect
upperUppercase.
lowerLowercase.
floatformat:2Format a number with 2 decimals.
date:"02/01/2006"Format a date. Accepts Go layouts (02/01/2006) and Django formats (d M Y). Input may be an RFC 3339 or YYYY-MM-DD string.
default:"x"Use x when the value is empty or missing.
Examples
{{ contact.FIRSTNAME | upper }}            → JANE
{{ contact.EMAIL | lower }}               → jane@example.com
{{ params.TOTAL | floatformat:2 }}         → 42.50
{{ params.ORDER_DATE | date:"02/01/2006" }}  → 16/10/2026   (Go layout)
{{ params.ORDER_DATE | date:"d M Y" }}       → 16 Oct 2026  (Django format)
{{ contact.COMPANY | default:"your team" }} → your team (when empty)

Sendy-style tags

Templates imported from Sendy keep working. These bracket tags are replaced before rendering:

TagValue
[Name]Recipient first name (FIRSTNAME attribute, falling back to NAME).
[Email]Recipient email address.
[Webversion]Web version URL (same as {{ mirror }}).
[Unsubscribe]Unsubscribe URL (same as {{ unsubscribe }}).
[currentdaynumber]Two-digit day of the month, e.g. 05.
[currentday]Weekday name, e.g. Friday.
[currentmonthnumber]Two-digit month, e.g. 10.
[currentmonth]Month name, e.g. October.
[currentyear]Year, e.g. 2026.
[Field,fallback=x]Any contact attribute, with x used when it is empty, e.g. [Name,fallback=there] or [CITY,fallback=your city].
HTML
<p>Hello [Name,fallback=there],</p>
<p>We have your address on file as [Email].</p>
<p>Your plan: [PLAN,fallback=Free]. Promo code: [SALE]</p>
<p>&copy; [currentyear] Acme · <a href="[Webversion]">Web version</a> · <a href="[Unsubscribe]">Unsubscribe</a></p>
Bracket text that is not a known tag or contact attribute — for example [SALE] — is left untouched, so regular square brackets in your copy are safe.

Tips

  • Template syntax is validated when you save the template and when you send; errors return 400 with the location.
  • Missing variables render as empty strings — use default to provide a fallback.