File Cache Upload API

Purpose

The API is used to upload files to File Cache

Request URL

https://api.zeptomail.com/v1.1/files?name=logo.jpg

Authorization token

You need to add send mail token to authenticate your API requests. This is a unique token that you can generate within your Mail Agent in your ZeptoMail account. Use the send mail token as a header when you call ZeptoMail REST Email Sending API.

Example

POST /v1.1/email

Query String:

POST
HOST: https://api.zeptomail.com
Header:
Authorization: zoho-enczapikey <space> <send mail token>

Steps to generate Send mail token:

  1. Navigate to the Mail Agents tab on the left panel of your ZeptoMail account and select a Mail Agent that you want to connect to your application.
  2. On the top right section, click on SMTP & API Info (gear icon). This will open the Setup Details page.
  3. From here you can copy your Mail Agent specific send mail token under the API tab.
  4. You can use the default Send Mail Token or generate a new one.

Mail Agents >> SMTP & API Info >> Send Mail Token >> Click to copy icon

Request Values

* - Mandatory parameters

ParameterData TypeDescription
 nameString

Name of the file you are uploading to File Cache

HeaderData TypeDescription
Authorization Send Mail token used to send email
BodyData TypeDescription
content_type 

Content type can be text or plain.

data binary Pathway of the file available in your device.

Success Response Parameters 

ParameterData TypeDescription
dataJSON arrayIt consists of code, additional_info and message parameters
codeStringThe code corresponding to a success response
additional_infoJSON arrayProvides additional information about the action performed in the request
messageStringThe status of the request made
file_cache_keyStringA unique key which is generated for the uploaded file. This key is used to send emails with this file as an attachment. 

Error Codes

Error codesReason
TM 3301Chosen file has empty content. Fix the content to proceed.
TM 4001Invalid Send Mail token. 
TM 8001File size exceeded.
TM 3501File added violates the Secure Attachment Policy. Learn more

Note:

Before you get started it is important to know that ZeptoMail is for sending transactional emails like welcome emailers, password resets emails, OTPs. We do not support sending of bulk emails or promotional emails like newsletters or marketing campaign emails. If you are looking for a bulk email provider, you can visit Zoho Campaigns.

Sample Request

Copiedcurl --location -g --request POST 'https://api.zeptomail.com/v1.1/files?name=logo.jpg' \
--header 'Authorization: {{apitoken}}' \
--header 'Content-Type: text/plain' \
--data-binary '@/Users/rebecca-5499/Documents/Attachment/logo.jpg'

Sample Response

Copied{
  "file_cache_key": "ea36f19a.13bcc89ebf85b76.h1.fa11ae90-0a35-11ec-924b-525400256d50.17b9b5697f9",
  "data": [
    {
      "code": "fm_101",
      "additional_info": [],
      "message": "File uploaded successfully"
    }
  ],
  "message": "OK",
  "object": "file"
}