Download an email attachment
GET /emails/{emailUuid}/attachments/{uuid}/content
/emails/{emailUuid}/attachments/{uuid}/contentDownloads the bytes of one attachment of a synchronized email, read from Google at that moment. The response is the raw file, always as an attachment, not JSON.
When to use: To get a file the sender attached to an email, after finding its uuid in the attachments of get_email.
When not to use: Embedded images of the body are not downloaded here: use get_email_inline_images. Files stored in the CRM (not in Gmail) are other operations. Attachments are not kept by Easymailing: if Google no longer has the message, the download fails.
Side effects: Calls the Google API inside the request and streams the answer as it arrives; nothing is stored. It spends Gmail quota of the mailbox owner. Each person can have 2 downloads at once and each mailbox 4, with a per-minute rate (60 per person, 150 per mailbox); above it the answer is a 429 before Google is called. The response carries Content-Disposition: attachment, X-Content-Type-Options: nosniff and a sandboxing Content-Security-Policy; the Content-Type is the one the sender declared only when it is a safe type, otherwise application/octet-stream, and Content-Length is the declared size when Google gave it. A download that Google cuts in the middle ends shorter than Content-Length, so check the length before trusting the file.
Permissions: Requires a CRM seat and the crm.contacts_companies.read capability. Reading the emails of an opportunity needs the crm.opportunities.read capability instead (it is always granted together with crm.contacts_companies.read) and read access to the pipeline of the opportunity. It also needs full_access to the email through at least one readable mailbox. Only emails held by a mailbox the user owns, or one whose owner shared it with the user, can be seen at all, and each email shows only what the sharing level of that mailbox allows. Being the owner or assignee of a record gives no extra access to its emails.
Value for the X-Auth-Token header parameter.
In: header
Path Parameters
UUID of the email. Get it from list_emails or get_email.
uuidUUID of the attachment. Get it from attachments[].uuid in get_email.
uuidQuery Parameters
UUID of the contact through which you reached the email (the one you listed it from). Send exactly one of contact, company and opportunity; an email that is not part of that record is a 404.
uuidUUID of the company through which you reached the email (the one you listed it from). Send exactly one of contact, company and opportunity; an email that is not part of that record is a 404.
uuidUUID of the opportunity through which you reached the email (the one you listed it from). Send exactly one of contact, company and opportunity; an email that is not part of that record is a 404.
uuidResponse Body
application/octet-stream
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
application/problem+json
curl -X GET "https://api.easymailing.com/emails/b3c1d8e4-52a7-4f19-8e06-7d9a2c4b1f35/attachments/d4e3f0a6-74c9-4b31-a028-9fbc4e6d3157/content?contact=3a9e1f52-6c47-4d08-b1a3-9e2d7c5f8a40&company=7f3c2a10-5b8e-4d1a-9c2e-3a6f0b9d4e21&opportunity=5d8a3c16-9e2b-4f70-a1c4-6b0e7d3f2a95" \ -H "X-Auth-Token: YOUR_API_KEY""string"