For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
contact@agentmail.ccDiscord
DocumentationAPI ReferenceKnowledge BaseChangelog
DocumentationAPI ReferenceKnowledge BaseChangelog
  • API Reference
      • GETList Inboxes
      • GETGet Inbox
      • POSTCreate Inbox
      • PATCHUpdate Inbox
      • DELDelete Inbox
        • GETList Messages
        • GETGet Message
        • POSTBatch Get Messages
        • GETGet Attachment
        • GETGet Raw Message
        • PATCHUpdate Message
        • DELDelete Message
        • POSTSend Message
        • POSTReply To Message
        • POSTReply All Message
        • POSTForward Message
LogoLogo
contact@agentmail.ccDiscord
API ReferenceInboxesMessages

Batch Get Messages

POST
/v0/inboxes/:inbox_id/messages/batch-get
POST
/v0/inboxes/:inbox_id/messages/batch-get
1from agentmail import AgentMail
2
3client = AgentMail(
4 api_key="YOUR_TOKEN_HERE",
5)
6
7client.inboxes.messages.batch_get(
8 inbox_id="inbox_id",
9 message_ids=[
10 "message_ids",
11 "message_ids"
12 ],
13)
1{
2 "limit": 1,
3 "count": 1,
4 "messages": [
5 {
6 "inbox_id": "inbox_id",
7 "thread_id": "thread_id",
8 "message_id": "message_id",
9 "labels": [
10 "labels",
11 "labels"
12 ],
13 "timestamp": "2024-01-15T09:30:00Z",
14 "from": "from",
15 "to": [
16 "to",
17 "to"
18 ],
19 "size": 1,
20 "updated_at": "2024-01-15T09:30:00Z",
21 "created_at": "2024-01-15T09:30:00Z",
22 "reply_to": [
23 "reply_to",
24 "reply_to"
25 ],
26 "cc": [
27 "cc",
28 "cc"
29 ],
30 "bcc": [
31 "bcc",
32 "bcc"
33 ],
34 "subject": "subject",
35 "preview": "preview",
36 "text": "text",
37 "html": "html",
38 "extracted_text": "extracted_text",
39 "extracted_html": "extracted_html",
40 "attachments": [
41 {
42 "attachment_id": "attachment_id",
43 "size": 1,
44 "filename": "filename",
45 "content_type": "content_type",
46 "content_disposition": "inline",
47 "content_id": "content_id"
48 },
49 {
50 "attachment_id": "attachment_id",
51 "size": 1,
52 "filename": "filename",
53 "content_type": "content_type",
54 "content_disposition": "inline",
55 "content_id": "content_id"
56 }
57 ],
58 "in_reply_to": "in_reply_to",
59 "references": [
60 "references",
61 "references"
62 ],
63 "headers": {
64 "headers": "headers"
65 }
66 },
67 {
68 "inbox_id": "inbox_id",
69 "thread_id": "thread_id",
70 "message_id": "message_id",
71 "labels": [
72 "labels",
73 "labels"
74 ],
75 "timestamp": "2024-01-15T09:30:00Z",
76 "from": "from",
77 "to": [
78 "to",
79 "to"
80 ],
81 "size": 1,
82 "updated_at": "2024-01-15T09:30:00Z",
83 "created_at": "2024-01-15T09:30:00Z",
84 "reply_to": [
85 "reply_to",
86 "reply_to"
87 ],
88 "cc": [
89 "cc",
90 "cc"
91 ],
92 "bcc": [
93 "bcc",
94 "bcc"
95 ],
96 "subject": "subject",
97 "preview": "preview",
98 "text": "text",
99 "html": "html",
100 "extracted_text": "extracted_text",
101 "extracted_html": "extracted_html",
102 "attachments": [
103 {
104 "attachment_id": "attachment_id",
105 "size": 1,
106 "filename": "filename",
107 "content_type": "content_type",
108 "content_disposition": "inline",
109 "content_id": "content_id"
110 },
111 {
112 "attachment_id": "attachment_id",
113 "size": 1,
114 "filename": "filename",
115 "content_type": "content_type",
116 "content_disposition": "inline",
117 "content_id": "content_id"
118 }
119 ],
120 "in_reply_to": "in_reply_to",
121 "references": [
122 "references",
123 "references"
124 ],
125 "headers": {
126 "headers": "headers"
127 }
128 }
129 ]
130}
Fetch metadata for up to 500 messages in one request. Missing or restricted IDs are silently omitted; compare `count` against `limit` to detect misses. **CLI:** ```bash agentmail inboxes:messages batch-get --inbox-id <inbox_id> --message-id <id1> --message-id <id2> ```
Was this page helpful?
Previous

Get Attachment

Next
Built with

Fetch metadata for up to 500 messages in one request. Missing or restricted IDs are silently omitted; compare count against limit to detect misses.

CLI:

$agentmail inboxes:messages batch-get --inbox-id <inbox_id> --message-id <id1> --message-id <id2>

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Path parameters

inbox_idstringRequired
The ID of the inbox.

Request

This endpoint expects an object.
message_idslist of stringsRequired

IDs of messages to fetch. Maximum 500 ids per request. Duplicates are rejected with a validation error. IDs not found in the inbox (including cross-inbox or permission-restricted) are silently omitted from the response; callers detect misses by comparing count against limit.

Response

This endpoint returns an object.
limitinteger
Limit of number of items returned.
countinteger
Number of items returned.
messageslist of objects

Found messages. Order matches message_ids in the request. Body fields (text, html, extracted_text, extracted_html) are never populated; use the single-message endpoint to retrieve bodies.

Errors

400
Validation Error