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 API key to authenticate your API requests. This is a unique token that you can generate within your Agent in your ZeptoMail account. Use the Send API key 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 API key>

Steps to generate Send API key:

Select the Agent that you want to connect to your application.

  1. Navigate to the SMTP/API tab. This will open the Setup Details page.
  2. From here you can copy your Agent specific Send API key under the API tab.
  3. You can either use the default Send API key or generate a new one. 

    Agents >> SMTP/API >> Send API key >> Click to copy icon.

Request Values

* - Mandatory parameters

ParameterData TypeDescription
 nameStringName of the file you are uploading to File Cache
HeaderData TypeDescription
Authorization Send API key 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 API key. 
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"
}