---
title: "Mint a live WebSocket ticket for a work session"
---

> 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.

# Mint a live WebSocket ticket for a work session

Path: CloudRaker Workspace API › Workspace Sessions

`POST /workspace/sessions/{sessionId}/ws-ticket`

Mints a single-use, 60-second ticket for `GET /workspace/sessions/{sessionId}/ws` (the upgrade itself is not an API operation — a browser socket cannot carry a bearer, so the ticket IS the capability). **Authorization:** `work_session:read` on the session, OR `space:contribute` on one of its linked spaces; a desk session only for its owner. Any denial is 404. The ticket carries a capability view: `full` when the caller could also WRITE the session, otherwise `sanitized`, and only full sockets receive live frames. A read-only principal is one holding `work_session:read` without `work_session:comment` — the `work-session-viewer` role; participants, owners and space contributors all read `full`. The SAME view is applied to the HTTP reads (`/entries`, `/turns`, `/artifacts`), so the fallback path can never hand back what the socket withheld. The socket’s opening replay frame carries at most the LAST 200 entries, so a client that needs an older timeline pages `GET /workspace/sessions/{sessionId}/entries` with `afterSeq` and treats the socket as the live tail.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `sessionId` (`mintWorkspaceSessionWsTicket.path.sessionId`; string, required)

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.cloudraker.com/workspace/sessions/<sessionId>/ws-ticket' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/workspace/sessions/<sessionId>/ws-ticket';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

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

### Python

```python
import requests

url = "https://api.cloudraker.com/workspace/sessions/<sessionId>/ws-ticket"

headers = {"Authorization": "Bearer <token>"}

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

print(response.text)
```

## Responses

### 200

A ticket and its expiry.

#### Example

```json
{
  "ticket": "string",
  "expiresAt": "string"
}
```

- `ticket` (`mintWorkspaceSessionWsTicket.response.200.ticket`; string, required)
- `expiresAt` (`mintWorkspaceSessionWsTicket.response.200.expiresAt`; string, required)

### 404

No such session, or the caller may not see it.


Source: https://docs.cloudraker.com/workspace/api/workspace-sessions/mint-workspace-session-ws-ticket/index.md
