---
title: "List threads"
description: "Returns the session's side-chat threads in `data` in creation order, archived ones included. Threads that run other agents, such as subagents, are not listed."
url: "https://www.thecompany.company/docs/api/sessions/list-threads"
---

# List threads

> Returns the session's side-chat threads in `data` in creation order, archived ones included. Threads that run other agents, such as subagents, are not listed.

- **Surface:** The App API
- **Endpoint:** `GET https://api.thecompany.company/v1/sessions/{id}/threads`
- **Operation ID:** `sessions.listThreads`
- **Authentication:** `Authorization: Bearer <TOKEN>`

## Parameters

| Name | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | `path` | `string` | Yes |  |

## Responses

### `200` (`application/json`)

ThreadListResult

Schema: `ThreadListResult`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `array<SessionThread>` | Yes |  |
| `data[].threadId` | `integer` | Yes |  |
| `data[].label` | `string` | Yes |  |
| `data[].status` | `string` | Yes |  |
| `data[].forkSource` | `object` | No |  |
| `data[].forkSource.threadId` | `integer` | Yes |  |
| `data[].forkSource.messageId` | `integer` | Yes |  |
| `data[].archivedAt` | `number` | No |  |
| `data[].createdAt` | `number` | Yes |  |
| `threads` | `array<ThreadListRow>` | Yes | Deprecated: read `data` instead. This field will be removed in a follow-up change. |
| `threads[].threadId` | `integer` | Yes |  |
| `threads[].label` | `string` | Yes |  |
| `threads[].status` | `string` | Yes |  |
| `threads[].forkSource` | `object` | No |  |
| `threads[].forkSource.threadId` | `integer` | Yes |  |
| `threads[].forkSource.messageId` | `integer` | Yes |  |
| `threads[].archivedAt` | `number` | No |  |
| `threads[].createdAt` | `number` | Yes |  |

Example:

```json
{
  "data": [
    {
      "threadId": 0,
      "label": "string",
      "status": "running",
      "forkSource": {
        "threadId": 0,
        "messageId": 1
      },
      "archivedAt": 1,
      "createdAt": 1
    }
  ],
  "threads": [
    {
      "threadId": 0,
      "label": "string",
      "status": "running",
      "forkSource": {
        "threadId": 0,
        "messageId": 1
      },
      "archivedAt": 1,
      "createdAt": 1
    }
  ]
}
```

### `401` (`application/json`)

AuthenticationError

Schema: `AuthenticationError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |
| `reason` | `string` | Yes |  |
| `description` | `string` | No |  |

Example:

```json
{
  "_tag": "AuthenticationError",
  "reason": "invalid_session",
  "description": "string"
}
```

### `402` (`application/json`)

OrganizationUnsubscribedError

Schema: `OrganizationUnsubscribedError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |
| `code` | `string` | Yes |  |

Example:

```json
{
  "_tag": "OrganizationUnsubscribedError",
  "code": "ORGANIZATION_UNSUBSCRIBED"
}
```

### `403` (`application/json`)

ActorUnauthorizedError | UnauthorizedError | IdentityMismatchError | RequestedOrganizationError

Schema: `ActorUnauthorizedError | UnauthorizedError | IdentityMismatchError | ...`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `$ (ActorUnauthorizedError)._tag` | `string` | Yes |  |
| `$ (UnauthorizedError)._tag` | `string` | Yes |  |
| `$ (UnauthorizedError).entity` | `string` | Yes |  |
| `$ (UnauthorizedError).action` | `string` | Yes |  |
| `$ (IdentityMismatchError)._tag` | `string` | Yes |  |
| `$ (RequestedOrganizationError)._tag` | `string` | Yes |  |
| `$ (RequestedOrganizationError).reason` | `string \| null` | Yes |  |

Example:

```json
{
  "_tag": "ActorUnauthorizedError"
}
```

### `404` (`application/json`)

SessionNotFoundError

Schema: `SessionNotFoundError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |
| `id` | `string` | Yes | TypeID with prefix "asess_". |

Example:

```json
{
  "_tag": "SessionNotFoundError",
  "id": "asess_01jd8z3k5q0b6f2m4r7t9v1x3c"
}
```

### `410` (`application/json`)

SessionRuntimeGoneError

Schema: `SessionRuntimeGoneError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |
| `id` | `string` | Yes | TypeID with prefix "asess_". |

Example:

```json
{
  "_tag": "SessionRuntimeGoneError",
  "id": "asess_01jd8z3k5q0b6f2m4r7t9v1x3c"
}
```

### `429` (`application/json`)

RateLimitExceededError

Schema: `RateLimitExceededError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |
| `resource` | `string` | Yes | Rate-limited resource bucket the request was counted against. |
| `retryAfter` | `number` | Yes |  |

Example:

```json
{
  "_tag": "RateLimitExceededError",
  "resource": "string",
  "retryAfter": 1
}
```

### `500` (`application/json`)

InternalError

Schema: `InternalError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |

Example:

```json
{
  "_tag": "InternalError"
}
```

### `502` (`application/json`)

ActorActionError

Schema: `ActorActionError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |
| `code` | `string` | Yes |  |
| `acceptedEvents` | `integer` | No |  |
| `totalEvents` | `integer` | No |  |

Example:

```json
{
  "_tag": "ActorActionError",
  "code": "string",
  "acceptedEvents": -9007199254740991,
  "totalEvents": -9007199254740991
}
```

### `503` (`application/json`)

ActorUnavailableError

Schema: `ActorUnavailableError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `_tag` | `string` | Yes |  |

Example:

```json
{
  "_tag": "ActorUnavailableError"
}
```

## Example Request

### cURL

```bash
curl -X GET 'https://api.thecompany.company/v1/sessions/{id}/threads' \
  -H 'Authorization: Bearer <TOKEN>'
```

### TypeScript

```typescript
const response = await fetch('https://api.thecompany.company/v1/sessions/{id}/threads', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
  },
});
if (!response.ok) {
  throw new Error('HTTP ' + response.status);
}
const data = await response.json();
```
