Skip to main content

Update Template

Partially update a template. Only the fields you include are changed.

Campaigns already created from the template don't change. See Templates and campaigns.

Request​

PATCH /templates/{uuid}

Path Parameters​

ParameterTypeDescription
uuidstringTemplate's UUID

Request Body​

All fields are optional. Only include the fields you want to change. Send null for an optional field to clear it. name can't be null.

ParameterTypeDescription
namestringTemplate name (max 255 characters). When provided it must not be empty.
subjectstring|nullEmail subject line (max 255 characters). Send null to clear.
preheaderstring|nullPreview text shown after the subject in the inbox (max 255 characters). Send null to clear.
from_namestring|nullSender display name (max 255 characters). Send null to clear.
reply_tostring|nullReply-to email address. Send null to clear.
from_identitystring|nullUUID of a sender identity to send from. Send null to clear.
list_uuidstring|nullUUID of a contact list to use as the audience. See Replacing the audience.
segment_uuidstring|nullUUID of a contact segment to use as the audience. See Replacing the audience.
contentstring|nullThe template body, in Markdown (max 65000 characters). Send null to clear the body. See Campaign body for the supported Markdown.
overwritebooleanSet true to replace (or clear) a body that carries formatting Markdown can't preserve. Defaults to false.

from_identity, list_uuid, and segment_uuid must reference resources that belong to your account; an unknown value returns 422 VALIDATION_ERROR.

Replacing the audience​

Sending list_uuid or segment_uuid replaces the template's whole audience: its list, its segment, and any filter conditions. Only what the request sets remains, so sending list_uuid alone also removes the template's segment, and sending either field as null with no other audience field leaves the template with no audience. A segment is validated as on a campaign — see Audience — and one rejected with 422 leaves the existing audience in place.

Replacing the body​

If the template reports content_overwrite_required: true, writing content, including null, requires overwrite: true, which permanently discards the template's styling or layout. Otherwise the write is rejected with 409 CONTENT_OVERWRITE_REQUIRED. Leave out content to update other fields and keep the body as it is.

Example Request​

curl -X PATCH "https://email.easy.tools/api/v1/templates/94c6cd70-6747-4f1d-8cbc-b83150f33bb7" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"subject": "Welcome to the club",
"segment_uuid": "60707a92-80d0-468e-8a13-38b90c0511db"
}'

Response​

Success Response (200)​

Returns the full template. In this example, the segment has replaced the template's contact list.

{
"data": {
"uuid": "94c6cd70-6747-4f1d-8cbc-b83150f33bb7",
"name": "Welcome",
"subject": "Welcome to the club",
"preheader": "Here's how to get started",
"from_name": "Acme",
"reply_to": "support@example.com",
"from_identity": "be42790c-e33e-4d11-9115-c84ca6c94161",
"from_email": "hello@acme.com",
"content": "## Welcome\n\nThanks for joining.",
"content_editable_via_api": true,
"content_overwrite_required": false,
"audience": {
"list_uuid": null,
"segment_uuid": "60707a92-80d0-468e-8a13-38b90c0511db",
"has_filters": true
},
"created_at": "2026-05-12T09:15:00Z",
"updated_at": "2026-06-24T10:12:00Z",
"last_updated_at": "2026-06-24T10:12:00Z"
}
}

Response Fields​

The template has the fields described in Template Object.

Error Responses​

Not Found Error (404)​

Returned when the UUID is malformed, or does not match a template on your account.

{
"error": {
"code": "RESOURCE_NOT_FOUND",
"message": "Template with UUID '94c6cd70-6747-4f1d-8cbc-b83150f33bb7' not found"
}
}

Conflict Error (409 — Overwrite Required)​

A content write would replace a body whose formatting Markdown can't preserve, and overwrite was not true. Resend with overwrite: true to replace it.

{
"error": {
"code": "CONTENT_OVERWRITE_REQUIRED",
"message": "This template's body contains styling Markdown can't preserve; pass overwrite=true to replace it."
}
}

Validation Error (422 Unprocessable Entity)​

Returned when a field is malformed or a referenced from_identity, list_uuid, or segment_uuid does not belong to your account. A segment with no filter conditions returns Contact segment has no filter conditions on segment_uuid. A content body that is too long once formatted returns The content is too long once formatted. on content, even within the 65000-character limit.

{
"error": {
"code": "VALIDATION_ERROR",
"message": "The given data was invalid",
"details": {
"list_uuid": ["Contact list not found"]
}
}
}