import { createClient } from "@mailsai/sdk";
const client = createClient(); // reads MAILS_API_KEY
const result = await client.drafts.attachments.list(
"dft_01JZX8K3M9Q4P7VN2YB6RTDC0E",
);
console.log(result);from mailsai import create_client
client = create_client() # reads MAILS_API_KEY
result = client.list_draft_attachments(
"dft_01JZX8K3M9Q4P7VN2YB6RTDC0E",
)
print(result)curl 'https://api.mails.ai/v1/drafts/dft_01JZX8K3M9Q4P7VN2YB6RTDC0E/attachments' \
-H "Authorization: Bearer $MAILS_API_KEY"{
"data": [
{
"id": "dfa_01JZX8K3M9Q4P7VN2YB6RTDC0E",
"filename": "<filename>",
"content_type": "<content_type>",
"size": 0,
"status": "uploading",
"chunk_bytes": 0,
"chunk_count": 0,
"from_message_id": "<from_message_id>",
"created_at": "2026-10-04T12:00:00.000Z",
"storage": { "used_bytes": 0, "limit_bytes": 0 }
}
]
}200 The draft's files, oldest first.
401 Missing or invalid API key.
403 The API key lacks the required scope
(insufficient_scope), or the token belongs to an
app connected by sign-in and this operation is
closed to connected apps
(connected_app_not_allowed).
404 Resource not found in this workspace, or the agent
a send names is archived (agent_archived).
500 Internal server error.List a draft's files
import { createClient } from "@mailsai/sdk";
const client = createClient(); // reads MAILS_API_KEY
const result = await client.drafts.attachments.list(
"dft_01JZX8K3M9Q4P7VN2YB6RTDC0E",
);
console.log(result);from mailsai import create_client
client = create_client() # reads MAILS_API_KEY
result = client.list_draft_attachments(
"dft_01JZX8K3M9Q4P7VN2YB6RTDC0E",
)
print(result)curl 'https://api.mails.ai/v1/drafts/dft_01JZX8K3M9Q4P7VN2YB6RTDC0E/attachments' \
-H "Authorization: Bearer $MAILS_API_KEY"{
"data": [
{
"id": "dfa_01JZX8K3M9Q4P7VN2YB6RTDC0E",
"filename": "<filename>",
"content_type": "<content_type>",
"size": 0,
"status": "uploading",
"chunk_bytes": 0,
"chunk_count": 0,
"from_message_id": "<from_message_id>",
"created_at": "2026-10-04T12:00:00.000Z",
"storage": { "used_bytes": 0, "limit_bytes": 0 }
}
]
}200 The draft's files, oldest first.
401 Missing or invalid API key.
403 The API key lacks the required scope
(insufficient_scope), or the token belongs to an
app connected by sign-in and this operation is
closed to connected apps
(connected_app_not_allowed).
404 Resource not found in this workspace, or the agent
a send names is archived (agent_archived).
500 Internal server error.Was this page helpful?