Update a email template
/api/v1/email-templates/{email_template}Parameters
| Name | In | Type | Description |
|---|---|---|---|
email_templaterequired | path | string | The email template identifier. |
Request body
skeleton_htmlstringOptional, advanced. Your own HTML with
data-my-editon the parts people may change in the dashboard. We buildhtmlfrom it andcontent.contentobjectFor a template made from a design (
source_template_key) or fromskeleton_html: the text and images for each editable part, keyed by the part's name. Not used with plainhtml.source_template_keystringOptional. Make the template from one of our ready-made designs, by the design's key. We build
htmlfrom the design, your brand kit andcontent.layoutstringFor a template made from a design: which version of the design, for example
brandedorplain. A name the design does not have falls back to its default.show_company_namebooleanFor a template made from a design: show your company name at the top. Leave it out, or send null, to follow your brand kit.
plain_textstringOptional. The plain-text version sent with the HTML.
variables_schemaarray<string>Optional. The
{{ tag }}names this template uses, such as["name", "order_number"]. Leave it out and we find them in the template.namestringA name for your team, like
Order receipt. It must be different from your other templates' names.subjectstringThe subject line. It can use
{{ tags }}like{{order_number}}.htmlstringThe template's HTML, with
{{ tags }}where your values go. Needed when you create a template, unless it is made from a design (source_template_key) or fromskeleton_html.
Request
/api/v1/email-templates/{email_template}curl -X PATCH 'https://app.mailyte.com/api/v1/email-templates/ada@example.com' \
-H 'Authorization: Bearer mk_live_YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"name": "Order receipt",
"subject": "Your receipt for order {{order_number}}",
"html": "<p>Hi {{name}},</p><p>Thanks for your order {{order_number}}.</p>"
}'const response = await fetch('https://app.mailyte.com/api/v1/email-templates/ada@example.com', {
method: 'PATCH',
headers: {
Authorization: 'Bearer mk_live_YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "Order receipt",
"subject": "Your receipt for order {{order_number}}",
"html": "<p>Hi {{name}},</p><p>Thanks for your order {{order_number}}.</p>"
}),
});
const { data } = await response.json();import requests
response = requests.patch(
"https://app.mailyte.com/api/v1/email-templates/ada@example.com",
headers={"Authorization": "Bearer mk_live_YOUR_API_KEY"},
json={
"name": "Order receipt",
"subject": "Your receipt for order {{order_number}}",
"html": "<p>Hi {{name}},</p><p>Thanks for your order {{order_number}}.</p>"
},
)
data = response.json()["data"]<?php
$response = Http::withToken('mk_live_YOUR_API_KEY')
->patch('https://app.mailyte.com/api/v1/email-templates/ada@example.com', [
'name' => 'Order receipt',
'subject' => 'Your receipt for order {{order_number}}',
'html' => '<p>Hi {{name}},</p><p>Thanks for your order {{order_number}}.</p>',
]);
$data = $response->json('data');require "net/http"
require "json"
uri = URI("https://app.mailyte.com/api/v1/email-templates/ada@example.com")
request = Net::HTTP::Patch.new(uri)
request["Authorization"] = "Bearer mk_live_YOUR_API_KEY"
request["Content-Type"] = "application/json"
request.body = {
"name": "Order receipt",
"subject": "Your receipt for order {{order_number}}",
"html": "<p>Hi {{name}},</p><p>Thanks for your order {{order_number}}.</p>"
}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request) }Response
Success.
dataobjectobjectstringemail_templateidstringnamestringUnique within your organization.
subjectstringMay contain
{{ variable }}placeholders, like the bodies. Required when the template is created and never null afterwards; an update that omits it keeps the stored one rather than clearing it.htmlstringThe HTML body. An empty body is
"".textstringThe plain-text body. When you create or update a template, send it as
plain_text.variablesarray<string>The
{{ }}placeholder names used in the subject and bodies.[]when there are none.created_atstringWhen the template was created.
updated_atstringWhen the template was last saved.
Returned inside the standard envelope.
Errors
| Status | When |
|---|---|
401 | The API key is missing, unknown, revoked or expired. All four answer identically, on purpose: distinguishing them would confirm which keys exist. |
403 | The key is valid but may not do this: it lacks the required scope, its IP allowlist does not include you, or this endpoint does not accept API keys. |
404 | No such resource in this organization. |
422 | The request was understood but the values were not acceptable. |
429 | Too many requests, or the organization has spent its sending allowance. `Retry-After` says how long to wait. |
Every status, with what causes it and what to do, is on the error reference.