Update a email template
/api/v1/email-templates/{email_template}Parameters
| Name | In | Type | Description |
|---|---|---|---|
email_templaterequired | path | string | The email template identifier. |
Request
/api/v1/email-templates/{email_template}curl -X PUT 'https://app.mailyte.com/api/v1/email-templates/ada@example.com' \
-H 'Authorization: Bearer mk_live_YOUR_API_KEY'const response = await fetch('https://app.mailyte.com/api/v1/email-templates/ada@example.com', {
method: 'PUT',
headers: {
Authorization: 'Bearer mk_live_YOUR_API_KEY',
},
});
const { data } = await response.json();import requests
response = requests.put(
"https://app.mailyte.com/api/v1/email-templates/ada@example.com",
headers={"Authorization": "Bearer mk_live_YOUR_API_KEY"},
)
data = response.json()["data"]<?php
$response = Http::withToken('mk_live_YOUR_API_KEY')
->put('https://app.mailyte.com/api/v1/email-templates/ada@example.com');
$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::Put.new(uri)
request["Authorization"] = "Bearer mk_live_YOUR_API_KEY"
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. Required on create and never null. A template with an empty body is `""`, not null -- test for the empty string.
textstringThe plain-text body. READ SIDE ONLY: the write side still accepts `plain_text` and nothing else. `POST`/`PUT`/`PATCH /email-templates` and `POST /email-templates/preview` validate `plain_text` and silently discard a `text` key, so posting `text` stores nothing and reads back as `"text": null`. Send `plain_text`, read `text`, until that is fixed.
variablesarray<string>The `{{ }}` placeholder names found in the subject and bodies. A flat list of names -- no types, no required flags, no defaults, which is why it is not called a schema. Never null: `[]` means this template has no placeholders, not that we have not looked.
created_atstringNULL MEANS UNKNOWN -- the stored row has no creation timestamp -- and never that the template is unsaved: you are reading it back, so it exists. The column is nullable only because Laravel's timestamps are, and every template created through the API has one.
updated_atstringNULL MEANS UNKNOWN, on the same terms as `created_at`, and never "never edited" -- an untouched template carries its creation time here, not null. Note that saving a template also re-derives `variables` from its content, so this moves on a create as well as an edit and is not a reliable "has a human changed this" signal.
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.