Update email template

Purpose

This API is used to edit your existing templates.

Request URL

Method : PUT

https://api.zeptomail.com/v1.1/mailagents/{mailagent-alias}/templates/{template-key}

OAuth scope

Any one of the following scopes can be used to access this API

scope=Zeptomail.MailTemplates.All

or

scope=Zeptomail.MailTemplates.UPDATE

ALL - This will give the basic CRUD access too all the email templates APIs.

The steps to generate and use OAuth token can be found here.

Path parameters

ParameterTypeDescription
mailagent-aliasStringUnique alias value given to the Mail Agent. It is available in the Setup info section of your Mail Agent.

Request body

ParameterTypeDescription
template_name*StringName of the template
template_aliasStringUnique alias for the template that can be used instead of template key while sending emails using Template API. It can be obtained from the Edit template section in your ZeptoMail account.
subject*StringSubject to be added in the email template.
htmlbody**StringThe corresponding HTML content of the body in the email template.
textbody**String Plain text body of the email in the template.

*-Mandatory parameter

**-Atleast one of them is mandatory.

Note:

Templates API can be used while send single emails and batch emails. Refer our help articles on single and batch email template APIs to help you get started with it.

Sample request

Copiedcurl "https://api.zeptomail.com/v1.1/mailagents/{mailagent-alias}/templates/{{template-key}}\"
-X PUT
-H "Authorization : Zoho-oauthtoken ***"\
-H "Content-Type : application/json" \
-d '{
    "template_name": "E-invite (new)",
    "subject": "Email invitation",
    "htmlbody": "<h1> Hi {{name}}</h1>, invitation link {{link}}",
   }'

Sample response

Copied{
  "data": [
    {
      "htmlbody": "<h1> Hi {{name}}</h1>, invitation link {{link}}",
      "upload_time": "19 Sep 2022 11:32 AM",
      "template_name": "E-invite(new)",
      "template_key": "ea***607",
      "template_size": 16,
      "modified_time": "19 Sep 2022 11:32 AM",
      "subject": "Email invitation"
    }
  ],
  "message": "OK",
  "object": "templates"
}