> TickerLayer documentation for AI agents and LLMs, the Markdown version of https://tickerlayer.com/docs/websocket/authentication
> REST base URL https://api.tickerlayer.com, API key in the `x-api-key` header. WebSocket wss://stream.tickerlayer.com?apiKey=YOUR_API_KEY.
> Any docs page reads as Markdown at its URL plus `.md`. Index: https://tickerlayer.com/llms.txt · Full API reference: https://tickerlayer.com/llms-full.txt

# Authentication

Unlike REST, the public WebSocket does not read x-api-key headers on data frames. Authentication happens exactly once during the HTTP upgrade.

## How it works

Pass your raw API key as the `apiKey` query parameter on the upgrade URL. The server checks it for the `ws` surface before completing the `101` handshake. This is native WebSocket: no Socket.IO namespace, no handshake object and no in-frame authentication step.

**Connect URL**

```
wss://stream.tickerlayer.com/?apiKey=<YOUR_API_KEY>
```

Case-sensitive parameter name

It must be exactly `apiKey`. Other spellings such as `api_key` or `APIKEY` are rejected with `401` before the upgrade completes.

To try a live connection without pasting your key into the page, use the [WebSocket overview](https://tickerlayer.com/docs/websocket#try-live).

## Compared to REST

| Surface | Key goes in | Also accepted |
| --- | --- | --- |
| REST | `x-api-key` header | `?apiKey=` query parameter, for compatibility |
| WebSocket | `?apiKey=` on the upgrade URL | Nothing else: headers on later frames are not read |

## Auth errors

| Status | Meaning |
| --- | --- |
| `401` | Invalid or missing `apiKey`, or a key not entitled for WebSocket. The upgrade is rejected and no frames are sent. |
| `403` | The key exists but the `ws` surface is not enabled for this account tier. |
