Overview
This endpoint retrieves all messages in a specific email thread, providing a complete conversation history. Messages are returned in chronological order with both inbound (received) and outbound (sent) emails included.Authentication
Bearer token for API authentication. Format:
Bearer YOUR_API_KEY
Path Parameters
The unique identifier of the thread to retrieve.
Response
Thread metadata and summary information.
Show Thread properties
Show Thread properties
Unique identifier for the thread.
Message ID of the first email in the thread.
Cleaned subject line used for thread grouping.
Array of all email addresses that have participated in this thread.
Total number of messages in this thread.
ISO 8601 timestamp when the thread was last active.
ISO 8601 timestamp when the thread was created.
ISO 8601 timestamp when the thread was last updated.
Array of all messages in the thread, sorted by thread position (chronological order).
Show Message object properties
Show Message object properties
Unique identifier for the message.
RFC 2822 Message-ID header from the email.
Message type:
inbound
(received) or outbound
(sent).Position of this message in the thread (1 = first, 2 = second, etc.).
Subject line of the message.
Plain text content of the message.
HTML content of the message.
Sender information (display name and email or just email).
Sender’s display name (if available).
Sender’s email address.
Array of recipient email addresses.
Array of CC recipient email addresses.
Array of BCC recipient email addresses.
ISO 8601 timestamp from the email’s Date header.
ISO 8601 timestamp when the message was received (inbound only).
ISO 8601 timestamp when the message was sent (outbound only).
Whether this message has been read.
ISO 8601 timestamp when the message was marked as read.
Whether this message contains attachments.
Array of attachment metadata.
Message ID this message is replying to.
Array of referenced message IDs for threading.
Email headers as key-value pairs.
Message status for sent emails:
pending
, sent
, or failed
.Error message if the message failed to send (outbound only).
Total number of messages in the thread.
Examples
Request
Copy
import { Inbound } from '@inboundemail/sdk'
const inbound = new Inbound('YOUR_API_KEY')
const { data: thread, error } = await inbound.thread.get('thread_abc123')
if (error) {
console.error('Error:', error)
} else {
console.log(`Thread: ${thread.thread.normalizedSubject}`)
console.log(`Messages: ${thread.messages.length}`)
console.log(`Participants: ${thread.thread.participantEmails.join(', ')}`)
}
Response
Copy
{
"thread": {
"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",
"updatedAt": "2024-01-15T14:30:00Z"
},
"messages": [
{
"id": "email_123",
"messageId": "<msg123@example.com>",
"type": "inbound",
"threadPosition": 1,
"subject": "Support Request - Login Issues",
"textBody": "I'm having trouble logging into my account...",
"htmlBody": "<p>I'm having trouble logging into my account...</p>",
"from": "John Doe <customer@example.com>",
"fromName": "John Doe",
"fromAddress": "customer@example.com",
"to": ["support@yourdomain.com"],
"cc": [],
"bcc": [],
"date": "2024-01-15T10:00:00Z",
"receivedAt": "2024-01-15T10:00:00Z",
"sentAt": null,
"isRead": true,
"readAt": "2024-01-15T10:05:00Z",
"hasAttachments": false,
"attachments": [],
"inReplyTo": null,
"references": [],
"headers": {},
"tags": []
},
{
"id": "sent_456",
"messageId": "<reply456@yourdomain.com>",
"type": "outbound",
"threadPosition": 2,
"subject": "Re: Support Request - Login Issues",
"textBody": "Thank you for contacting support. We've reset your password...",
"htmlBody": "<p>Thank you for contacting support. We've reset your password...</p>",
"from": "Support Team <support@yourdomain.com>",
"fromName": "Support Team",
"fromAddress": "support@yourdomain.com",
"to": ["customer@example.com"],
"cc": [],
"bcc": [],
"date": "2024-01-15T11:30:00Z",
"receivedAt": null,
"sentAt": "2024-01-15T11:30:00Z",
"isRead": true,
"readAt": null,
"hasAttachments": false,
"attachments": [],
"inReplyTo": "<msg123@example.com>",
"references": ["<msg123@example.com>"],
"headers": {},
"tags": [{"name": "category", "value": "support"}],
"status": "sent"
}
],
"totalCount": 3
}
Error Responses
Copy
{
"error": "Thread not found"
}