import Inbound from 'inboundemail';
const client = new Inbound({
apiKey: process.env['INBOUND_API_KEY'], // This is the default and can be omitted
});
const mail = await client.mail.list();
console.log(mail.filters);{
"threads": [
{
"id": "<string>",
"root_message_id": "<string>",
"participant_emails": [
"<string>"
],
"participant_names": [
"<string>"
],
"message_count": 123,
"last_message_at": "<string>",
"created_at": "<string>",
"has_unread": true,
"is_archived": true,
"normalized_subject": "<string>",
"latest_message": {
"id": "<string>",
"type": "<string>",
"from_text": "<string>",
"is_read": true,
"has_attachments": true,
"subject": "<string>",
"text_preview": "<string>",
"date": "<string>"
},
"unread_count": 123
}
],
"pagination": {
"limit": 123,
"has_more": true,
"next_cursor": "<string>"
},
"filters": {
"search": "<string>",
"unread_only": true,
"domain": "<string>",
"address": "<string>"
}
}List email threads (conversations) for your inbox with cursor-based pagination. This is the primary endpoint for building an inbox UI.
What is a Thread? A thread groups related emails together based on the In-Reply-To and References headers, similar to how Gmail groups conversations. Each thread contains both inbound (received) and outbound (sent) messages.
Use with /mail/threads/:id:
Use this endpoint to list threads, then use GET /mail/threads/:id to fetch all messages in a specific thread.
import Inbound from 'inboundemail';
const client = new Inbound({
apiKey: process.env['INBOUND_API_KEY'], // This is the default and can be omitted
});
const mail = await client.mail.list();
console.log(mail.filters);{
"threads": [
{
"id": "<string>",
"root_message_id": "<string>",
"participant_emails": [
"<string>"
],
"participant_names": [
"<string>"
],
"message_count": 123,
"last_message_at": "<string>",
"created_at": "<string>",
"has_unread": true,
"is_archived": true,
"normalized_subject": "<string>",
"latest_message": {
"id": "<string>",
"type": "<string>",
"from_text": "<string>",
"is_read": true,
"has_attachments": true,
"subject": "<string>",
"text_preview": "<string>",
"date": "<string>"
},
"unread_count": 123
}
],
"pagination": {
"limit": 123,
"has_more": true,
"next_cursor": "<string>"
},
"filters": {
"search": "<string>",
"unread_only": true,
"domain": "<string>",
"address": "<string>"
}
}Your Inbound API key. Include it in the Authorization header as: Bearer
Filter threads by domain. Accepts domain ID (e.g., 'dom_xxx') or domain name (e.g., 'example.com'). Returns threads where any participant email matches the domain.
Filter threads by email address. Accepts address ID (e.g., 'addr_xxx') or raw email address (e.g., 'user@example.com'). Returns threads where the address is a participant.
Maximum number of threads to return (1-100). Default is 25.
Cursor for pagination. Pass the thread ID from pagination.next_cursor of the previous response to get the next page.
Search query to filter threads by subject or participant emails. Case-insensitive partial match.
Filter by unread status. Set to 'true' to only return threads with unread messages.
Response for status 200
Was this page helpful?