Communications
Archive an email template
/a/EmailTemplate_archive
Hide an email template from ordinary template lists without deleting its stored content.
When to use this endpoint
Use EmailTemplate_archive from the email-template settings screen when a template should stop appearing in active choices but may need to be restored or deleted later.
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 | Template ID. Values are integer-converted and must be at least 1. |
Example request
$result = FM_api('EmailTemplate_archive', [
'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. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- The endpoint sets
archived=1. It does not delete the template or its stored body. - An unknown ID, or a template that is already archived, still returns success because affected-row count is not checked.
- Archive state does not prevent direct reads or saves by ID; list endpoints decide whether to hide archived rows.
Side effects
- Updates only the template row. This legacy route does not write field history or a deletion record and does not explicitly invalidate the email-template cache.
See it in Fieldmotion
CRM1
Open Settings → Email Templates in CRM1 and filter browser developer tools for the endpoint name. Choose archive on an active row to produce this request.
CRM2
No direct CRM2 caller was found; CRM2’s current template screen permanently deletes selected rows through EmailTemplate_delete.
Related endpoints
EmailTemplate_unarchiverestores the archived flag.EmailTemplate_deletepermanently removes an archived template.