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

# 4casters Streaming API

The 4casters streaming API delivers real-time user and market updates over a raw WebSocket connection.

## Endpoints

* **User feed**: `wss://streaming-api.4casters.io/v2/user`
* **Price feed**: `wss://streaming-api.4casters.io/price-stream`

The price feed broadcasts all market updates by default. Clients can optionally narrow the stream to specific games, leagues, or sports — see [Subscriptions](/pages/streaming/price-feed#subscriptions).

## Auth

Both feeds authenticate with a 4Casters token. Send the token in the
`Authorization` header on the WebSocket handshake. The server derives the user
from the token — **no username in the URL**.

### Get a token

Log in with your 4Casters username and password by calling the `/user/login`
endpoint of the 4Casters REST API. The response includes a token you can use
here.

See [`POST /user/login` in the 4Casters REST API docs](/pages/rest/authentication).

### Connect

<CodeGroup>
  ```javascript JavaScript theme={null}
  const WebSocket = require('ws');
  const token = process.env.FOURCASTERS_TOKEN;
  const ws = new WebSocket('wss://streaming-api.4casters.io/v2/user', {
    headers: { Authorization: token },
  });
  ```
</CodeGroup>
