Add Email Template

Open in ChatGPT Open in ChatGPT to ask questions about this page
Open in Claude Open in Claude to ask questions about this page
Copy as MarkdownCopy this page as markdown to use with AI assistants
View as Markdown Open this page as markdown in a new tab

Create a new email template in your CPaaS account.

Request URL

https://cpaas.zoho.com/v1.1/mailagents/{mailagent-alias}/templates Copied!

Scope

Zeptomail.MailTemplates.CREATECopied!
(or)
Zeptomail.MailTemplates.ALLCopied!

Request Parameters

- Path Parameters

mailagent-aliasstringMandatory

Unique alias of the Mail Agent.

Example
your-mailagent-alias

- Request Body

application/json
JSON Object
Show Sub-Attributes
htmlbodystringMandatory

HTML content of the email template.

Example
<h1> Hi User </h1>, Welcome aboard
template_namestringMandatory

Display name of the email template.

Example
E-invite
subjectstringMandatory

Subject line of the email template.

Example
Invitation to the event
template_aliasstringOptional

Custom alias for the template. Used as an alternative to template_key.

Example
invitemail

Sample Request

Curl
Java
Python
Deluge
Copied!
curl --request POST \
  --url https://cpaas.zoho.com/v1.1/mailagents/{mailagent-alias}/templates \
  --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' \
  --header 'content-type: application/json' \
  --data '{"htmlbody":"<h1> Hi User </h1>, Welcome aboard","template_name":"E-invite","subject":"Invitation to the event","template_alias":"invitemail"}'

Sample Request Body

Copied!
  {
    "htmlbody": "<h1> Hi User </h1>, Welcome aboard",
    "template_name": "E-invite",
    "subject": "Invitation to the event",
    "template_alias": "invitemail"
  }
                
▼ Show full

Response Parameters

- HTTP code 200

Response Body - application/json
JSON Object
Show Sub-Attributes
dataJSON Object
Show Sub-Attributes
template_keystringread-only
Example
1234567890
template_namestringread-only
Example
E-invite
subjectstringread-only
Example
Invitation to the event
template_aliasstringread-only
Example
invitemail
statusstringread-only
Example
success

- HTTP code 400

Response Body - application/json
JSON Object
Show Sub-Attributes
errorJSON Object
Show Sub-Attributes
codestringread-only
Example
TM_404
messagestringread-only
Example
Template not found
statusstringread-only
Example
failure

Sample Response: HTTP 200

Copied!
  {
    "data": {
      "template_key": "1234567890",
      "template_name": "E-invite",
      "subject": "Invitation to the event",
      "template_alias": "invitemail"
    },
    "status": "success"
  }
                
▼ Show full

Sample Response: HTTP 400

Copied!
  {
    "error": {
      "code": "TM_404",
      "message": "Template not found"
    },
    "status": "failure"
  }
                
▼ Show full