Communications
Permanently delete an email template
/a/EmailTemplate_delete
Permanently remove an email template after it has been archived.
When to use this endpoint
Use EmailTemplate_delete only after a template has been archived and is no longer required. Use EmailTemplate_archive when recovery must remain possible.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session. The handler requires login and performs no additional page or role-permission check.
The read or write is limited to the authenticated tenant. Notice endpoints that say “current user” use the authenticated session user ID within that tenant.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible | Yes | Archived template ID. Values are integer-converted and must be at least 1. |
Example request
$result = FM_api('EmailTemplate_delete', [
'id' => '152004',
]);
Example response
{"ok":1}
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. |
{"error":"missing or invalid parameter: id"} | id is absent, zero, blank, or converts below 1. |
{"error":"email template does not exist"} | No template has the numeric ID. |
{"error":"cannot delete email template because it is not archived"} | The template exists but archived is zero. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Only archive state gates deletion; default status, template type, and references from other settings are not checked.
- The database result is not checked after the precondition query, so a failed delete can still produce the success response.
Side effects
- Hard-deletes the email-template row without generic field history, deletion audit, or explicit cache invalidation.
See it in Fieldmotion
CRM1
Open Settings → Email Templates in CRM1 and filter browser developer tools for the endpoint name. Show archived rows, choose x, and confirm deletion.
CRM2
Open Settings → Email Templates in CRM2 and filter browser developer tools for the endpoint name. Selecting rows and confirming the bulk delete calls this endpoint once for each ID; active rows are rejected by the server.
Related endpoints
EmailTemplate_archivesatisfies the required precondition.EmailTemplate_unarchiverestores a retained row instead.