API Reference

Retrieve Attachment

GET /emails/:id/attachments/:attachment_id — fetch a single attachment from a sent email.

GET/emails/:id/attachments/:attachment_id

Retrieve 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

idstringrequired

The id of the sent email.

attachment_idstringrequired

The id of the attachment to retrieve.

Response fields

objectstringoptional

Always attachment.

idstringoptional

The attachment id.

filenamestringoptional

The file name.

sizenumberoptional

The file size in bytes.

content_typestringoptional

The MIME type.

content_dispositionstringoptional

inline or attachment.

content_idstringoptional

The Content-ID, for inline images referenced by cid:.

download_urlstring | nulloptional

A signed URL to download the file bytes. Always null for sent-email attachments — the original bytes are not retained.

expires_atstring | nulloptional

ISO 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.