Email template lists
List selectable email templates
/a/EmailTemplates_list
Return template text and defaults for the requested email context.
When to use this endpoint
Load choices before sending or previewing; these are saved template IDs, distinct from sent mail IDs.
Authentication and permissions
Use signed API-key authentication or a logged-in CRM session on the account’s routed host. API keys act as their owner; normal session requests need dispatcher CSRF protection where configured. Tenant data is selected from the authenticated account.
The handler has no additional page-action/Role check. A CRM2 screen hiding a control does not add such a server guard, and CRM2 role names must not be assumed to apply to CRM1. The dispatcher has no dedicated object-scope mapping for this namespace.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
include_archived | Integer-compatible | No | Default zero excludes archived rows; any nonzero integer includes them. |
type / specific | Integer-compatible | No | A present type integer-converting above -1 filters to that type OR general type 0. With specific>0, only the requested type is included. Omitted/negative type adds no type condition; type zero is valid. |
form_id | Integer-compatible | No | Present nonzero value filters meta.form_id. It does not include general templates lacking that form ID. |
Example request
$result = FM_api('EmailTemplates_list', ['type'=>'1','specific'=>'0','include_archived'=>'0']);
Example response
[
{
"id": "18",
"name": "Job report",
"meta": "{}",
"is_default": "1",
"type": "1",
"body": "Hello {{CUSTOMER_NAME}}",
"subject": "Report"
}
]
Application errors normally remain JSON responses with HTTP 200; inspect error/warning keys. Numeric driver values can be strings.
Errors and unusual responses
| Response | Condition |
|---|---|
{"error":"not logged in"} | No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Returns raw id,name,meta,is_default,type,body,subject rows sorted by type descending then name. No pagination/limit or stable ID tie-breaker. Whole meta is encoded text; body is the literal saved template.
- Archived filtering defaults here but is not implicit in the two template table endpoints. No active-parent/owner filter or page-action permission is added.
Side effects
- Reads templates only; does not render or send them.
See it in Fieldmotion
CRM1
Settings > Email Templates uses EmailTemplates_getDT; email composers and Job/Quote/Invoice send flows call EmailTemplates_list.
CRM2
Settings > Email Templates uses the mapped table; email composers and notification configuration use EmailTemplates_list to populate template choices.
Related endpoints
EmailTemplates_getDataTable— Continue the related read/write workflow.EmailTemplates_getDT— Continue the related read/write workflow.Email_preview— Render literal template text.