Send Email Using 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

Send a transactional email using a pre-created CPaaS template.

Endpoint

Request URL

https://cpaas.zoho.com/v1.1/email/template Copied!

Request Parameters

- Request Headers

ApiKeyAuthAPI Key

API key of an agent. Send the header as Authorization: Zoho-enczapikey {apiKey}. The agent and account are derived from the key.

- Request Body

application/json
JSON Object
Show Sub-Attributes
ccarrayOptional

Array of CC recipient email addresses.

email_addressJSON ObjectOptional
Show Sub-Attributes
addressstringOptional
namestringOptional
template_keystringOptional

Unique key of the email template. Use either template_key or template_alias.

client_referencestringOptional

A custom reference string to identify the email in your system.

bccarrayOptional

Array of BCC recipient email addresses.

email_addressJSON ObjectOptional
Show Sub-Attributes
addressstringOptional
namestringOptional
attachmentsarrayOptional

Array of file attachments.

file_cache_keystringOptional
mime_typestringOptional
namestringOptional
contentstringOptional

Base64-encoded file content.

reply_toarrayOptional

Reply-to email address.

addressstringOptional
namestringOptional
merge_infoobjectOptional

Key-value pairs to replace template variables.

fromobjectMandatory

The sender's email address and optional display name.

addressstringMandatory
namestringOptional
track_opensbooleanOptional

Enable or disable open tracking.

template_aliasstringOptional

Alias of the email template. Use either template_alias or template_key.

toarrayMandatory

Array of recipient email addresses.

email_addressJSON ObjectOptional
Show Sub-Attributes
addressstringOptional
namestringOptional
track_clicksbooleanOptional

Enable or disable click tracking.

Sample Request

Curl
Java
Python
Deluge
Copied!
curl --request POST \
  --url https://cpaas.zoho.com/v1.1/email/template \
  --header 'Authorization: REPLACE_KEY_VALUE' \
  --header 'content-type: application/json' \
  --data '{"cc":[{"email_address":{"address":"manager@zylker.com","name":"Manager"}}],"template_key":"1234567890","client_reference":"order-12345","bcc":[{"email_address":{"address":"archive@zylker.com","name":"Archive"}}],"attachments":[{"file_cache_key":"fc-xxxx-xxxx","mime_type":"application/pdf","name":"invoice.pdf","content":"string"}],"reply_to":[{"address":"support@zylker.com","name":"Support"}],"merge_info":{"account_id":"98765","user_name":"Rudra"},"from":{"address":"accounts@info.zylker.com","name":"Paula"},"track_opens":true,"template_alias":"account-confirmation","to":[{"email_address":{"address":"rudra.d@zylker.com","name":"Rudra"}}],"track_clicks":true}'

Sample Request Body

Copied!
  {
    "cc": [
      {
        "email_address": {
          "address": "manager@zylker.com",
          "name": "Manager"
        }
      }
    ],
    "template_key": "1234567890",
    "client_reference": "order-12345",
    "bcc": [
      {
        "email_address": {
          "address": "archive@zylker.com",
          "name": "Archive"
        }
      }
    ],
    "attachments": [
      {
        "file_cache_key": "fc-xxxx-xxxx",
        "mime_type": "application/pdf",
        "name": "invoice.pdf",
        "content": "string"
      }
    ],
    "reply_to": [
      {
        "address": "support@zylker.com",
        "name": "Support"
      }
    ],
    "merge_info": {
      "account_id": "98765",
      "user_name": "Rudra"
    },
    "from": {
      "address": "accounts@info.zylker.com",
      "name": "Paula"
    },
    "track_opens": true,
    "template_alias": "account-confirmation",
    "to": [
      {
        "email_address": {
          "address": "rudra.d@zylker.com",
          "name": "Rudra"
        }
      }
    ],
    "track_clicks": true
  }
                
▼ Show full

Response Parameters

- HTTP code 200

Response Body - application/json
JSON Object
Show Sub-Attributes
dataJSON Array
Show Sub-Attributes
codestring
messagestring
messagestring
request_idstring

- HTTP code 400

Response Body - application/json
JSON Object
Show Sub-Attributes
dataJSON Object
Show Sub-Attributes
error_codestring
messagestring
messagestring

Sample Response: HTTP 200

Copied!
  {
    "data": [
      {
        "code": "EM_104",
        "message": "OK"
      }
    ],
    "message": "OK",
    "request_id": "req-xxxx"
  }
                
▼ Show full

Sample Response: HTTP 400

Copied!
  {
    "data": {
      "error_code": "TM_3004",
      "message": "Invalid request"
    },
    "message": "error"
  }
                
▼ Show full