---
title: "Markets WebSocket: stream real-time market price updates"
method: GET
path: "/api/v2/ws/markets"
tags: ["V2 WebSocket"]
---

# Markets WebSocket: stream real-time market price updates

`GET /api/v2/ws/markets`

## Request

- Base URL: `https://therundown.io`
- URL: `https://therundown.io/api/v2/ws/markets`
- Auth: API key in header `X-TheRundown-Key`

Establishes a WebSocket connection for streaming V2 market price changes in real-time.

**Connection**: `wss://therundown.io/api/v2/ws/markets`

Authenticate the WebSocket upgrade with `X-TheRundown-Key: $THERUNDOWN_API_KEY`
from a server-side client. Native browser WebSocket clients cannot set custom
headers; use an authenticated backend relay for browser consumers. WebSocket
access requires an Ultra plan or higher.

**Filter parameters** (query string):
- `affiliate_ids`: comma-separated affiliate IDs
- `sport_ids`: comma-separated sport IDs
- `event_ids`: comma-separated event IDs
- `market_ids`: comma-separated market IDs

All filters are optional. If none are specified, all messages are received.

**Heartbeat**: Server sends `{"meta":{"type":"heartbeat"},"data":{"now":"<RFC3339>"}}` every 15 seconds.

**Message format**:
```json
{
  "meta": {...},
  "data": {
    "affiliate_id": 19,
    "sport_id": 4,
    "event_id": "abc123",
    "market_id": 1,
    ...
  }
}
```

**Queue**: 1024-message buffer per client. If the client falls behind, messages are dropped.

## Query parameters

- `affiliate_ids` string
- `sport_ids` string
- `event_ids` string
- `market_ids` string

## Other responses

- `101`: WebSocket upgrade successful

---

[API](https://skmtc.dev/therundown/apis/therundown-sports-api.md) - [All operations](https://skmtc.dev/therundown/apis/therundown-sports-api/llms.txt) - [OpenAPI document](https://skmtc.dev/therundown/apis/therundown-sports-api/revisions/d399d1f515db?raw)
