Templates: Versions
List Template Versions
The saved versions of a template, newest first. The last 10 are kept.
https://g.sendcorex.com/v1/templatecommand: list_template_versionsNeeds the template:read scope on your API key.
html templates save a version on every create and update. Editor templates save one each time you click Save in the dashboard (not on autosave).
Arguments
template_idstringrequiredThe template.
e.g.
"html_5f2c8a10-3d4e-4b6f-9a71-2c8e0d4b7a93"
Quick start
import axios from 'axios';
const response = await axios.post(
'https://g.sendcorex.com/v1/template',
{
commands: [
{
command: "list_template_versions",
args: {
template_id: "html_5f2c8a10-3d4e-4b6f-9a71-2c8e0d4b7a93"
}
}
]
},
{ 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": "list_template_versions",
"id": "0",
"type": "SUCCESS",
"took_ms": 4,
"data": {
"template_id": "html_5f2c8a10-3d4e-4b6f-9a71-2c8e0d4b7a93",
"versions": [
{
"version_at": "2026-10-21T04:15:40.902Z",
"html_size": 248,
"subject": "Welcome to Acme, {{first_name}}"
},
{
"version_at": "2026-10-21T04:09:12.004Z",
"html_size": 231,
"subject": "Welcome to Acme"
},
{
"version_at": "2026-10-21T04:02:11.310Z",
"html_size": 198,
"subject": null
}
]
}
}
]
}Response fields
template_idThe template.
versionsNewest first. Empty when nothing was saved yet.
versions[].version_atWhen the version was saved. Pass it as is to Restore Template Version.
versions[].html_sizeSize of the html of that version, in bytes.
versions[].subjectThe subject of that version, or
null.
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
TEMPLATE_NOT_FOUNDThe template is not on your account.
- CMD
INTERNALServer error. The detail is only written to the server log.