Send via API Email API

Use templates in Email API

Create templates with substitution variables and send them by template_id, so you can change message wording without redeploying your application.

Embedding message HTML in source means redeploying to change a comma. Templates separate the content from the code: the application only sends a template_id and the data.

Before you start

Browse the templates

Go to Email API → Templates.

The Templates page: templates used out of the plan limit at the top, a create button, three filters for all, system and mine, and a list showing each template's id, default subject with variables, and view, duplicate and edit buttons

Three filters split templates into two sources:

FilterWhat it is
SystemCloudFly's built-in templates — usable and duplicable, not directly editable
Minetemplates you created — editable and deletable

The maximum number of templates for your plan is shown at the top as used / limit.

Start from a system template

Do not write from scratch: open the System filter, find the closest template, click Duplicate — the copy becomes yours and is fully editable, and the original stays intact for comparison.

template_id is what your code uses

Each template has a template_id shown at the top of its card, for example welcome-email. That is the value you pass in the send call, not the display name.

{
  "from": "no-reply@example.com",
  "to": "customer@example.net",
  "template_id": "welcome-email",
  "variables": { "name": "An", "company_name": "Company A" }
}

The full parameter list lives in Email API → Guide in the console.

Changing a template_id breaks a running application

template_id is the contract between the template and your code. Change it and every call using the old value is rejected immediately, with no grace period.

If you really must change it, create a new template with the new id, update the application, and only then delete the old one.

Substitution variables

Wherever data belongs, put a variable in the template, for example {{name}}. When sending, the application passes the matching value in variables.

Variables work in the subject as well as the body — the template card shows the default subject with its variables so you can see them at a glance.

Three things that trip people up:

  1. Missing a variable when sending — that spot renders empty, or leaks the raw variable name into the message the customer receives. Pass every variable the template uses.
  2. Misspelling a variable name. {{fullName}} and {{fullname}} are two different variables.
  3. Putting HTML inside a variable. Variables carry data, not layout — change the template if you need a different layout.

Click View full to review the whole template before sending for real.

Check your work

  1. Send a message using that template_id to your own mailbox
  2. The call returns an accepted status
  3. The message arrives and every variable has been substituted — no curly braces left anywhere
  4. The subject has been substituted too, not just the body

Points 3 and 4 must be checked by eye: forget a variable and no call reports an error — it sends normally, and only the customer sees the blank.