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
| Field | Type | Notes |
|---|---|---|
name | string | unique |
category | string | |
subject | string | required |
body | string | required |
variables | object[] | default [] |
variables.name | string | required |
variables.required | boolean | default false |
variables.dateType | string | one of dd/mm/yyyy hh:mm a, dd/mm/yyyy |
attachments | ObjectId[] -> File | default [] |
company | ObjectId -> Company | |
createdBy | ObjectId -> Member | |
updatedBy | ObjectId -> Member | |
_id | ObjectId | |
createdAt | date | set once |
updatedAt | date |