List Messages
Retrieve messages from an inbox with filtering and pagination
Authentication
Requires the inbox's API key in the Authorization header.
Path Parameters
idstringpathrequiredInbox ID (e.g., inb_abc123)
Query Parameters
labelstringqueryFilter by label (e.g., verification, newsletter)
thread_idstringqueryFilter by thread UUID
beforestringqueryISO 8601 datetime - messages received before this time
afterstringqueryISO 8601 datetime - messages received after this time
limitintegerqueryNumber of messages to return (1-100)
sortstringquerySort order: desc (newest first) or asc (oldest first)
Request
curl -X GET "https://api.daimon.email/v1/inboxes/inb_abc123/messages?limit=20&sort=desc" \
-H "Authorization: Bearer dm_free_7d8a9b0c1d2e3f4g5h6i7j8k9l0m1n2o"const client = new DaimonClient({ apiKey: 'dm_free_...' });
const response = await client.inboxes.messages.list('inb_abc123', {
limit: 20,
sort: 'desc',
label: 'verification'
});
console.log(`Total: ${response.total}`);
console.log(`Has more: ${response.hasMore}`);
response.messages.forEach(msg => {
console.log(`${msg.subject} - ${msg.preview}`);
console.log(`Links: ${msg.ctaLinks}`);
});client = DaimonClient(api_key='dm_free_...')
response = client.inboxes.messages.list('inb_abc123',
limit=20,
sort='desc',
label='verification'
)
print(f"Total: {response.total}")
print(f"Has more: {response.has_more}")
for msg in response.messages:
print(f"{msg.subject} - {msg.preview}")
print(f"Links: {msg.cta_links}")Response
Response
{
"result": {
"messages": [
{
"id": "msg_xyz789",
"inbox_id": "inb_abc123",
"thread_id": "thr_def456",
"from_address": "support@example.com",
"to_address": "my-agent@daimon.email",
"subject": "Verify your account",
"body_text": "Click here to verify: https://example.com/verify?token=abc123",
"body_html": "<p>Click here to verify: <a href=\"https://example.com/verify?token=abc123\">Verify</a></p>",
"reply_body": "Click here to verify: https://example.com/verify?token=abc123",
"links": [
"https://example.com/verify?token=abc123"
],
"cta_links": [
"https://example.com/verify?token=abc123"
],
"preview": "Click here to verify: https://example.com/verify?token=abc123",
"labels": ["verification"],
"read": false,
"received_at": "2024-03-11T14:23:45Z",
"created_at": "2024-03-11T14:23:46Z"
}
],
"total": 42,
"has_more": true
},
"next_steps": [
"Call GET /v1/inboxes/{id}/messages/{msgId} for full message details",
"Use thread_id to retrieve all messages in a conversation",
"Filter by label='verification' to find confirmation emails"
]
}Response Fields
result.messagesarrayArray of message objects
result.messages[].idstringMessage ID (e.g., msg_xyz789)
result.messages[].inbox_idstringParent inbox ID
result.messages[].thread_idstringThread ID - groups related messages
result.messages[].from_addressstringSender email address
result.messages[].to_addressstringRecipient email address (your inbox)
result.messages[].subjectstringEmail subject line
result.messages[].body_textstringPlain text body
result.messages[].body_htmlstringHTML body (if available)
result.messages[].reply_bodystringExtracted reply text without quoted history (via TalonJS)
result.messages[].linksarrayAll URLs found in the message
result.messages[].cta_linksarrayDetected call-to-action links (verify, confirm, activate, etc.)
result.messages[].previewstringFirst ~150 characters of the message
result.messages[].labelsarrayAuto-detected labels (e.g., verification, newsletter)
result.messages[].readbooleanWhether the message has been marked as read
result.messages[].received_atstringISO 8601 timestamp of when the message was received
result.messages[].created_atstringISO 8601 timestamp of when the message was stored
result.totalintegerTotal number of messages matching the filter
result.has_morebooleanWhether there are more messages beyond the current page
next_stepsarrayAgent guidance for next actions
Use Cases
Poll for verification emails
// Agent polls for verification emails every 5 seconds
const messages = await client.inboxes.messages.list('inb_abc123', {
label: 'verification',
limit: 1,
sort: 'desc'
});
if (messages.messages.length > 0) {
const verifyUrl = messages.messages[0].cta_links[0];
console.log(`Verification link: ${verifyUrl}`);
}Check for new messages since last check
const lastCheck = '2024-03-11T14:00:00Z';
const messages = await client.inboxes.messages.list('inb_abc123', {
after: lastCheck,
sort: 'asc'
});
console.log(`${messages.messages.length} new messages`);Find all messages in a thread
const messages = await client.inboxes.messages.list('inb_abc123', {
thread_id: 'thr_def456',
sort: 'asc' // Chronological order
});
console.log(`Thread has ${messages.total} messages`);