Skip to content

Email Templates API

All endpoints require authentication and templates tool permissions. Templates are stored in the recruitment_email_templates table.

GET /api/email-templates

Permission: templates:view

Query parameters:

ParamTypeDescription
typestringFilter by template type (e.g. contact)
categorystringFilter by category (e.g. general)

Response: { templates }


GET /api/email-templates/:id

Permission: templates:view

Path parameters:

ParamTypeDescription
idstringTemplate ID

Response: { template }

Error: 404 if template not found.


POST /api/email-templates

Permission: templates:update

Body:

FieldTypeRequiredDescription
namestringYesTemplate name
subjectstringYesEmail subject line
bodystringYesEmail body (supports merge fields)
typestringYesTemplate type (default: contact)
categorystringNoCategory (default: general)

Response: { template } (201)


PUT /api/email-templates/:id

Permission: templates:update

Path parameters:

ParamTypeDescription
idstringTemplate ID

Body (all fields optional):

FieldTypeDescription
namestringTemplate name
subjectstringSubject line
bodystringEmail body
categorystringCategory
is_activebooleanActive status

Response: { template }

Error: 404 if template not found.


DELETE /api/email-templates/:id

Permission: templates:manage

Path parameters:

ParamTypeDescription
idstringTemplate ID

Response: { ok: true }


Preview Template with Contact Merge Fields

Section titled “Preview Template with Contact Merge Fields”
POST /api/email-templates/:id/preview-contact

Resolves merge fields in the template’s subject and body using a contact’s data. Useful for previewing how a template will look before sending.

Permission: templates:view

Path parameters:

ParamTypeDescription
idstringTemplate ID

Body:

FieldTypeRequiredDescription
contact_idstringNoContact ID to use for merge field resolution. If omitted, uses placeholder values.

Response: { subject, body } — the resolved subject and body with merge fields replaced.

Error: 404 if template not found.