Skip to main content
GET
/
api
/
e2
/
mail
/
threads
JavaScript
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>"
  }
}

Authorizations

Authorization
string
header
required

Your Inbound API key. Include it in the Authorization header as: Bearer

Query Parameters

domain
string

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.

address
string

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.

limit
string
default:25

Maximum number of threads to return (1-100). Default is 25.

cursor
string

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.

unread
string
default:false

Filter by unread status. Set to 'true' to only return threads with unread messages.

Response

Response for status 200

threads
object[]
required

Array of thread objects matching the query, sorted by last message date (newest first)

pagination
object
required

Pagination metadata for cursor-based pagination

filters
object
required

Applied filters for this query