Overview
This endpoint retrieves a paginated list of all email conversation threads for the authenticated user. Threads group related emails together based on Message-ID headers and subject lines, providing a conversation-based view of your emails.
Authentication
Bearer token for API authentication. Format: Bearer YOUR_API_KEY
Query Parameters
Maximum number of threads to return per page. Range: 1-100.
Number of threads to skip for pagination. Must be non-negative.
Search query to filter threads by subject or participant email addresses.
Filter threads by unread status. Set to true
to only return threads with unread messages.
Filter threads by archived status. Set to true
to only return archived threads.
Response
Array of thread objects with summary information and latest message preview. Show Thread object properties
Unique identifier for the thread.
Message ID of the first email in the thread.
Cleaned subject line used for thread grouping (removes Re:, Fwd: prefixes).
Array of all email addresses that have participated in this thread.
Total number of messages (inbound + outbound) in this thread.
ISO 8601 timestamp when the thread was last active (last message received/sent).
ISO 8601 timestamp when the thread was created.
Whether the thread contains any unread messages.
Whether the thread has been archived.
Preview of the most recent message in the thread. Show Latest message properties
Unique identifier for the message.
Message type: inbound
(received) or outbound
(sent).
Subject line of the message.
Sender information (name and email or just email).
First 200 characters of the message content.
Whether this message has been read.
Whether this message contains attachments.
ISO 8601 timestamp when the message was received or sent.
Pagination information for the current request. Show Pagination properties
Maximum number of results per page.
Number of results skipped.
Total number of threads matching the query.
Whether there are more results available.
Applied filter information. Search query that was applied (if any).
Whether unread filter was applied.
Whether archived filter was applied.
Examples
Basic Request
import { Inbound } from '@inboundemail/sdk'
const inbound = new Inbound ( 'YOUR_API_KEY' )
const { data : threads , error } = await inbound . thread . list ()
if ( error ) {
console . error ( 'Error:' , error )
} else {
console . log ( `Found ${ threads . threads . length } threads` )
console . log ( `Total: ${ threads . pagination . total } ` )
}
Filtered Request
import { Inbound } from '@inboundemail/sdk'
const inbound = new Inbound ( 'YOUR_API_KEY' )
const { data : threads , error } = await inbound . thread . list ({
search: 'support' ,
unread: true ,
limit: 10
})
if ( error ) {
console . error ( 'Error:' , error )
} else {
console . log ( `Found ${ threads . threads . length } unread support threads` )
}
Response
{
"threads" : [
{
"id" : "thread_abc123" ,
"rootMessageId" : "<msg123@example.com>" ,
"normalizedSubject" : "Support Request - Login Issues" ,
"participantEmails" : [ "customer@example.com" , "support@yourdomain.com" ],
"messageCount" : 3 ,
"lastMessageAt" : "2024-01-15T14:30:00Z" ,
"createdAt" : "2024-01-15T10:00:00Z" ,
"hasUnread" : true ,
"isArchived" : false ,
"latestMessage" : {
"id" : "email_789" ,
"type" : "inbound" ,
"subject" : "Re: Support Request - Login Issues" ,
"fromText" : "John Doe <customer@example.com>" ,
"textPreview" : "Thanks for the password reset. I'm still having issues..." ,
"isRead" : false ,
"hasAttachments" : false ,
"date" : "2024-01-15T14:30:00Z"
}
}
],
"pagination" : {
"limit" : 10 ,
"offset" : 0 ,
"total" : 1 ,
"hasMore" : false
},
"filters" : {
"search" : "support" ,
"unreadOnly" : true
}
}
Error Responses
400 Bad Request
401 Unauthorized
500 Internal Server Error
{
"error" : "Limit must be between 1 and 100"
}