Create a Template
Purpose
This API is used to create a new template in the given account.
OAuth Scope
Use the scope
MailApps.messages.ALL (or) MailApps.messages.CREATE
ALL - Full access to the messages.
CREATE - Create a template.
To generate Authtoken, refer here.
Request URL
Method: POST
https://mail360.zoho.com/api/accounts/{account_key}/templates
Path Parameters
- account_key* string
- This key is used to identify the account in which the template has to be created. It is generated during account addition.
- This parameter can be fetched using the Get All Accounts API.
Request Body (JSON object)
- content string
- Provide the content of the email.
- Its maximum length is 16000000.
- subject string
- Provide the subject of the email.
- Its maximum length is 1000.
- fromAddress string
- This is the sender's email address(associated with the authenticated account).
- toAddress string
- This is the recipient's email address.
- CcAddress string
- This is the recipient's email address to which a Cc of the mail has to be sent.
- BccAddress string
- This is the recipient's email address to which a Bcc of the mail has to be sent.
- encoding string
- This is the encoding type that should be used in the email content. The value can be
- Big5 | EUC-JP | EUC-KR | GB2312 | ISO-2022-JP | ISO-8859-1 | KOI8-R | Shift_JIS | US-ASCII | UTF-8 | WINDOWS-1251 | WINDOWS-1250 | big5 |euc-jp | utf-8 | euc-kr | gb2312 | iso-2022-jp | iso-8859-1 | koi8-r | shift-jis | us-ascii | windows-1251 | windows-1250 | X-WINDOWS-ISO2022JP
- The default value is UTF-8.
- This is the encoding type that should be used in the email content. The value can be
- attachments Array of JSON objects
- This parameter is an array consisting of JSON objects.
- Each object in this array contain a key-value pair formatted as: "fileId" : "sampleID". The key, fileId, is constant across all objects. The value associated with fileId signifies the ID of the file that has been uploaded as an attachment and is of the string data type. This value can be obtained from Upload attachment API.
* - Mandatory parameter
Sample Request
Copiedcurl "https://mail360.zoho.com/api/accounts/x7k0**M05r/templates" \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Zoho-oauthtoken ***" \
-d '{
"toAddress" : "rebecca.test@zylker.com",
"ccAddress" : "rebecca.travel@zylker.com,paula@zylker.com",
"bccAddress" : "rebecca.trip@zylker.com,david@zylker.com",
"fromAddress" : "<Rebecca>rebecca@zylker.com",
"subject" : "new Mail testing"
}'
Sample Success Response
Copied{
"status": {
"code": 200,
"description": "success"
},
"data": {
"templateId": "1674632567383110001"
}
}
Sample Failure Response
Copied{
"status": {
"code": 500,
"description": "Internal Error"
},
"data": {
"moreInfo": "Internal Error"
}
}