Skip to main content
import { createClient } from "@mailsai/sdk";

const client = createClient(); // reads MAILS_API_KEY

const result = await client.drafts.attachments.remove(
  "dft_01JZX8K3M9Q4P7VN2YB6RTDC0E",
  "dfa_01JZX8K3M9Q4P7VN2YB6RTDC0E",
);
console.log(result);
{
  "id": "dfa_01JZX8K3M9Q4P7VN2YB6RTDC0E",
  "deleted_at": "2026-10-04T12:00:00.000Z"
}

Remove a file from a draft

Takes a file off a draft, and deletes its bytes.
DELETE/v1/drafts/{id}/attachments/{attachment_id}scope · manage or draft
import { createClient } from "@mailsai/sdk";

const client = createClient(); // reads MAILS_API_KEY

const result = await client.drafts.attachments.remove(
  "dft_01JZX8K3M9Q4P7VN2YB6RTDC0E",
  "dfa_01JZX8K3M9Q4P7VN2YB6RTDC0E",
);
console.log(result);
{
  "id": "dfa_01JZX8K3M9Q4P7VN2YB6RTDC0E",
  "deleted_at": "2026-10-04T12:00:00.000Z"
}

Path Parameters

idstringrequired

Draft id.

attachment_idstringrequired

File id (dfa_…).

Response

idstring

Id of the removed file (dfa_…).

deleted_atstring

The time of this call.

Was this page helpful?