Templates

Your templates, from the editor or from your code

Read the templates your team builds in the dashboard editors, or bring your own html and manage it like code: variables, checks on save and versions you can roll back.

  • JSON commands
  • Bring your own html
  • Variables
  • 10 versions
  • Checked on save
POSThttps://g.sendcorex.com/v1/templatetemplate:*

How it works

Three kinds, one API

Drag-and-drop (Unlayer), the Sendcorex editor (Custom) and your own html all list, read and render the same way.

Not locked to an editor

Made your email with MJML, React Email or a designer? Send the html. It is checked on save with the same rules as sending, so a template that saves is a template that sends.

Versions included

Every change of an html template saves a version. A bad deploy is one Restore Template Version away from fixed.

Get started

Only the key is needed before your first request.

  1. 1

    Create an API key with template scopes

    In the dashboard, open Developers → API Keys and give the key template:read, plus template:create, template:update and template:delete if it manages your own html.

    The webmail token does not work here. This API uses the dashboard API key.

  2. 2

    Save your html

    Create Template with a name and the html. Use {{variables}} for what changes per email.

  3. 3

    Render and send

    Render Template fills the variables and tells you which ones are missing. Pass the result to Send Email.

The template

Get Template, Create Template and Update Template return this shape. List Templates returns it without subject, html and text.

{
  "template_id": "html_5f2c8a10-3d4e-4b6f-9a71-2c8e0d4b7a93",
  "type": "html",
  "name": "Welcome email",
  "reference": "K7Q2M9XR4T",
  "preview": null,
  "has_html": true,
  "html_size": 248,
  "editable": true,
  "created_at": "2026-10-21T04:02:11.310Z",
  "updated_at": "2026-10-21T04:15:40.902Z",
  "subject": "Welcome to Acme, {{first_name}}",
  "html": "<!doctype html><html><body style=\"font-family:Arial,sans-serif\"><h1>Welcome, {{first_name}}!</h1><p>Your {{plan}} plan is ready.</p><p><a href=\"https://acme.com/start\">Get started</a></p></body></html>",
  "text": "Welcome, {{first_name}}! Your {{plan}} plan is ready. Get started: https://acme.com/start"
}
template_id

html_<uuid>, unlayer_<number> or custom_<uuid>. The prefix is the type.

editable

true for your own html. Editor templates are read-only through the API.

{{variables}}

Placeholders in the subject, html and text, filled by Render Template.

preview

A picture of editor templates, for your own template picker. null for html templates.

Your first request

Save a welcome email with two variables. Replace SENDCOREX_API_KEY with your API key.

curl -X POST 'https://g.sendcorex.com/v1/template' \
  -H "Authorization: $SENDCOREX_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "commands": [
    { "command": "create_template", "args": { "name": "Welcome email", "subject": "Welcome, {{first_name}}", "html": "<h1>Hi {{first_name}}</h1><p>Your {{plan}} plan is ready.</p>" } }
  ]
}'

You get the template back with its template_id. Render it with variables to see the final email. The same request in 8 languages is in Create Template.

Common tasks

Templates as code

Keep the html in your repo and push it with Update Template on every deploy. Reviewed like any change.

Keeping templates in your repo

Undo a bad change

List the versions and restore the last good one. The restore is a version too, so it can be undone.

Restore Template Version

Use what your team designs

Marketing builds the email in the editor; your code reads it with Get Template and sends it.

Get Template

Catch missing data

missing_variables lists every {{variable}} you did not fill. Check it before sending.

Variables

Full reference

Everything marked CMD is a command sent through POST /v1/template, up to 10 per request.