Upload an Attachment

Purpose

This API is used to upload an attachment.

OAuth Scope

Use the scope

MailApps.attachments.ALL (or) MailApps.attachments.CREATE

ALL - Full access to attachments.

CREATE - Upload an attachment.

To generate Authtoken, refer here.

Request URL

Method: POST

https://mail360.zoho.com/api/accounts/{account_key}/attachments

Path Parameters

  • account_key* string
    • This key is used to identify the account. It is generated during account addition.
    • This parameter can be fetched from Get all accounts API.

Request Body (JSON Object)

  • fileName* string
    • This is the file name of the attachment that needs to be uploaded.

 

* - Mandatory parameter

Sample Request

Copiedcurl "https://mail360.zoho.com/api/accounts/G0****9r/attachments?fileName=<file_name>" \
-X POST \
-H "Content-Type: application/octet-stream" \
-H "Authorization: Zoho-oauthtoken ***" \
--data-binary "@/<file_path>/<file_name>"

Sample Success Response

Copied{
   "status": {
      "code": 200,
      "description": "success"
   },
   "data": {
      "fileId": "33e5fac5f2976edb758b/test.png"
   }
}

Sample Failure Response

Copied{
   "status": {
      "code": 404,
      "description": "Invalid Input"
   },
   "data": {
      "moreInfo": "Error with file attached"
   }
}