Templates: Versions

List Template Versions

The saved versions of a template, newest first. The last 10 are kept.

POSThttps://g.sendcorex.com/v1/templatecommand: list_template_versions
i

Needs the template:read scope on your API key.

i

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_idstringrequired

    The 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_id

    The template.

  • versions

    Newest first. Empty when nothing was saved yet.

  • versions[].version_at

    When the version was saved. Pass it as is to Restore Template Version.

  • versions[].html_size

    Size of the html of that version, in bytes.

  • versions[].subject

    The 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.

  • 401INVALID_API_KEY

    The API key does not exist, was revoked or was disabled in the dashboard.

  • 429RATE_LIMITED

    More than 15 requests/s or 15 in flight for the same IP + API key. Wait the number of seconds in Retry-After.

  • CMDMISSING_SCOPE

    The API key does not have the scope this command needs.

  • CMDINVALID_ARGS

    An 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…

  • CMDTEMPLATE_NOT_FOUND

    The template is not on your account.

  • CMDINTERNAL

    Server error. The detail is only written to the server log.