Update a template

PATCH /api/v1/templates/{templateId} Updates a template. Only the fields you send are touched; the others are left alone. A content you send goes through the same merge tag conversion, and the response carries unsupportedTags again — empty when you did not touch the content.

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 change

Request body

FieldTypeRequiredDescription
namestringnoNew name
defaultSubjectstringnoNew default subject
contentstringnoNew HTML — Mailchimp tags are converted on save

Request body

FieldTypeRequiredDescription
namestringno1 to 100 characters
defaultSubjectstringno1 to 200 characters
contentstringnoThe HTML of the email

Example

bash
curl -X PATCH -H "x-api-key: $AGENTMAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"defaultSubject": "August news"}' \
  "https://www.agentsmail.io/api/v1/templates/$TEMPLATE_ID"

Response

  • 200 OK — the call succeeded.
  • 400 Bad Request — validation failed; details carries the field-level issues.
  • 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 the template
data.namestringIts name
data.defaultSubjectstringSubject a campaign inherits — and may override
data.contentstringThe complete HTML document
data.createdAt / updatedAtstringISO dates
data.unsupportedTagsarrayMailchimp tags left untouched in your HTML — read it

Example response

json
{
  "success": true,
  "data": {
    "id": "4d19c0a2",
    "name": "Newsletter",
    "defaultSubject": "August news",
    "content": "<html>…</html>",
    "createdAt` / `updatedAt": "value",
    "unsupportedTags": []
  }
}