Retrieve Received Attachment
GET /emails/receiving/:id/attachments/:attachment_id — fetch a single attachment from a received email.
/emails/receiving/:id/attachments/:attachment_idDownload a single attachment from a received email by its id. Unlike most API endpoints, this returns the raw file bytes as a binary download — not a JSON object. Use the Content-Type and Content-Disposition of the response to handle the file.
Path parameters
idstringrequiredThe id of the received email.
attachment_idstringrequiredThe id of the attachment to download.
Response
On success the response body is the raw attachment bytes. The Content-Type header carries the file's MIME type (render-capable types such as HTML/SVG are served as application/octet-stream for safety), and a Content-Disposition: attachment header carries the original filename. There is no JSON envelope.
HTTP/1.1 200 OK
Content-Type: image/png
Content-Disposition: attachment; filename="avatar.png"
X-Content-Type-Options: nosniff
<binary file bytes>Request
import { MailBlastr } from 'mailblastr';
const mb = new MailBlastr('mb_xxxxxxxxx');
const { data, error } = await mb.emails.receiving.getAttachment('4ef9a417-02e9-4d39-ad75-9611e0fcc33c', '2a0c9ce0-3112-4728-976e-47ddcd16a318');
console.log({ data, error });Errors
Returns not_found (404) if the received email or the attachment does not exist for your account, or if the attachment bytes were not stored for this email. See the error reference.