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 body

  • skeleton_htmlstring

    Optional, advanced. Your own HTML with data-my-edit on the parts people may change in the dashboard. We build html from it and content.

  • contentobject

    For a template made from a design (source_template_key) or from skeleton_html: the text and images for each editable part, keyed by the part's name. Not used with plain html.

  • source_template_keystring

    Optional. Make the template from one of our ready-made designs, by the design's key. We build html from the design, your brand kit and content.

  • layoutstring

    For a template made from a design: which version of the design, for example branded or plain. A name the design does not have falls back to its default.

  • show_company_nameboolean

    For 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_textstring

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

  • namestring

    A name for your team, like Order receipt. It must be different from your other templates' names.

  • subjectstring

    The subject line. It can use {{ tags }} like {{order_number}}.

  • htmlstring

    The 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 from skeleton_html.

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' \
  -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>"
  }'
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. An empty body is "".

    • textstring

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

      When the template was created.

    • updated_atstring

      When the template was last saved.

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.