API Reference

List Attachments

GET /emails/:id/attachments — list the attachments on a sent email.

GET/emails/:id/attachments

List 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.)

This endpoint is not paginated. Every attachment on the email is returned in one list response, has_more is always false, and limit / after / before are ignored if you send them. (The received-mail sibling, List Received Attachments, *is* paginated.)

Path parameters

idstringrequired

The id of the sent email.

Response fields

Each item in data is an attachment object:

idstringoptional

The attachment id.

filenamestringoptional

The file name.

sizenumber | nulloptional

The file size in bytes, or null when the attachment was sent by hosted path URL — the size is derived from stored base64 content, which a URL-sent attachment does not have.

content_typestringoptional

The MIME type (e.g. image/png).

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.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. There are no pagination errors on this endpoint — it takes no query parameters. See the error reference.