v1 · API reference

Templates

Reusable email HTML with per-recipient `{{variables}}` filled at send time. The dashboard visual editor is a separate surface and still uses the structured document internally.

Base URL: https://www.unitpost.com/api/v1

Templates

List templates

GET/api/v1/email/templates

GET /email/templates
curl -X GET 'https://www.unitpost.com/api/v1/email/templates' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0'
Response · 200
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "object": "template",
      "id": "id_123",
      "name": "Example",
      "subject": "Welcome to Acme",
      "status": "draft",
      "html": "string",
      "created_at": "2026-01-01T00:00:00.000Z",
      "updated_at": "2026-01-01T00:00:00.000Z"
    }
  ]
}

Retrieve a list of your email templates, cursor-paginated. List rows omit html to keep responses small — fetch a single template with Retrieve a template to get it. Reference a template's id when sending with Send or schedule an email or when creating a campaign. Requires the templates:read capability.

Parameters3 fields
FieldTypeDescription
limitinteger · queryMax rows to return (default 20, max 100).
afterstring · queryReturn rows after this id (forward paging).
beforestring · queryReturn rows before this id (backward paging).
Response · 200 fields8 fields
FieldTypeDescription
objectrequiredstring
idrequiredstring
namerequiredstring
subjectrequiredobject
statusrequiredenumdraft | published
htmlobject
created_atrequiredstring
updated_atrequiredstring
200401422

Create a template

POST/api/v1/email/templates

POST /email/templates
curl -X POST 'https://www.unitpost.com/api/v1/email/templates' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Welcome",
    "subject": "Welcome!",
    "html": "<h1>Hi Mike</h1>"
  }'
Response · 201
{
  "object": "template",
  "id": "id_123",
  "name": "Example",
  "subject": "Welcome to Acme",
  "status": "draft",
  "html": "string",
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-01-01T00:00:00.000Z"
}

Create a reusable email template from html (and optional subject). {{variables}} in the HTML fill per-recipient at send time. The body is stored in code mode so you can open it in the dashboard. Once created, send with it via Send or schedule an email, and iterate with Update a template. Requires the templates:write capability.

Request body4 fields
FieldTypeDescription
namerequiredstring
subjectstring
htmlrequiredstring
categoryenumtransactional | marketing
Response · 201 fields8 fields
FieldTypeDescription
objectrequiredstring
idrequiredstring
namerequiredstring
subjectrequiredobject
statusrequiredenumdraft | published
htmlobject
created_atrequiredstring
updated_atrequiredstring
201401422

Retrieve a template

GET/api/v1/email/templates/{id}

GET /email/templates/{id}
curl -X GET 'https://www.unitpost.com/api/v1/email/templates/tmpl_123' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0'
Response · 200
{
  "object": "template",
  "id": "id_123",
  "name": "Example",
  "subject": "Welcome to Acme",
  "status": "draft",
  "html": "string",
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-01-01T00:00:00.000Z"
}

Retrieve a single template by id, including html (which List templates omits). Use this to read the body, then save changes with Update a template. Requires the templates:read capability.

Parameters1 field
FieldTypeDescription
idrequiredstring · path
Response · 200 fields8 fields
FieldTypeDescription
objectrequiredstring
idrequiredstring
namerequiredstring
subjectrequiredobject
statusrequiredenumdraft | published
htmlobject
created_atrequiredstring
updated_atrequiredstring
200401404

Update a template

PATCH/api/v1/email/templates/{id}

PATCH /email/templates/{id}
curl -X PATCH 'https://www.unitpost.com/api/v1/email/templates/tmpl_123' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "subject": "Welcome aboard!"
  }'
Response · 200
{
  "object": "template",
  "id": "id_123",
  "name": "Example",
  "subject": "Welcome to Acme",
  "status": "draft",
  "html": "string",
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-01-01T00:00:00.000Z"
}

Update a template's metadata and/or html. Changes take effect for future sends only — emails already sent or queued keep the body they were rendered with. Writing html switches the template to code mode. Read the current body first with Retrieve a template. Requires the templates:write capability.

Parameters1 field
FieldTypeDescription
idrequiredstring · path
Request body4 fields
FieldTypeDescription
namestring
subjectobject
statusenumdraft | published
htmlstring
Response · 200 fields8 fields
FieldTypeDescription
objectrequiredstring
idrequiredstring
namerequiredstring
subjectrequiredobject
statusrequiredenumdraft | published
htmlobject
created_atrequiredstring
updated_atrequiredstring
200401404422

Delete a template

DELETE/api/v1/email/templates/{id}

DELETE /email/templates/{id}
curl -X DELETE 'https://www.unitpost.com/api/v1/email/templates/tmpl_123' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0'

Permanently delete a template. Emails already sent with it are unaffected, but future sends that reference its id will fail — update any code or campaigns that still point at it first (see List campaigns). Requires the templates:write capability.

Parameters1 field
FieldTypeDescription
idrequiredstring · path
204401404