Delete a template

DELETE /api/v1/templates/{templateId}
bash
curl -X DELETE -H "x-api-key: $AGENTMAIL_API_KEY" \
  "https://www.agentsmail.io/api/v1/templates/$TEMPLATE_ID"
A template used by a campaign or a sequence cannot be deleted. The answer is a 409 that names what holds it — Template utilisé, suppression impossible — campagnes : « August newsletter ». Retrying will not help: detach the campaign or the sequence first, or keep the template. What was sent stays traceable.

Authorization

Role in the organizationThis endpoint
OWNERAllowed
ADMINAllowed
MEMBERRefused — 403
A key carries the role its creator holds in this organization — never a role on AgentsMail itself. See API keys.

Path parameters

ParameterTypeDescription
templateIdstringRequired. The template to delete

Example

bash
curl -X DELETE -H "x-api-key: $AGENTMAIL_API_KEY" \
  "https://www.agentsmail.io/api/v1/templates/$TEMPLATE_ID"

Response

  • 200 OK — the call succeeded.
  • 401 Unauthorized — missing or invalid key, or its owner left the organization.
  • 403 Forbidden — the key's owner is a member of the organization, not an admin.
  • 404 Not Found — no such resource, or it belongs to another organization. The API never confirms that an id exists to a caller who has no right to it.
  • 429 Too Many Requests — over 120 requests in a minute for this key.

Response fields

FieldTypeDescription
successbooleanIndicates if the operation was successful
data.idstringIdentifier of what was removed

Example response

json
{
  "success": true,
  "data": {
    "id": "4d19c0a2"
  }
}