Guides

Templates

A template keeps the wording, the design and both languages in one place the hotel controls. Your code sends only the facts: who, and the values that change.

POST/v1/messagesneeds the send permission
JSON
{
  "to": ["guest@example.com"],
  "template_id": "tpl_booking_confirmed",
  "variables": { "guest_name": "Ana", "check_in": "2026-12-24", "pets": [{ "name": "Luna" }] },
  "locale": "en"
}

With template_id, leave out subject, html and text: the template supplies all three. Every other field (from, cc, tags, scheduled_at, the Idempotency-Key header) works as in Sending email.

Which templates exist#

GET /v1/templates lists the published templates, each with its languages and its variables: name, type, and whether it is required (reference). The hotel creates and edits templates in its console. An edit reaches your messages only when the hotel publishes it, and a published version never changes afterwards, so what you tested is what is sent.

Variables#

Each variable has a type, and a value of the wrong type is refused with 422 invalid_variables before anything is stored. detail says what is wrong and the X-Variable header names the variable. A missing required variable, and a variable the template does not declare, are refused the same way.

TypeSendShown as
stringtextthe text, escaped
numbera JSON numberthe number
booleantrue or falseused in conditions
date2026-12-24 or a full ISO 8601 timea date written out in the message's language
urlan https:// or http:// addressthe address
emailan email addressthe address
htmla fragment of HTMLinserted as HTML, then cleaned by the content check
listan array of values or of objectsrepeated for each item

Every value except html is escaped, so a name like <b>Ana</b> appears exactly as typed and can never change the layout. The whole message then goes through the same content check as any other (Errors).

Languages#

A template can have Spanish, English, or both. locale picks one; without it, or when the template lacks that language, Spanish is used, else the language the template has.

Retries#

The Idempotency-Key check compares the request you sent (template_id, variables, locale), not the filled-in text. A retry with the same key is answered with the first message even if the hotel published a new version in between.

Last reviewed 2026-10-01.