This topic primarily focuses on downloading attachments from the API. For information about sending attachments in API requests, refer to the Attachments topic in our Core API guides.

When a message has attached files, the attachments array will contain the information needed to retrieve those files.

If the attachment is inline (ie: an image in the body of an email), the property metadata.cid will help you retrieve the HTML tag corresponding to the attachmens in the body of the message.

Download Attachment

In the attachment object, the property url can be used to download the attached file.
Just like any other API endpoint, the download request should be authenticated.
The response however will not be a JSON object but the content of the file with the correct headers so that you can save it.


API rate limit

Downloading attachments will count against your API rate limiting.

Even though all the API is designed to work with JSON, some endpoints support file upload:

Send Multipart Request


Set the header appropriately

When you want to send files through the API, your request needs to be sent using the Content-Type HTTP header set to multipart/form-data.

The JSON data you would normally send in the request body needs to be split in multiple form fields (one for each property) named after the property key. If the property is an array, the name should include the suffix [].

For example {"to": [[email protected], [email protected]]} would be split in two fields both named to[].

Restriction on files (type and size) depends on the endpoint. If your request doesn't comply to those limitations, the response will contain an error describing the issue.

You can read more about attachments on the Attachments page in our Core API guides.