---
title: "Open the conversation WebSocket"
---

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

# Open the conversation WebSocket

Path: cloudraker.run API

`GET /_cv/{cv}/socket`

Upgrade to a WebSocket with a ticket from `POST /_cv/{cv}/ticket` in `ticket` and the subprotocol `run.cv.v1` only. Frames are `{ items: [...] }`. Close codes: 1000, 1011, 4001 (the socket passed its session expiry), 4004, 4008. The server spends the ticket before it checks the request, so a ticket in a request log is always spent. No upgrade, or a subprotocol other than `run.cv.v1` (such as a session token), gets 400. A spent, expired or other-conversation ticket gets 401, and a wrong origin gets 403, before the upgrade.

## Path parameters

- `cv` (`conversationSocket.path.cv`; string, required) — The conversation id (`cv_...`).

## Query parameters

- `ticket` (`conversationSocket.query.ticket`; string, required) — The one-time ticket from `POST /_cv/{cv}/ticket`.
- `after` (`conversationSocket.query.after`; integer, optional) — Replay the durable items after this `seq`.
  - default `0`

## Header parameters

- `Sec-WebSocket-Protocol` (`conversationSocket.header.Sec-WebSocket-Protocol`; string, required) — `run.cv.v1` only.

## Code samples

### cURL

```bash
curl --request GET \
  --url 'https://your-org.cloudraker.run/_cv/<cv>/socket?ticket=string' \
  --header 'Sec-WebSocket-Protocol: run.cv.v1'
```

### TypeScript

```typescript
const url = 'https://your-org.cloudraker.run/_cv/<cv>/socket?ticket=string';
const options = {method: 'GET', headers: {'Sec-WebSocket-Protocol': 'run.cv.v1'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://your-org.cloudraker.run/_cv/<cv>/socket?ticket=string"

headers = {"Sec-WebSocket-Protocol": "run.cv.v1"}

response = requests.get(url, headers=headers)

print(response.text)
```

## Responses

### 101

Switching protocols. The server echoes `run.cv.v1`.

### 400

Error. See the `code` table in the guides.

#### Example

```json
{
  "error": {
    "code": "run_busy",
    "message": "string",
    "run_id": "string",
    "details": null
  }
}
```

- `error` (`conversationSocket.response.400.error`; object, required)
  - `code` (`conversationSocket.response.400.error.code`; string, required)
    - example `"run_busy"`
  - `message` (`conversationSocket.response.400.error.message`; string, required)
  - `run_id` (`conversationSocket.response.400.error.run_id`; string, optional)
  - `details` (`conversationSocket.response.400.error.details`; unknown, optional)

### 401

Error. See the `code` table in the guides.

#### Example

```json
{
  "error": {
    "code": "run_busy",
    "message": "string",
    "run_id": "string",
    "details": null
  }
}
```

- `error` (`conversationSocket.response.401.error`; object, required)
  - `code` (`conversationSocket.response.401.error.code`; string, required)
    - example `"run_busy"`
  - `message` (`conversationSocket.response.401.error.message`; string, required)
  - `run_id` (`conversationSocket.response.401.error.run_id`; string, optional)
  - `details` (`conversationSocket.response.401.error.details`; unknown, optional)

### 403

Error. See the `code` table in the guides.

#### Example

```json
{
  "error": {
    "code": "run_busy",
    "message": "string",
    "run_id": "string",
    "details": null
  }
}
```

- `error` (`conversationSocket.response.403.error`; object, required)
  - `code` (`conversationSocket.response.403.error.code`; string, required)
    - example `"run_busy"`
  - `message` (`conversationSocket.response.403.error.message`; string, required)
  - `run_id` (`conversationSocket.response.403.error.run_id`; string, optional)
  - `details` (`conversationSocket.response.403.error.details`; unknown, optional)


Source: https://docs.cloudraker.com/run/api/conversation-socket/index.md
