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 paginated. The limit parameter is optional — if you omit it, all attachments are returned in a single response. See Pagination.

Path parameters

idstringrequired

The id of the sent email.

Query parameters

limitnumberoptional

Number of attachments to retrieve per page. Optional. Maximum 100, minimum 1.

afterstringoptional

The attachment id after which more attachments are retrieved. The passed id is not included. Cannot be combined with before.

beforestringoptional

The 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:

idstringoptional

The attachment id.

filenamestringoptional

The file name.

sizenumberoptional

The file size in bytes.

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; validation_error for a bad cursor or out-of-range limit. See the error reference.