List Attachments
GET /emails/:id/attachments — list the attachments on a sent email.
/emails/:id/attachmentsList the attachments on an email your account has sent. Each entry returns the attachment metadata — filename, size, and MIME fields. MailBlastr does not retain the original file bytes for sent mail, so download_url and expires_at are `null` for sent-email attachments; binary retrieval is not guaranteed. (For received mail, attachment bytes are downloadable — see List Received Attachments.)
limit parameter is optional — if you omit it, all attachments are returned in a single response. See Pagination.Path parameters
idstringrequiredThe id of the sent email.
Query parameters
limitnumberoptionalNumber of attachments to retrieve per page. Optional. Maximum 100, minimum 1.
afterstringoptionalThe attachment id after which more attachments are retrieved. The passed id is not included. Cannot be combined with before.
beforestringoptionalThe attachment id before which more attachments are retrieved. The passed id is not included. Cannot be combined with after.
Response fields
Each item in data is an attachment object:
idstringoptionalThe attachment id.
filenamestringoptionalThe file name.
sizenumberoptionalThe file size in bytes.
content_typestringoptionalThe MIME type (e.g. image/png).
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.listAttachments('4ef9a417-02e9-4d39-ad75-9611e0fcc33c');
console.log({ data, error });Response
{
"object": "list",
"has_more": false,
"data": [
{
"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 no email with that id exists for your account; validation_error for a bad cursor or out-of-range limit. See the error reference.