Templates: Editing
Create Template
Saves your own html as a template: from MJML, React Email, your designer or any tool. It shows up in the dashboard next to the editor templates.
https://g.sendcorex.com/v1/templatecommand: create_templateNeeds the template:create scope on your API key.
Up to 30 calls per minute per account. Over that, the command answers RATE_LIMITED.
The html is checked when you save, with the same rules as sending: you find out now, not when an email is refused.
The first version is saved with it. See List Template Versions.
Arguments
namestringrequiredUp to 255 characters, no HTML.
e.g.
"Welcome email"htmlstringrequiredThe full html, up to 512 KB. Use
{{variables}}for what changes per email.e.g.
"<!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>"textstringoptionalThe plain-text version.
e.g.
"Welcome, {{first_name}}! Your {{plan}} plan is ready. Get started: https://acme.com/start"subjectstringoptionalA default subject. Can have variables.
e.g.
"Welcome to Acme, {{first_name}}"
Quick start
import axios from 'axios';
const response = await axios.post(
'https://g.sendcorex.com/v1/template',
{
commands: [
{
command: "create_template",
args: {
name: "Welcome email",
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"
}
}
]
},
{ headers: { Authorization: process.env.SENDCOREX_API_KEY } },
);
const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);Response
{
"type": "SUCCESS",
"results": [
{
"command": "create_template",
"id": "0",
"type": "SUCCESS",
"took_ms": 9,
"data": {
"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"
}
}
]
}Response fields
template_idThe id of the template:
html_<uuid>,unlayer_<number>orcustom_<uuid>. Use it in every other command.typehtml(yours, sent through the API),unlayer(built in the drag-and-drop editor) orcustom(built in the Sendcorex editor).nameThe name you gave it.
referenceA short code that also identifies the template in the dashboard.
previewA picture of the template, for editor templates.
nullfor html templates and for editor templates not saved yet.has_htmlfalsefor an editor template that was created but never saved. It cannot be rendered or sent yet.html_sizeSize of the html, in bytes.
editabletruefor html templates: you can update, restore and delete them here. Editor templates are read-only through the API.created_at / updated_atISO 8601, UTC.
subjectThe default subject, or
null. Can have variables.htmlThe html.
nullfor an editor template that was never saved.textThe plain-text version, or
null. Send one: some clients and filters prefer emails that have it.
Variables
SyntaxWrite
{{name}}anywhere in the subject, html or text. Spaces inside the braces are fine:{{ name }}. Names use letters, digits,_,.and-.In the htmlValues are HTML-escaped: a value with
<or&can never break your layout or inject markup.In the subject and textValues go in as they are.
Missing valuesA variable you did not send stays as
{{name}}and is listed inmissing_variables. Check it before sending.
What the html can have
AllowedAnything email clients render: tables, inline styles,
<style>blocks, images by URL, links.Refused<script>,<iframe>,<form>,<input>,<button>,<embed>,<object>, inline<svg>,<base>,on*=handlers andjavascript:URLs. Use a styled<a>instead of a button.ImagesHost them and link them. Embedded base64 images make the html heavy and are often clipped by Gmail after ~100 KB.
Errors
HTTP-level errors return type, code and message. Errors marked CMD come back inside the command result, with HTTP 200.
- 401
INVALID_API_KEYThe API key does not exist, was revoked or was disabled in the dashboard.
- 429
RATE_LIMITEDMore than 15 requests/s or 15 in flight for the same IP + API key. Wait the number of seconds in Retry-After.
- CMD
MISSING_SCOPEThe API key does not have the scope this command needs.
- CMD
INVALID_ARGSAn argument is invalid: a malformed `template_id`, a missing `name` or `html`, a name over 255 characters, a `version_at` that is not RFC 3339…
- CMD
UNSAFE_HTMLThe html has something email cannot carry: `<script>`, `<iframe>`, forms, `on*=` handlers, `javascript:` links… The message says exactly what to remove.
- CMD
TEMPLATE_TOO_LARGEThe html is over 512 KB. Host your images and link them instead of embedding them.
- CMD
RATE_LIMITEDThis command was called too many times in the last minute by your account. Wait a minute.
- CMD
INTERNALServer error. The detail is only written to the server log.