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

# perpSnapshots | Hyperliquid Info API

> Hyperliquid perpSnapshots: fetch every open perp position on Hyperliquid, with entry and liquidation prices, for liquidation maps and whale trackers.

> [card] Credit Cost
>
> 250 per call

> [card] Processing
>
> Batch

The Hyperliquid info endpoint with `type: "perpSnapshots"` is used to fetch every open perp position on Hyperliquid, with entry and liquidation prices, for liquidation maps and whale trackers.

> [!TIP]
>
> Estimate your monthly cost for this API using the [Pricing Calculator](https://goldrush.dev/docs/pricing-calculator.md?endpoint=%2Fapi-reference%2Fhyperliquid-info%2Fperp-snapshots).

> [!NOTE]
>
> * GoldRush-native. `perpSnapshots` is not a `POST api.hyperliquid.xyz/info` method. The public API only answers one wallet at a time (`clearinghouseState`), so you have to know the wallets in advance.
> * Compatible with existing `perpSnapshots` clients. The request body and the zstd/MessagePack wire format follow the standard `perpSnapshots` format, so a client that already speaks it works after you change its base URL and key.
> * Whole exchange, every dex. All wallets, all native perps and all HIP-3 dexes. A typical snapshot holds about 380,000 positions across about 360 markets and 125,000 wallets.
> * Computed from the node's own state. Each snapshot is read from the exchange state that a Hyperliquid node writes every 10,000 blocks (about every 12 minutes). Values follow Hyperliquid's margin rules and were checked against `clearinghouseState` for the same wallets.
> * Rate limited per key: 5 calls per 10 minutes. Poll the free [perpSnapshotTimestamp](https://goldrush.dev/docs/api-reference/hyperliquid-info/perp-snapshot-timestamp.md) and download only when `snapshot_id` changes. 250 credits per call, however many markets it returns.

Returns every open perpetual position on Hyperliquid for the markets you ask for: one row per wallet and market, with signed size, USD notional, funding since open, entry price, cross or isolated margin, leverage, liquidation price and the wallet's account value. One call covers a single coin, a whole HIP-3 dex, or the entire exchange (`"ALL:ALL_DEXES"`). Use it to find the biggest longs and shorts on a market, map where liquidations cluster, measure long/short positioning by wallet, or diff positioning between two snapshots.

## Endpoint

```
POST https://hypercore.goldrushdata.com/info
Authorization: Bearer <GOLDRUSH_API_KEY>
Content-Type: application/json
```

## Request

**type** `string` *required* (default: perpSnapshots)

Always `"perpSnapshots"`.

**market\_names** `string[]` *required*

1 to 256 market selectors. Each entry is one of:

| Entry | Selects |
| - | - |
| `"BTC"` | one market on the native dex |
| `"xyz:NVDA"` | one market on HIP-3 dex `xyz` |
| `"ALL"` | every market on the native dex |
| `"ALL:xyz"` | every market on HIP-3 dex `xyz` |
| `"ALL:ALL_DEXES"` | every market on every dex (overrides every other entry) |

Market names are case-sensitive, like Hyperliquid coins. A dex name is 1 to 64 characters from `A-Z a-z 0-9 _`; a market name is 1 to 64 characters from `A-Z a-z 0-9 _ . / -`.

**format** `string` (default: msgpack)

`"msgpack"` (default, the standard binary `perpSnapshots` format) or `"json"`. `json` returns the same data as JSON for **at most 5 resolved markets**. It is a GoldRush extension, handy for quick checks and small dashboards.

### How `market_names` is resolved

* `ALL` patterns expand to the markets **present in the snapshot**, that is, markets with at least one open position.
* A single market already covered by an `ALL` pattern for its dex is dropped, and duplicates are dropped.
* A single market with no open positions (or that doesn't exist) is **left out**, not an error.
* `ALL:<dex>` with a dex that isn't a Hyperliquid perp dex returns `400 unknown dex`. A real dex with no open positions resolves to zero markets.
* Markets come back in a fixed order: native-dex markets first, then HIP-3 dexes by dex name, with markets sorted by name within each dex. Two identical requests against the same snapshot return byte-identical bodies.

### Example

```bash cURL (JSON) theme={null}
curl -X POST https://hypercore.goldrushdata.com/info \
  -H "Authorization: Bearer $GOLDRUSH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "perpSnapshots",
    "market_names": ["BTC", "ETH", "HYPE"],
    "format": "json"
  }'
```

```bash cURL (msgpack, whole exchange) theme={null}
curl -X POST https://hypercore.goldrushdata.com/info \
  -H "Authorization: Bearer $GOLDRUSH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type": "perpSnapshots", "market_names": ["ALL:ALL_DEXES"]}' \
  -D headers.txt -o snapshot.bin
```

```python Python theme={null}
# pip install requests msgpack zstandard
import os, struct
import msgpack, requests, zstandard

URL = "https://hypercore.goldrushdata.com/info"
HEADERS = {"Authorization": f"Bearer {os.environ['GOLDRUSH_API_KEY']}"}
FIELDS = ["size", "notional_size", "funding_pnl", "entry_price",
          "leverage_type_flag", "leverage", "liquidation_price", "account_value"]
ZSTD_MAGIC = b"\x28\xb5\x2f\xfd"

def unzstd(chunk: bytes) -> bytes:
    # Some HTTP clients already undo `Content-Encoding: zstd`; only decompress real zstd frames.
    return zstandard.ZstdDecompressor().decompress(chunk) if chunk[:4] == ZSTD_MAGIC else chunk

def perp_snapshots(market_names):
    r = requests.post(URL, headers=HEADERS, json={"type": "perpSnapshots", "market_names": market_names})
    r.raise_for_status()
    body = r.content
    if r.headers.get("x-payload-format") == "multi-zstd":
        (count,), offset, chunks = struct.unpack_from("<I", body), 4, []
        for _ in range(count):
            (length,) = struct.unpack_from("<I", body, offset)
            chunks.append(body[offset + 4 : offset + 4 + length])
            offset += 4 + length
    else:  # x-payload-format: msgpack, one market
        chunks = [body]

    markets = {}
    for chunk in chunks:
        snapshot_id, market, positions, addresses = msgpack.unpackb(unzstd(chunk))
        markets[market] = [{"address": a, **dict(zip(FIELDS, p))} for a, p in zip(addresses, positions)]
    return r.headers["x-snapshot-id"], markets

snapshot_id, markets = perp_snapshots(["BTC", "ETH", "HYPE"])
biggest = sorted(markets["BTC"], key=lambda p: p["notional_size"], reverse=True)[:10]
for p in biggest:
    side = "LONG " if p["size"] > 0 else "SHORT"
    print(side, p["address"], f"${p['notional_size']:,.0f}", "liq", p["liquidation_price"])
```

```typescript TypeScript theme={null}
// npm i fzstd @msgpack/msgpack
import { decompress } from "fzstd";
import { decode } from "@msgpack/msgpack";

type Tuple = [number, number, number | null, number, 0 | 1 | null, number | null, number | null, number | null];
type Chunk = [snapshotId: string, market: string, positions: Tuple[], addresses: string[]];

const unzstd = (b: Uint8Array) =>
  // Some fetch implementations already undo `Content-Encoding: zstd`.
  b[0] === 0x28 && b[1] === 0xb5 && b[2] === 0x2f && b[3] === 0xfd ? decompress(b) : b;

async function perpSnapshots(marketNames: string[]) {
  const res = await fetch("https://hypercore.goldrushdata.com/info", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GOLDRUSH_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ type: "perpSnapshots", market_names: marketNames }),
  });
  if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
  const body = new Uint8Array(await res.arrayBuffer());

  const chunks: Uint8Array[] = [];
  if (res.headers.get("x-payload-format") === "multi-zstd") {
    const view = new DataView(body.buffer, body.byteOffset, body.byteLength);
    let offset = 4;
    for (let i = 0, n = view.getUint32(0, true); i < n; i++) {
      const len = view.getUint32(offset, true);
      chunks.push(body.subarray(offset + 4, offset + 4 + len));
      offset += 4 + len;
    }
  } else {
    chunks.push(body); // one market
  }

  return chunks.map((c) => {
    const [snapshotId, market, positions, addresses] = decode(unzstd(c)) as Chunk;
    return {
      snapshotId,
      market,
      positions: positions.map(([size, notional, fundingPnl, entryPx, levFlag, leverage, liqPx, accountValue], i) => ({
        address: addresses[i], size, notional, fundingPnl, entryPx,
        leverageType: levFlag === null ? null : levFlag === 0 ? "cross" : "isolated",
        leverage, liqPx, accountValue,
      })),
    };
  });
}

const [btc] = await perpSnapshots(["BTC"]);
console.log(btc.snapshotId, btc.positions.length, "open BTC positions");
```

## Response

The default response is **binary**, in the standard `perpSnapshots` format: zstd-compressed MessagePack, one chunk per market. A whole-exchange response (`["ALL:ALL_DEXES"]`) was 24.3 MB compressed on 2026-11-30 (388,681 positions on 357 markets), which is why the format is binary. Ask only for the markets you need.

Every `200` carries these headers:

| Header | Value |
| - | - |
| `x-snapshot-id` | the snapshot's `snapshot_id` |
| `x-snapshot-timestamp` | the snapshot's block time, epoch **seconds** |
| `Cache-Control` | `no-transform` |

### Framing

| Markets resolved | Headers | Body |
| - | - | - |
| exactly 1 | `Content-Type: application/octet-stream`, `x-payload-format: msgpack`, `Content-Encoding: zstd` | the market's chunk |
| 0, or 2 and more | `Content-Type: application/octet-stream`, `x-payload-format: multi-zstd`, `x-compression: inner-zstd` | `[count: u32][len_1: u32][chunk_1][len_2: u32][chunk_2]…`, every `u32` little-endian |

A request that resolves to zero markets returns `200` with a `multi-zstd` body whose `count` is `0`, and it is billed.

> [!WARNING]
>
> A one-market body can reach your client already decoded: plain MessagePack, with no `Content-Encoding` header. Many HTTP clients undo `Content-Encoding: zstd` themselves, and a proxy or CDN on the path can decode it when the request doesn't accept zstd (it was recorded with `Accept-Encoding: identity`). Check for the zstd magic bytes (`28 b5 2f fd`) before decompressing, as the examples above do. Chunks inside a `multi-zstd` body are always zstd frames.

### Market chunk

Each chunk is one zstd frame. Decompressed, it is a MessagePack array:

```
[snapshot_id: str, market: str, positions: [position_tuple], addresses: [str]]
```

* `addresses[i]` owns `positions[i]`. The two arrays have the same length, one entry per wallet with a non-zero position in `market`.
* `market` is written as in the request (`"BTC"`, `"xyz:NVDA"`).
* Addresses are lowercase, and rows are sorted by address ascending.

### Position tuple

A fixed 8-element MessagePack array, in this order:

**\[0] size** `float64`

Signed position size in coin units: positive is long, negative is short. Never `0`.

**\[1] notional\_size** `float64`

USD notional, `abs(size) × mark price` at snapshot time. Always `≥ 0`.

**\[2] funding\_pnl** `float64 | nil`

USD funding since the position opened. **Received is positive**, paid is negative.

**\[3] entry\_price** `float64`

USD entry price.

**\[4] leverage\_type\_flag** `uint | nil`

`0` cross, `1` isolated.

**\[5] leverage** `uint | nil`

Integer leverage, e.g. `20`.

**\[6] liquidation\_price** `float64 | nil`

USD price at which the position is liquidated. For unified and portfolio-margin accounts it accounts for cross-collateral. `nil` when there is none (the position is over-collateralised).

**\[7] account\_value** `float64 | nil`

USD account value of the wallet. For unified and portfolio-margin accounts it is the collateral pool shared with spot.

### JSON response (`format: "json"`)

The same data as JSON, for at most 5 markets, with `Content-Type: application/json`. `leverage_type` is spelled out (`"cross"` / `"isolated"`), and `nil` becomes `null`.

```json theme={null}
{
  "snapshot_id": "20261130_state_1240000000",
  "timestamp": 1796031360,
  "markets": [
    {
      "market": "HYPE",
      "positions": [
        {
          "address": "0x0000000000000000000000000000000000000001",
          "size": -1200.5,
          "notional_size": 52000.1,
          "funding_pnl": -312.4,
          "entry_price": 41.2,
          "leverage_type": "cross",
          "leverage": 10,
          "liquidation_price": 58.9,
          "account_value": 250000.0
        }
      ]
    }
  ]
}
```

**snapshot\_id** `string`

Opaque id of the snapshot, `YYYYMMDD_state_<block height>`. Compare it for equality only.

**timestamp** `int`

Block time of the snapshot, epoch **seconds**.

**markets** `array`

One entry per resolved market, in the order described above, each `{market, positions}`. `positions` fields match the tuple above, with `address` added and `leverage_type_flag` renamed `leverage_type`.

## Freshness

A new snapshot is captured every 10,000 HyperCore blocks, **about every 12 minutes**, and is served a minute or two later. GoldRush never serves positions older than **15 minutes**: if the newest snapshot is older than that, the call returns `503 snapshot_stale` with `Retry-After` instead of old data.

To stay current at the lowest cost, poll [`perpSnapshotTimestamp`](https://goldrush.dev/docs/api-reference/hyperliquid-info/perp-snapshot-timestamp/) every 5 to 10 seconds (0 credits) and call `perpSnapshots` only when its `snapshot_id` changes. Snapshots are point-in-time: for live, per-event position changes on a known set of wallets, use the WebSocket [`userFills`](https://goldrush.dev/docs/api-reference/hyperliquid-websocket/user-fills/) stream or [`batchClearinghouseState`](https://goldrush.dev/docs/api-reference/hyperliquid-info/batch-clearinghouse-state/).

## Limits, errors and billing

* **Credits:** 250 per successful call, however many markets it returns. Errors are not billed.
* **Rate limit:** 5 calls per 10 minutes **per API key**, shared across all GoldRush servers. Only calls that pass validation count. This is the one exception to the Info API's [no rate limits](https://goldrush.dev/docs/goldrush-hyperliquid/info-api/limits.md) rule, because a whole-exchange call is about 24 MB.

| Condition | Status | Body |
| - | - | - |
| Success | `200` | binary or JSON, see above |
| Missing or invalid key, no credits, suspended | `401` / `402` / `403` | standard auth error |
| `market_names` missing, empty, not an array of strings | `400` | `{"error":"invalid_body","message":"market_names must be a non-empty array of strings"}` |
| More than 256 `market_names` | `400` | `{"error":"invalid_body","message":"too many market_names"}` |
| An entry that doesn't match the grammar | `400` | `{"error":"invalid_body","message":"bad market name: <entry>"}` |
| `ALL:<dex>` with an unknown dex | `400` | `{"error":"invalid_body","message":"unknown dex: <dex>"}` |
| `format` other than `msgpack` / `json` | `400` | `{"error":"invalid_body","message":"format must be msgpack or json"}` |
| `format: "json"` resolving to more than 5 markets | `400` | `{"error":"invalid_body","message":"format json allows at most 5 markets"}` |
| No snapshot loaded yet | `404` | `{"error":"no_snapshot"}` |
| Over the per-key rate limit | `429` | `{"error":"too_many_requests"}`, with `Retry-After: <seconds>` |
| Newest snapshot older than 15 minutes | `503` | `{"error":"snapshot_stale","message":"…"}`, with `Retry-After: 60` |
| Unexpected server failure | `502` | `{"error":"upstream_error","message":"internal error"}` |

## Guides

[How to get every open Hyperliquid position with perpSnapshots](https://goldrush.dev/guides/how-to-get-every-open-hyperliquid-position-with-perpsnapshots/) builds a liquidation heatmap, the largest and closest-to-liquidation positions, long/short positioning and a diff between two snapshots in Node.js, with every figure from a recorded snapshot.

## Using an existing perpSnapshots client

`perpSnapshots` and `perpSnapshotTimestamp` use the standard request bodies and wire format for these methods: the `market_names` grammar, the zstd/MessagePack chunks, the 8-field position tuple, the `multi-zstd` framing and headers, and a budget of 5 calls per 10 minutes. If you already have a client for them:

1. Point it at `https://hypercore.goldrushdata.com/info`.
2. Send your GoldRush API key as `Authorization: Bearer <GOLDRUSH_API_KEY>`.

Your decoder doesn't change. What GoldRush adds:

* **Pricing per call:** 250 credits per `perpSnapshots` call and `perpSnapshotTimestamp` free, on any GoldRush plan. No separate subscription.
* **`format: "json"`** for up to 5 markets.
* **`x-snapshot-id` and `x-snapshot-timestamp` headers** on every `200`.
* **`429` body:** `{"error":"too_many_requests"}`, with the wait in the `Retry-After` header.
* **Never stale:** `503 snapshot_stale` rather than positions older than 15 minutes.
* **One key for everything:** the same key and endpoint also serve the full Hyperliquid `/info` and `/ws` APIs, with no rate limits.

See the [Info API migration guide](https://goldrush.dev/docs/goldrush-hyperliquid/info-api/migration.md) for the rest of the `/info` surface.

## Related endpoints

> [card] [perpSnapshotTimestamp](https://goldrush.dev/docs/api-reference/hyperliquid-info/perp-snapshot-timestamp.md)
>
> check for a new all-positions perpSnapshots snapshot for free before downloading it.

> [card] [batchClearinghouseState](https://goldrush.dev/docs/api-reference/hyperliquid-info/batch-clearinghouse-state.md)
>
> fetch perpetuals account state for up to 50 wallets in a single request.

> [card] [clearinghouseState](https://goldrush.dev/docs/api-reference/hyperliquid-info/clearinghouse-state.md)
>
> fetch a single user's perpetuals account state by wallet address.

> [card] [liquidatable](https://goldrush.dev/docs/api-reference/hyperliquid-info/liquidatable.md)
>
> list accounts currently eligible for liquidation.

See all Hyperliquid endpoints: [Overview hub](https://goldrush.dev/docs/goldrush-hyperliquid/overview.md) · [Info API reference](https://goldrush.dev/docs/goldrush-hyperliquid/info-api/overview.md)

Served by the [GoldRush Hyperliquid API](https://goldrush.dev/products/hyperliquid-api/): a drop-in replacement for the public `/info` and `/ws` APIs at `hypercore.goldrushdata.com`, with no rate limits and every fill, order, trade, funding and ledger event retained from the start of HyperCore coverage.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.