When to use this endpoint

Use the legacy DataTables contract; current CRM2 widgets use mapped objects instead.

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

ParameterTypeRequiredDescription
start / length / drawInteger-compatibleYesPresence required before login. Offset/page size integer-convert without a positive clamp or upper bound; draw is echoed as an integer.
order[0][column] / order[0][dir]Column index / directionYesRequired before login. Columns 0 id, 1 name, 2 subject, 3 from_email, 4 type; others name. Exact desc descends; all other values ascend.
name / from_email / search[value]TextNoTruthy values add case-insensitive substring filters. search[value] searches name/from_email/subject; %/_ remain LIKE wildcards.
typeInteger-compatibleNoOnly truthy integer values add equality; zero means no type condition, unlike EmailTemplates_list.

Example request

$result = FM_api('EmailTemplates_getDT', ['start'=>'0','length'=>'10','draw'=>'1','order'=>[['column'=>'1','dir'=>'asc']]]);

Example response

{
  "draw": 1,
  "recordsTotal": "1",
  "recordsFiltered": "1",
  "data": [
    [
      "18",
      "Job report",
      "Report",
      "office@example.test",
      "1",
      "0",
      "1"
    ]
  ]
}

Application errors normally remain JSON responses with HTTP 200; inspect error/warning keys. Numeric driver values can be strings.

Errors and unusual responses

ResponseCondition
{"error":"not logged in"}No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs.
{"error":"missing or invalid parameter: start"}start missing/null.
{"error":"missing or invalid parameter: length"}length missing/null.
{"error":"missing or invalid parameter: [order][0][column]"}Sort column absent.
{"error":"missing or invalid parameter: draw"}draw missing/null.

Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.

Behaviour and edge cases

  • Each positional row is [id,name,subject,from_email,type,archived,is_default]. Archived templates are included. Counts are tenant-wide/all filtered templates; no stable ID tie-breaker or all-record sentinel.
  • A requested length of zero yields an empty SQL page; negative bounds are not normalized by this wrapper. Required-parameter errors precede its login check.

Side effects

  • Reads metadata only, excluding template body and full meta.

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