> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/getrupt/sendook/llms.txt
> Use this file to discover all available pages before exploring further.

# Threads

> Manage email conversation threads

Threads represent email conversations. Each thread contains one or more messages that are part of the same conversation.

## List Threads

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.sendook.com/v1/inboxes/inbox_123/threads \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.sendook.com/v1/inboxes/inbox_123/threads', {
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  });

  const threads = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://api.sendook.com/v1/inboxes/inbox_123/threads',
      headers={'Authorization': 'Bearer YOUR_API_KEY'}
  )

  threads = response.json()
  ```
</CodeGroup>

Retrieve all threads in an inbox.

### Path Parameters

<ParamField path="inboxId" type="string" required>
  The unique identifier of the inbox.
</ParamField>

### Response

Returns an array of thread objects.

<ResponseField name="id" type="string">
  Unique identifier for the thread.
</ResponseField>

<ResponseField name="organizationId" type="string">
  ID of the organization that owns this thread.
</ResponseField>

<ResponseField name="inboxId" type="string">
  ID of the inbox this thread belongs to.
</ResponseField>

<ResponseField name="messages" type="string[]">
  Array of message IDs in this thread, in chronological order.
</ResponseField>

<ResponseField name="createdAt" type="string">
  ISO 8601 timestamp of when the thread was created.
</ResponseField>

<ResponseField name="updatedAt" type="string">
  ISO 8601 timestamp of when the thread was last updated.
</ResponseField>

### Error Responses

**404 Not Found**

* `"Inbox not found"` - The inbox doesn't exist or doesn't belong to your organization

***

## Get Thread

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.sendook.com/v1/inboxes/inbox_123/threads/thread_456 \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.sendook.com/v1/inboxes/inbox_123/threads/thread_456', {
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  });

  const thread = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://api.sendook.com/v1/inboxes/inbox_123/threads/thread_456',
      headers={'Authorization': 'Bearer YOUR_API_KEY'}
  )

  thread = response.json()
  ```
</CodeGroup>

Retrieve a specific thread by its ID.

### Path Parameters

<ParamField path="inboxId" type="string" required>
  The unique identifier of the inbox.
</ParamField>

<ParamField path="threadId" type="string" required>
  The unique identifier of the thread to retrieve.
</ParamField>

### Response

<ResponseField name="id" type="string">
  Unique identifier for the thread.
</ResponseField>

<ResponseField name="organizationId" type="string">
  ID of the organization that owns this thread.
</ResponseField>

<ResponseField name="inboxId" type="string">
  ID of the inbox this thread belongs to.
</ResponseField>

<ResponseField name="messages" type="string[]">
  Array of message IDs in this thread, in chronological order.

  Use the [Get Message](/api/messages#get-message) endpoint to retrieve the full details of each message.
</ResponseField>

<ResponseField name="createdAt" type="string">
  ISO 8601 timestamp of when the thread was created.
</ResponseField>

<ResponseField name="updatedAt" type="string">
  ISO 8601 timestamp of when the thread was last updated.
</ResponseField>

### Error Responses

**404 Not Found**

* `"Thread not found"` - The thread doesn't exist or doesn't belong to your organization, or doesn't belong to the specified inbox

***

## Working with Threads

Threads are automatically created when you send a message using the [Send Message](/api/messages#send-message) endpoint. When you reply to a message using the [Reply to Message](/api/messages#reply-to-message) endpoint, the reply is automatically added to the same thread.

### Thread Lifecycle

1. **Creation**: A thread is created automatically when you send a new message
2. **Growth**: Additional messages are added to the thread when:
   * You reply to a message in the thread
   * You receive a reply from a recipient
3. **Retrieval**: Use the List Threads or Get Thread endpoints to view thread information

### Best Practices

* Use threads to group related messages together in your application UI
* Fetch thread details to show complete conversation history
* Monitor the `messages` array to track conversation length
* Use the `updatedAt` timestamp to sort threads by recent activity
