Upload Attachment
Purpose
This API allows you to upload attachments before using the file in an email. There are two methods to upload attachments using:
- MULTIPART_FORM_DATA
- Request Body
Refer here to check the API for sending an email with attachments.
OAuth Scope
Use the scope
ZohoMail.messages.ALL (or) ZohoMail.messages.CREATE
to generate the Authtoken.
ALL - Grants full access to messages.
CREATE - Grants access to upload attachments to messages.
Request URL
Method: POST
https://mail.zoho.com/api/accounts/{accountId}/messages/attachments
Path Parameters
- accountId* long
- This key is used to identify the account from which the email has to be sent. It is generated during account addition.
- This parameter can be fetched from Get All User Accounts API.
Query parameters
Using "Multi_Part_Form_Data"
Use this method when you need to upload multiple attachments.
- uploadType* string
- To upload multiple attachments, this multipart value is mandatory.
- Allowed value: multipart
- Default value: null
- isInline boolean
- Specifies whether you want to attach an inline image or not.
- Allowed values:
- true - Want to attach an inline image.
- false - Do not want to attach an inline image.
- Default value: false.
Using Request Body (JSON object)
Use this method when you need to upload a single attachment.
- fileName* string
- Provide the name of the file which is to be attached to the email.
- isInline boolean
- Specifies whether you want to attach an inline image or not.
- Allowed values:
- true - Want to attach an inline image.
- false - Do not want to attach an inline image.
- Default value: false.
Note: When attachment data is given using the request body:
- Only the name of the file has to be passed in the Request URL, and not the file path.
- The binary file is mandatory and has to be sent in the Request Body.
* - Mandatory parameter
Response Codes
Refer here for the response codes and their meaning.
Multi_Part_Form_Data : Sample Request (when "inline" = false)
Copied
Multi_Part_Form_Data : Sample Request (when "inline" = true)
Copied
Request Body : Sample Request (when "inline" = false)
Copied
Request Body : Sample Request (when "inline" = true)
Copied
Sample Response (when "inline" = false)
Copied
Sample Response (when "inline" = true)
Copied