Send Batch Emails 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 batch of transactional emails to multiple recipients using a pre-created ZeptoMail template.

Endpoints

Request URL

https://api.zeptomail.com/v1.1/email/template/batch

Request Parameters

- Request Headers

SendMailTokenAPI Key

Send Mail Token. Pass it with the prefix: Zoho-enczapikey

- Request Body

application/json
JSON Object
Show Sub-Attributes
ccJSON ArrayOptional

Array of CC recipient email addresses.

Show Sub-Attributes
email_addressJSON ObjectOptional
Show Sub-Attributes
addressstringOptional
namestringOptional
template_keystringOptional

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

bccJSON ArrayOptional

Array of BCC recipient email addresses.

Show Sub-Attributes
email_addressJSON ObjectOptional
Show Sub-Attributes
addressstringOptional
namestringOptional
attachmentsJSON ArrayOptional

Array of file attachments.

Show Sub-Attributes
file_cache_keystringOptional
mime_typestringOptional
namestringOptional
contentstringOptional

Base64-encoded file content.

reply_toJSON ArrayOptional

Reply-to email address.

Show Sub-Attributes
addressstringOptional
namestringOptional
fromJSON ObjectMandatory

The sender's email address and optional display name.

Show Sub-Attributes
addressstringMandatory
namestringOptional
track_opensbooleanOptional

Enable or disable open tracking.

template_aliasstringOptional

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

toJSON ArrayMandatory

List of recipients. Each recipient can have individual merge info.

Show Sub-Attributes
email_addressJSON ObjectOptional
Show Sub-Attributes
addressstringOptional
namestringOptional
merge_infoJSON ObjectOptional

Merge variables specific to this recipient.

Show Sub-Attributes
track_clicksbooleanOptional

Enable or disable click tracking.

Sample Request

Curl
Java
Python
Deluge
Copied!
curl --request POST \
  --url https://api.zeptomail.com/v1.1/email/template/batch \
  --header 'Authorization: REPLACE_KEY_VALUE' \
  --header 'content-type: application/json' \
  --data '{"cc":[{"email_address":{"address":"manager@zylker.com","name":"Manager"}}],"template_key":"1234567890","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"}],"from":{"address":"accounts@info.zylker.com","name":"Paula"},"track_opens":true,"template_alias":"account-confirmation","to":[{"email_address":{"address":"accounts@info.zylker.com","name":"accounts"},"merge_info":{"property1":"string","property2":"string"}}],"track_clicks":true}'

Sample Request Body

Copied!
  {
    "cc": [
      {
        "email_address": {
          "address": "manager@zylker.com",
          "name": "Manager"
        }
      }
    ],
    "template_key": "1234567890",
    "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"
      }
    ],
    "from": {
      "address": "accounts@info.zylker.com",
      "name": "Paula"
    },
    "track_opens": true,
    "template_alias": "account-confirmation",
    "to": [
      {
        "email_address": {
          "address": "accounts@info.zylker.com",
          "name": "accounts"
        },
        "merge_info": {
          "property1": "string",
          "property2": "string"
        }
      }
    ],
    "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

Possible Response Codes

200HTTP code

Batch emails sent using template successfully.

400HTTP code

Bad Request

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