# Open an interactive WebSocket terminal session.

`GET /v1/processes/{id}/terminal/ws`

Upgrades the connection to a WebSocket for bidirectional PTY I/O. Accepts
`access_token` query param for browser-based auth (WebSocket API cannot
send custom headers). Streams raw PTY output as binary frames and accepts
JSON control frames for input, resize, and close.

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `id` | path | Yes | string | Process ID |
| `access_token` | query | No | string | Bearer token alternative for WS auth |

### Parameter schemas

```json
[
  {
    "name": "id",
    "in": "path",
    "description": "Process ID",
    "required": true,
    "schema": {
      "type": "string"
    }
  },
  {
    "name": "access_token",
    "in": "query",
    "description": "Bearer token alternative for WS auth",
    "required": false,
    "schema": {
      "type": "string",
      "nullable": true
    }
  }
]
```

## Responses

### 101

WebSocket upgraded

### 400

Invalid websocket frame or upgrade request

Content type: `application/json`

```json
{
  "schema": {
    "$ref": "#/components/schemas/ProblemDetails"
  }
}
```

Related schemas: [ProblemDetails](/sandbox-agent/docs/api-reference/schemas/problemdetails/).

### 404

Unknown process

Content type: `application/json`

```json
{
  "schema": {
    "$ref": "#/components/schemas/ProblemDetails"
  }
}
```

Related schemas: [ProblemDetails](/sandbox-agent/docs/api-reference/schemas/problemdetails/).

### 409

Not a terminal process

Content type: `application/json`

```json
{
  "schema": {
    "$ref": "#/components/schemas/ProblemDetails"
  }
}
```

Related schemas: [ProblemDetails](/sandbox-agent/docs/api-reference/schemas/problemdetails/).

### 501

Process API unsupported on this platform

Content type: `application/json`

```json
{
  "schema": {
    "$ref": "#/components/schemas/ProblemDetails"
  }
}
```

Related schemas: [ProblemDetails](/sandbox-agent/docs/api-reference/schemas/problemdetails/).
