Skip to main content

EmailTemplate

Stored in the emailtemplates collection. createdAt and updatedAt are maintained automatically.

Returned by POST /campaign/manual, GET /template/email, POST /template/email, GET /template/email/:id, PUT /template/email/:id.

Example​

One real EmailTemplate as returned by GET /template/email, taken from the data array. Recorded from a live response, so the defaults, denormalised snapshots and populated fields are the actual ones:

{
"_id": "6a957378859eafb47bf227bd",
"name": "Welcome email",
"category": "marketing",
"subject": "Welcome to {{company_name}}",
"body": "<p>Hi {{name}}, thanks for getting in touch.</p>",
"variables": [],
"attachments": [],
"company": "6a9572df859eafb47bf225d7",
"createdBy": {
"_id": "6a9572df859eafb47bf225d9",
"name": "Docs Test User",
"email": "test@test.test",
"status": "owner"
},
"updatedBy": {
"_id": "6a9572df859eafb47bf225d9",
"name": "Docs Test User",
"email": "test@test.test",
"status": "owner"
},
"createdAt": "2026-08-31T12:28:40.325Z",
"updatedAt": "2026-08-31T12:28:40.325Z",
"__v": 0
}

:::note Trimmed for reading A populated reference is shown by the fields that identify it rather than in full — it arrives as the entire referenced document. Long arrays are cut to the first two entries and marked, long strings are truncated, and any field that could carry a credential is dropped rather than masked. :::

Fields​

FieldTypeNotes
namestringunique
categorystring
subjectstringrequired
bodystringrequired
variablesobject[]default []
variables.namestringrequired
variables.requiredbooleandefault false
variables.dateTypestringone of dd/mm/yyyy hh:mm a, dd/mm/yyyy
attachmentsObjectId[] -> Filedefault []
companyObjectId -> Company
createdByObjectId -> Member
updatedByObjectId -> Member
_idObjectId
createdAtdateset once
updatedAtdate