> ## Documentation Index
> Fetch the complete documentation index at: https://docs.threadify.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Thread Chains

> Query parent-child thread relationships

Thread chains trace linked workflows from any starting thread down through its
descendants.

## Usage

<Tabs>
  <Tab title="JavaScript">
    ```javascript theme={null}
    const chain = await threadify.getThreadChain(startThreadId, maxDepth);
    ```
  </Tab>

  <Tab title="Go">
    ```go theme={null}
    chain, err := conn.GetThreadChain(ctx, startThreadID, 3)
    if err != nil {
        log.Fatal(err)
    }

    for _, t := range chain {
        fmt.Println("Thread ID:", t.ID)
    }
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    chain = await conn.get_thread_chain(start_thread_id, max_depth=3)

    for t in chain:
        print("Thread ID:", t.id)
    ```
  </Tab>
</Tabs>

## Parameters

| Parameter       | Type   | Default  | Description                                   |
| --------------- | ------ | -------- | --------------------------------------------- |
| `startThreadId` | string | required | Thread ID to start from (any thread in chain) |
| `maxDepth`      | number | 3        | Maximum depth to traverse downward            |

## Returns

Array of `ArchivedThread` objects ordered from starting thread to descendants.

## Behavior

* **Starting Point**: Works from any thread (root, middle, or leaf)
* **Direction**: Traverses downward only (parent → children)
* **Cycle Prevention**: Automatically detects circular references
* **Archival delay**: Recent relationships appear after asynchronous persistence

## Relationship Types

| Type       | Description                              |
| ---------- | ---------------------------------------- |
| `parent`   | Parent thread that spawned this workflow |
| `child`    | Child thread for sub-processes           |
| `related`  | Parallel or dependent workflow           |
| `followup` | Continuation of previous thread          |
