Retrieve Attachment
GET /emails/:id/attachments/:attachment_id — fetch a single attachment from a sent email.
/emails/:id/attachments/:attachment_idRetrieve a single attachment from a sent email by its id. The response returns the attachment metadata. MailBlastr does not retain the original file bytes for sent mail, so download_url and expires_at are `null` — binary retrieval is not guaranteed for sent-email attachments.
Path parameters
idstringrequiredThe id of the sent email.
attachment_idstringrequiredThe id of the attachment to retrieve.
Response fields
objectstringoptionalAlways attachment.
idstringoptionalThe attachment id.
filenamestringoptionalThe file name.
sizenumberoptionalThe file size in bytes.
content_typestringoptionalThe MIME type.
content_dispositionstringoptionalinline or attachment.
content_idstringoptionalThe Content-ID, for inline images referenced by cid:.
download_urlstring | nulloptionalA signed URL to download the file bytes. Always null for sent-email attachments — the original bytes are not retained.
expires_atstring | nulloptionalISO 8601 time at which download_url expires. Always null for sent-email attachments.
Request
import { MailBlastr } from 'mailblastr';
const mb = new MailBlastr('mb_xxxxxxxxx');
const { data, error } = await mb.emails.getAttachment('4ef9a417-02e9-4d39-ad75-9611e0fcc33c', '2a0c9ce0-3112-4728-976e-47ddcd16a318');
console.log({ data, error });Response
{
"object": "attachment",
"id": "2a0c9ce0-3112-4728-976e-47ddcd16a318",
"filename": "avatar.png",
"size": 4096,
"content_type": "image/png",
"content_disposition": "inline",
"content_id": "img001",
"download_url": null,
"expires_at": null
}Errors
Returns not_found (404) if the email or the attachment does not exist for your account. See the error reference.