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 organization | This endpoint |
|---|---|
OWNER | Allowed |
ADMIN | Allowed |
MEMBER | Refused — 403 |
Path parameters
| Parameter | Type | Description |
|---|---|---|
templateId | string | Required. The template to change |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | no | New name |
defaultSubject | string | no | New default subject |
content | string | no | New HTML — Mailchimp tags are converted on save |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | no | 1 to 100 characters |
defaultSubject | string | no | 1 to 200 characters |
content | string | no | The 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;detailscarries the field-level issues.401 Unauthorized— missing or invalid key, or its owner left the organization.403 Forbidden— the key's owner is amemberof the organization, not anadmin.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
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates if the operation was successful |
data.id | string | Identifier of the template |
data.name | string | Its name |
data.defaultSubject | string | Subject a campaign inherits — and may override |
data.content | string | The complete HTML document |
data.createdAt / updatedAt | string | ISO dates |
data.unsupportedTags | array | Mailchimp 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": []
}
}