Update a email template

PUT/api/v1/email-templates/{email_template}
Requires anorganization API keywith the scopetemplates:write

Parameters

NameInTypeDescription
email_templaterequiredpathstringThe email template identifier.

Request

PUT/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'
The key names its own organization, so no X-Organization-ID header is needed.

Response

Success.

  • dataobject
    • objectstringemail_template
    • idstring
    • namestring

      Unique within your organization.

    • subjectstring

      May 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.

    • htmlstring

      The HTML body. Required on create and never null. A template with an empty body is `""`, not null -- test for the empty string.

    • textstring

      The 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_atstring

      NULL 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_atstring

      NULL 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

StatusWhen
401The API key is missing, unknown, revoked or expired. All four answer identically, on purpose: distinguishing them would confirm which keys exist.
403The 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.
404No such resource in this organization.
422The request was understood but the values were not acceptable.
429Too 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.