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

# WebSocket API Overview

> Stream Hyperliquid HyperCore order books and account activity in real time over one Uniblock connection — no per-IP subscription cap.

Uniblock's Hyperliquid WebSocket gives you real-time access to **HyperCore** data — the native order book, perpetuals, and account event streams — over a single connection authenticated with your Uniblock API key. Because HyperCore isn't a permissionless chain you can run a node for (see [HyperCore vs. HyperEVM](/guides/quickstart-guides/hypercore-vs-hyperevm)), a WebSocket is the way to get live order book data — and routing through Uniblock lifts the public API's **1000-subscription-per-IP** cap.

<Info>
  Streaming is billed in compute units per active subscription per minute. Grab
  your API key from the [Uniblock dashboard](https://dashboard.uniblock.dev).
</Info>

## Endpoint

```plaintext theme={null}
wss://websocket.uniblock.dev/goldrush
```

A single fixed endpoint — no `chainId` query parameter is required.

## Authentication

Two ways to authenticate the connection and validation requests:

1. **Header** — include `X-API-KEY: YOUR_API_KEY` in your request headers (recommended).
2. **URL query parameter** — append `apiKey=YOUR_API_KEY` to the connection string.

<Note>
  Header authentication is recommended to avoid exposing your API key in URLs,
  server logs, or browser history.
</Note>

You can confirm your credentials before opening a stream:

```bash theme={null}
curl --location 'https://websocket.uniblock.dev/goldrush/validate' \
  --header 'X-API-KEY: YOUR_API_KEY'
```

## Subscribe and unsubscribe

Once connected, send a JSON `subscribe` message. Each message targets a subscription `type`, and most types accept an optional `coin` filter.

```json theme={null}
{
  "method": "subscribe",
  "subscription": { "type": "l2BookDiff", "coin": "HYPE" }
}
```

* `coin` accepts a single asset (`"HYPE"`) or an array (`["HYPE", "BTC"]`).
* Omitting `coin` streams **all** assets (wildcard) for the types that support it — billed at a much higher per-minute rate.

Stop a stream by sending the matching `unsubscribe` message with the **exact** same subscription body. Billing for that subscription stops as soon as it's removed.

```json theme={null}
{
  "method": "unsubscribe",
  "subscription": { "type": "l2BookDiff", "coin": "HYPE" }
}
```

## Available channels

### Order book streams

| `type`       | Description                                                                                                                                                                                 |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `l2Book`     | Real-time L2 order book snapshots and updates — bids and asks aggregated by significant figures. `coin` optional; omit to stream all assets.                                                |
| `l2BookDiff` | GoldRush-native: an initial snapshot per coin plus per-block updates carrying only the price/size/count levels that changed. Lighter than `l2Book`.                                         |
| `l4Book`     | GoldRush-native order-level book — snapshots plus per-block updates exposing user, order ID, client order ID, time-in-force, and trigger metadata. Requires a specific `coin`; no wildcard. |

### Wallet & account activity streams

| `type`                        | Description                                                                              |
| ----------------------------- | ---------------------------------------------------------------------------------------- |
| `userFills`                   | Live trade fills for specified wallets, batched per block.                               |
| `orderUpdates`                | Order lifecycle events (placements, fills, cancels, rejections) for monitored addresses. |
| `liquidationFills`            | Global liquidation stream (GoldRush-native).                                             |
| `allFills`                    | Complete global fill stream, with optional single-market filtering.                      |
| `builderFills`                | Attributed fills for builder addresses, with builder-fee data.                           |
| `userNonFundingLedgerUpdates` | Non-funding ledger events such as deposits and withdrawals.                              |

## Connection & rate limits

Unlike the public Hyperliquid WebSocket's 1000-subscription-per-IP cap, Uniblock imposes **no subscription limit**. Wildcard subscriptions default to perpetual markets only; specify `marketTypes` (`["spot"]`, `["*"]`, …) to widen coverage on the types that support it.

## Pricing

Streaming bills **credits per minute** for each active subscription, converted to compute units at **5,000 CU per credit**. Charges accrue for as long as a subscription stays open.

| Subscription                                                                                               | Credits / min | CU / min |
| ---------------------------------------------------------------------------------------------------------- | ------------- | -------- |
| `l2Book` (per coin)                                                                                        | 0.5           | 2,500    |
| `l2Book` (all assets)                                                                                      | 50            | 250,000  |
| `l2BookDiff` (per coin)                                                                                    | 0.1           | 500      |
| `l2BookDiff` (all assets)                                                                                  | 10            | 50,000   |
| `l4Book` (per coin)                                                                                        | 2             | 10,000   |
| `l4Book` (`BTC`)                                                                                           | 20            | 100,000  |
| `userFills`, `orderUpdates`, `liquidationFills`, `allFills`, `builderFills`, `userNonFundingLedgerUpdates` | 1             | 5,000    |

## Best practices

* **Security:** use the `X-API-KEY` header where possible to avoid exposing your key.
* **Keep-alive:** send a ping every 30–60 seconds to avoid idle timeouts.
* **Reconnect with backoff:** on disconnect, re-open and re-send your subscriptions using exponential backoff.
* **Scope your subscriptions:** subscribe per `coin` instead of the wildcard stream when you only need a handful of assets — it's dramatically cheaper.

## Build with the order book

<CardGroup cols={3}>
  <Card title="L2 Order Book" icon="layer-group" href="/guides/hyperliquid/websockets/l2-book">
    Self-contained aggregated snapshots — top-of-book quotes and depth analytics.
  </Card>

  <Card title="L2 Book Diff" icon="wave-square" href="/guides/hyperliquid/websockets/l2-book-diff">
    Snapshot plus per-block diffs — track live state with bandwidth proportional to changes.
  </Card>

  <Card title="L4 Order Book" icon="list-ol" href="/guides/hyperliquid/websockets/l4-book">
    Per-order flow with user, order ID, and trigger metadata for attribution.
  </Card>
</CardGroup>

## Resources

* [Connect & migrate](/guides/hyperliquid/websockets/connect) — connect and move off the public WebSocket.
* [GoldRush provider reference](/reference/websockets/providers/websockets-goldrush) — the provider page with the full type list and CU pricing.
* [Streaming Hyperliquid with WebSockets](/guides/quickstart-guides/hyperliquid-websocket-guide) — end-to-end usage guide.
