---
title: "Get session"
description: "Retrieves a session by its unique identifier. machineId is only an explicit borrowed-machine pin, not an inventory of owned or inherited machines. Use GET /v1/sessions/{id}/machine/info to read caller-visible stored effective machine metadata without provisioning or waking a machine; a null binding there does not prove guest absence."
url: "https://www.thecompany.company/docs/api/sessions/get"
---

# Get session

> Retrieves a session by its unique identifier. machineId is only an explicit borrowed-machine pin, not an inventory of owned or inherited machines. Use GET /v1/sessions/{id}/machine/info to read caller-visible stored effective machine metadata without provisioning or waking a machine; a null binding there does not prove guest absence.

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

## Parameters

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

## Responses

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

An agent session

Schema: `Session`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | Unique session identifier |
| `organizationId` | `string` | Yes | Organization this session belongs to |
| `teamId` | `string \| null` | Yes | Team this session belongs to |
| `createdBy` | `string \| null` | No |  |
| `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. |
| `type` | `string` | Yes | Immutable session kind assigned at creation. |
| `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. |
| `statusDetail.waitingOn` | `string` | No |  |
| `statusDetail.kind` | `string` | No |  |
| `statusDetail.label` | `string` | No |  |
| `archivedAt` | `string \| null` | Yes | When the session was archived, or null if not archived |
| `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. |
| `forkedFrom` | `object \| null` | No |  |
| `forkedFrom.sessionId` | `string` | Yes | TypeID with prefix "asess_". |
| `forkedFrom.messageId` | `integer` | Yes |  |
| `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. |
| `forkedFrom.machine (object).machineId` | `string` | Yes | TypeID with prefix "mach_". |
| `projectId` | `string \| null` | No | TypeID with prefix "proj_". |
| `environmentId` | `string \| null` | No | TypeID with prefix "env_". |
| `parentSessionId` | `string \| null` | No | TypeID with prefix "asess_". |
| `name` | `string` | Yes | Human-readable display name for the session |
| `isMineOrShared` | `boolean` | No | Whether the current viewer created this session or is in its collaborator roster. Browsing classification only, not an access grant. |
| `visibility` | `string` | No |  |
| `createdAt` | `string` | Yes |  |
| `updatedAt` | `string` | Yes |  |
| `lastRepliedAt` | `string \| null` | No |  |
| `lastUsedAt` | `string` | Yes |  |
| `lastActivityAt` | `string \| null` | No |  |
| `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`). |
| `pullRequestIds` | `array<string>` | No |  |
| `collaborators` | `array<SessionItemCollaborator>` | No |  |
| `collaborators[].userId` | `string` | Yes | TypeID with prefix "user_". |
| `collaborators[].lastActiveAt` | `string` | Yes |  |
| `repositories` | `array<SessionItemRepository>` | No |  |
| `repositories[].repositoryId` | `string` | Yes | TypeID with prefix "repo_". |
| `repositories[].provider` | `string` | Yes | Git provider the repository is mirrored from. |
| `repositories[].owner` | `string` | Yes |  |
| `repositories[].name` | `string` | Yes |  |
| `slackChannels` | `array<SessionItemSlackChannel>` | No |  |
| `slackChannels[].id` | `string` | Yes | TypeID with prefix "cthr_". |
| `slackChannels[].channelId` | `string \| null` | Yes |  |
| `slackChannels[].threadTs` | `string \| null` | Yes |  |
| `slackChannels[].slackTeamId` | `string \| null` | Yes |  |
| `slackChannels[].muted` | `boolean` | Yes |  |
| `machine` | `SessionItemMachine \| null` | No |  |
| `machine.id` | `string` | Yes | TypeID with prefix "mach_". |
| `machine.sessionId` | `string` | Yes | TypeID with prefix "asess_". |
| `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. |
| `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. |
| `machine.ownerArchived` | `boolean` | No |  |
| `machine.expiresAt` | `string \| null` | Yes |  |
| `machine.lastError` | `string \| null` | Yes |  |

Example:

```json
{
  "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"
    }
  ]
}
```

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

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

### `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/{id}' \
  -H 'Authorization: Bearer <TOKEN>'
```

### TypeScript

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