Attaching Files

We currently support attaching the following file types:

  • PDF
  • JPG
  • PNG

We support this via Data URLs and we would recommend using a library to simplify this process (although it's entirely possible to DIY).

from datauri import DataURI

str(DataURI.from_file('test.pdf'))
# => data:application/pdf;base64,JVBERi0xLjMNJeLjz9 (truncated)
const Datauri = require('datauri/sync');

Datauri('test.pdf').content;
// => data:application/pdf;base64,JVBERi0xLjMNJ (truncated)

We do not have an explicit limit set on the attachment size, but we do have a 25MB (26214400 bytes) limit on the request body size.

Example

Assuming your request body is 1MB without the attachment, that leaves 24MB before hitting our limit.

In the worst-case scenario, base64 encoding increases the original file size by 4/3.

So with a 1MB body, you could include up to 18MB (18 * 4/3 == 24MB) of attachments in the request.


Did this page help you?