import { createClient } from "@mailsai/sdk";
const client = createClient(); // reads MAILS_API_KEY
const result = await client.received.attachments.list(
"rcv_01JZX8K3M9Q4P7VN2YB6RTDC0E",
);
console.log(result);from mailsai import create_client
client = create_client() # reads MAILS_API_KEY
result = client.list_attachments(
"rcv_01JZX8K3M9Q4P7VN2YB6RTDC0E",
)
print(result)curl 'https://api.mails.ai/v1/messages/received/rcv_01JZX8K3M9Q4P7VN2YB6RTDC0E/attachments' \
-H "Authorization: Bearer $MAILS_API_KEY"mails receiving attachments rcv_01JABC{
"name": "mails_attachments_list",
"arguments": {
"message_id": "rcv_01JZX8K3M9Q4P7VN2YB6RTDC0E"
}
}{
"data": [
{
"id": "att_01JZX8K3M9Q4P7VN2YB6RTDC0E",
"filename": "<filename>",
"content_type": "<content_type>",
"size": 0,
"content_id": "<content_id>",
"inline": false
}
],
"omitted": [
{
"filename": "<filename>",
"content_type": "<content_type>",
"size": 0,
"reason": "too_large"
}
],
"omitted_count": 0,
"raw_omitted": "too_large"
}200 The message's attachments.
400 Invalid request — malformed JSON or a field failed
validation. Also feature_not_enabled when this
server has a feature switched off (custom domains
before they are available).
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 received message's attachments
Every file in the message, embedded images included (
inline: true).import { createClient } from "@mailsai/sdk";
const client = createClient(); // reads MAILS_API_KEY
const result = await client.received.attachments.list(
"rcv_01JZX8K3M9Q4P7VN2YB6RTDC0E",
);
console.log(result);from mailsai import create_client
client = create_client() # reads MAILS_API_KEY
result = client.list_attachments(
"rcv_01JZX8K3M9Q4P7VN2YB6RTDC0E",
)
print(result)curl 'https://api.mails.ai/v1/messages/received/rcv_01JZX8K3M9Q4P7VN2YB6RTDC0E/attachments' \
-H "Authorization: Bearer $MAILS_API_KEY"mails receiving attachments rcv_01JABC{
"name": "mails_attachments_list",
"arguments": {
"message_id": "rcv_01JZX8K3M9Q4P7VN2YB6RTDC0E"
}
}{
"data": [
{
"id": "att_01JZX8K3M9Q4P7VN2YB6RTDC0E",
"filename": "<filename>",
"content_type": "<content_type>",
"size": 0,
"content_id": "<content_id>",
"inline": false
}
],
"omitted": [
{
"filename": "<filename>",
"content_type": "<content_type>",
"size": 0,
"reason": "too_large"
}
],
"omitted_count": 0,
"raw_omitted": "too_large"
}200 The message's attachments.
400 Invalid request — malformed JSON or a field failed
validation. Also feature_not_enabled when this
server has a feature switched off (custom domains
before they are available).
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.Path Parameters
idstringrequired
Received message id (rcv_…).
Files that could not be kept are listed under omitted.
Response
dataobject[]
The message's files that were kept, embedded images included (inline: true), at most 100. Empty when it carried none or none could be kept.
omittedobject[]
Present only when the message carried files that could not be kept.
omitted_countinteger
How many files could not be kept: those in omitted, plus any past the 100 it lists. Present only when above 0.
raw_omittedstring
Present when the raw email was not kept, and why, with the same values as raw_omitted on the received message. Without the raw email none of the message's files can be downloaded.
Was this page helpful?