daimon.email
Api referenceThreads

Get Thread

Retrieve a single thread with all its messages

Overview

Retrieve complete details for a single email thread, including all messages in the conversation.

Authentication

Authorizationstringpathrequired

Inbox API Key

Path Parameters

idstringpathrequired

The inbox ID (e.g., inb_abc123)

threadIdstringpathrequired

The thread ID (e.g., thr_xyz789)

Request

curl -X GET https://api.daimon.email/v1/inboxes/inb_abc123/threads/thr_xyz789 \
  -H "Authorization: Bearer dm_free_7d8a9b0c1d2e3f4g5h6i7j8k9l0m1n2o"
import { DaimonClient } from 'daimon-email';

const client = new DaimonClient({
  apiKey: 'dm_free_7d8a9b0c1d2e3f4g5h6i7j8k9l0m1n2o'
});

const thread = await client.inboxes.threads.get('inb_abc123', 'thr_xyz789');

console.log(`Thread: ${thread.subject}`);
console.log(`Messages: ${thread.messages.length}`);

thread.messages.forEach(msg => {
  console.log(`  From: ${msg.from_address}`);
  console.log(`  Subject: ${msg.subject}`);
  console.log(`  Reply: ${msg.reply_body}`);
  console.log(`  Links: ${msg.links.join(', ')}`);
  console.log(`  CTAs: ${msg.cta_links.join(', ')}`);
});
from daimon_email import DaimonClient

client = DaimonClient(
    api_key='dm_free_7d8a9b0c1d2e3f4g5h6i7j8k9l0m1n2o'
)

thread = client.inboxes.threads.get('inb_abc123', 'thr_xyz789')

print(f"Thread: {thread['subject']}")
print(f"Messages: {len(thread['messages'])}")

for msg in thread['messages']:
    print(f"  From: {msg['from_address']}")
    print(f"  Subject: {msg['subject']}")
    print(f"  Reply: {msg['reply_body']}")
    print(f"  Links: {', '.join(msg['links'])}")
    print(f"  CTAs: {', '.join(msg['cta_links'])}")

Response

{
  "result": {
    "thread": {
      "id": "thr_xyz789",
      "inbox_id": "inb_abc123",
      "subject": "Order Confirmation #12345",
      "labels": ["important", "order"],
      "message_count": 3,
      "unread_count": 1,
      "created_at": "2024-03-11T14:23:45Z",
      "updated_at": "2024-03-11T16:45:00Z",
      "messages": [
        {
          "id": "msg_abc001",
          "from_address": "orders@shop.com",
          "to_address": "my-agent@daimon.email",
          "subject": "Order Confirmation #12345",
          "body_text": "Thank you for your order! Your order #12345 has been confirmed...",
          "body_html": "<html><body><h1>Order Confirmation</h1>...</body></html>",
          "reply_body": "Thank you for your order! Your order #12345 has been confirmed...",
          "links": [
            "https://shop.com/orders/12345",
            "https://shop.com/track/abc123"
          ],
          "cta_links": [
            "https://shop.com/track/abc123"
          ],
          "labels": ["order"],
          "read": true,
          "received_at": "2024-03-11T14:23:45Z",
          "attachments": []
        },
        {
          "id": "msg_abc002",
          "from_address": "my-agent@daimon.email",
          "to_address": "orders@shop.com",
          "subject": "Re: Order Confirmation #12345",
          "body_text": "Can I change the shipping address?",
          "body_html": "<html><body>Can I change the shipping address?</body></html>",
          "reply_body": "Can I change the shipping address?",
          "links": [],
          "cta_links": [],
          "labels": [],
          "read": true,
          "received_at": "2024-03-11T15:10:30Z",
          "attachments": []
        },
        {
          "id": "msg_abc003",
          "from_address": "support@shop.com",
          "to_address": "my-agent@daimon.email",
          "subject": "Re: Order Confirmation #12345",
          "body_text": "Yes, you can update your shipping address here: https://shop.com/orders/12345/edit",
          "body_html": "<html><body>Yes, you can update your shipping address here...</body></html>",
          "reply_body": "Yes, you can update your shipping address here: https://shop.com/orders/12345/edit",
          "links": [
            "https://shop.com/orders/12345/edit"
          ],
          "cta_links": [
            "https://shop.com/orders/12345/edit"
          ],
          "labels": [],
          "read": false,
          "received_at": "2024-03-11T16:45:00Z",
          "attachments": []
        }
      ]
    }
  },
  "next_steps": [
    "Use PATCH /v1/inboxes/{id}/threads/{threadId} to update labels",
    "Use PATCH /v1/inboxes/{id}/messages/{messageId} to mark individual messages as read",
    "Use POST /v1/inboxes/{id}/send to reply to this thread"
  ]
}

Response Fields

result.threadobject

Complete thread object with all messages

Thread object
idstring

Unique thread identifier

inbox_idstring

The inbox this thread belongs to

subjectstring

Thread subject line

labelsarray

Array of label strings applied to this thread

message_countnumber

Total number of messages in this thread

unread_countnumber

Number of unread messages in this thread

created_atstring

ISO 8601 timestamp when thread was created

updated_atstring

ISO 8601 timestamp when thread was last updated

messagesarray

Array of all messages in this thread, ordered chronologically

Message object
idstring

Unique message identifier

from_addressstring

Sender email address

to_addressstring

Recipient email address

subjectstring

Message subject line

body_textstring

Plain text body of the message

body_htmlstring

HTML body of the message (may be null)

reply_bodystring

Extracted reply text without quoted history (using TalonJS)

linksarray

All URLs found in the message body

cta_linksarray

Call-to-action links (verify, confirm, activate, etc.)

labelsarray

Array of label strings applied to this message

readboolean

Whether this message has been marked as read

received_atstring

ISO 8601 timestamp when message was received

attachmentsarray

Array of attachment objects (filename, size, content_type, download_url)

next_stepsarray

Suggested actions the agent can take next