---
title: "List sessions"
description: "Returns unarchived sessions for the current organization, optionally filtered by name, parent, or lifecycle state."
url: "https://www.thecompany.company/docs/api/sessions/list"
---

# List sessions

> Returns unarchived sessions for the current organization, optionally filtered by name, parent, or lifecycle state.

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

## Parameters

| Name | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `search` | `query` | `string` | No |  |
| `parentId` | `query` | `string \| null` | No |  |
| `ancestorId` | `query` | `string \| null` | No |  |
| `status` | `query` | `string \| null` | No |  |
| `archived` | `query` | `string \| null` | No |  |
| `mineShared` | `query` | `string \| null` | No |  |
| `usedSince` | `query` | `string` | No |  |
| `after` | `query` | `string` | No |  |
| `limit` | `query` | `string` | No |  |

## Responses

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

Success

Schema: `object`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | `array<Session>` | Yes |  |
| `data[].id` | `string` | Yes | Unique session identifier |
| `data[].organizationId` | `string` | Yes | Organization this session belongs to |
| `data[].teamId` | `string \| null` | Yes | Team this session belongs to |
| `data[].createdBy` | `string \| null` | No |  |
| `data[].status` | `string` | Yes | Runtime status of the session. `provisioning` means setup is in flight, `idle` means no turn is running, `working` means a turn is in flight, and `failed` means provisioning failed terminally. Lifecycle (archive/restore) is signaled by archivedAt, not status. |
| `data[].type` | `string` | Yes | Immutable session kind assigned at creation. |
| `data[].statusDetail` | `SessionStatusDetail \| null` | No | Who or what unblocks an idle session (`user`, `session` or `event`; absent when nothing is awaited), an open-text kind refining it (`question`, `plan-review`, `approval`, `reply`, `done`, `error`, ...), and a short user-facing label. `error` marks a recoverable root-turn failure while the coarse runtime status remains idle; `failed` is reserved for terminal runtime failure. Readers must tolerate unknown kinds: the closed `waitingOn` bucket alone decides attention treatment. |
| `data[].statusDetail.waitingOn` | `string` | No |  |
| `data[].statusDetail.kind` | `string` | No |  |
| `data[].statusDetail.label` | `string` | No |  |
| `data[].archivedAt` | `string \| null` | Yes | When the session was archived, or null if not archived |
| `data[].machineId` | `string \| null` | No | Explicitly borrowed machine, when attached to an existing workspace. Null does not mean the session has no machine: owned, forked and inherited machines are resolved separately. Read GET /v1/sessions/{id}/machine/info for caller-visible stored effective machine metadata, not live guest liveness. |
| `data[].forkedFrom` | `object \| null` | No |  |
| `data[].forkedFrom.sessionId` | `string` | Yes | TypeID with prefix "asess_". |
| `data[].forkedFrom.messageId` | `integer` | Yes |  |
| `data[].forkedFrom.machine` | `string \| object` | No | 'shared' (default) uses the parent's effective machine. 'fork' copies that machine, including its filesystem, memory, and running processes; the parent pauses briefly. { machineId } uses that existing machine without copying it; its owning session must be writable, unarchived, and not failed. The child inherits that session’s environment and repositories; it is private if either session is private. |
| `data[].forkedFrom.machine (object).machineId` | `string` | Yes | TypeID with prefix "mach_". |
| `data[].projectId` | `string \| null` | No | TypeID with prefix "proj_". |
| `data[].environmentId` | `string \| null` | No | TypeID with prefix "env_". |
| `data[].parentSessionId` | `string \| null` | No | TypeID with prefix "asess_". |
| `data[].name` | `string` | Yes | Human-readable display name for the session |
| `data[].isMineOrShared` | `boolean` | No | Whether the current viewer created this session or is in its collaborator roster. Browsing classification only, not an access grant. |
| `data[].visibility` | `string` | No |  |
| `data[].createdAt` | `string` | Yes |  |
| `data[].updatedAt` | `string` | Yes |  |
| `data[].lastRepliedAt` | `string \| null` | No |  |
| `data[].lastUsedAt` | `string` | Yes |  |
| `data[].lastActivityAt` | `string \| null` | No |  |
| `data[].tagIds` | `array<string>` | No | Ids of the tags applied to this item, in ascending id order. Resolve names and colors from the organization's tag list (`GET /v1/tags`). |
| `data[].pullRequestIds` | `array<string>` | No |  |
| `data[].collaborators` | `array<SessionItemCollaborator>` | No |  |
| `data[].collaborators[].userId` | `string` | Yes | TypeID with prefix "user_". |
| `data[].collaborators[].lastActiveAt` | `string` | Yes |  |
| `data[].repositories` | `array<SessionItemRepository>` | No |  |
| `data[].repositories[].repositoryId` | `string` | Yes | TypeID with prefix "repo_". |
| `data[].repositories[].provider` | `string` | Yes | Git provider the repository is mirrored from. |
| `data[].repositories[].owner` | `string` | Yes |  |
| `data[].repositories[].name` | `string` | Yes |  |
| `data[].slackChannels` | `array<SessionItemSlackChannel>` | No |  |
| `data[].slackChannels[].id` | `string` | Yes | TypeID with prefix "cthr_". |
| `data[].slackChannels[].channelId` | `string \| null` | Yes |  |
| `data[].slackChannels[].threadTs` | `string \| null` | Yes |  |
| `data[].slackChannels[].slackTeamId` | `string \| null` | Yes |  |
| `data[].slackChannels[].muted` | `boolean` | Yes |  |
| `data[].machine` | `SessionItemMachine \| null` | No |  |
| `data[].machine.id` | `string` | Yes | TypeID with prefix "mach_". |
| `data[].machine.sessionId` | `string` | Yes | TypeID with prefix "asess_". |
| `data[].machine.status` | `string` | Yes | Provider compute lifecycle for a session machine. `pending` means no attachable compute exists yet, `active` means the provider confirmed attachable compute, and `error` means provisioning failed. |
| `data[].machine.statusDetail` | `string` | Yes | Workspace-setup detail layered over `status`. `provisioning` until attachable compute exists, `preparing` while repository setup runs in the background (file transfer already works), `ready` when setup settled and agent tools may run (a failed setup script still settles ready — the failure is delivered as a session notice and mirrored in `lastError`), `error` when provisioning failed fatally. |
| `data[].machine.ownerArchived` | `boolean` | No |  |
| `data[].machine.expiresAt` | `string \| null` | Yes |  |
| `data[].machine.lastError` | `string \| null` | Yes |  |
| `firstId` | `string \| null` | Yes | ID of the first item in this page |
| `lastId` | `string \| null` | Yes | ID of the last item (use as cursor for next page) |
| `hasMore` | `boolean` | Yes | Whether more items exist after this page |

Example:

```json
{
  "data": [
    {
      "id": "string",
      "organizationId": "string",
      "teamId": "string",
      "createdBy": "string",
      "status": "pending",
      "type": "default",
      "statusDetail": {
        "waitingOn": "user",
        "kind": "string",
        "label": "string"
      },
      "archivedAt": "string",
      "machineId": "string",
      "forkedFrom": {
        "sessionId": "asess_01jd8z3k5q0b6f2m4r7t9v1x3c",
        "messageId": 0,
        "machine": "shared"
      },
      "projectId": "proj_01jd8z3k5q0b6f2m4r7t9v1x3c",
      "environmentId": "env_01jd8z3k5q0b6f2m4r7t9v1x3c",
      "parentSessionId": "asess_01jd8z3k5q0b6f2m4r7t9v1x3c",
      "name": "Ship the new dashboard",
      "isMineOrShared": true,
      "visibility": "private",
      "createdAt": "string",
      "updatedAt": "string",
      "lastRepliedAt": "string",
      "lastUsedAt": "string",
      "lastActivityAt": "string",
      "tagIds": [
        "stag_01jd8z3k5q0b6f2m4r7t9v1x3c"
      ],
      "pullRequestIds": [
        "pr_01jd8z3k5q0b6f2m4r7t9v1x3c"
      ],
      "collaborators": [
        {
          "userId": "user_01jd8z3k5q0b6f2m4r7t9v1x3c",
          "lastActiveAt": "string"
        }
      ]
    }
  ],
  "firstId": "string",
  "lastId": "string",
  "hasMore": true
}
```

### `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`)

UnauthorizedError | IdentityMismatchError | RequestedOrganizationError

Schema: `UnauthorizedError | IdentityMismatchError | RequestedOrganizationError`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `$ (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": "UnauthorizedError",
  "entity": "string",
  "action": "string"
}
```

### `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"
}
```

## Example Request

### cURL

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

### TypeScript

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