l2BookDiffSnapshot | Hyperliquid Info API
curl --request POST \
--url https://hypercore.goldrushdata.com/info \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "<string>",
"coin": "<string>"
}
'import requests
url = "https://hypercore.goldrushdata.com/info"
payload = {
"type": "<string>",
"coin": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({type: '<string>', coin: '<string>'})
};
fetch('https://hypercore.goldrushdata.com/info', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://hypercore.goldrushdata.com/info",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => '<string>',
'coin' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://hypercore.goldrushdata.com/info"
payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"coin\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://hypercore.goldrushdata.com/info")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"coin\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hypercore.goldrushdata.com/info")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"<string>\",\n \"coin\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"coin": "<string>",
"time": 123,
"height": 123,
"epoch": "<string>",
"seq": 123,
"levels": [
[
{
"px": "<string>",
"sz": "<string>",
"n": 123
}
]
]
}Info API
l2BookDiffSnapshot | Hyperliquid Info API
Hyperliquid l2BookDiffSnapshot: fetch a full-depth L2 order book snapshot for one coin, with height, epoch, and seq to bootstrap the l2BookDiff2 stream.
POST
/
info
l2BookDiffSnapshot | Hyperliquid Info API
curl --request POST \
--url https://hypercore.goldrushdata.com/info \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "<string>",
"coin": "<string>"
}
'import requests
url = "https://hypercore.goldrushdata.com/info"
payload = {
"type": "<string>",
"coin": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({type: '<string>', coin: '<string>'})
};
fetch('https://hypercore.goldrushdata.com/info', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://hypercore.goldrushdata.com/info",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => '<string>',
'coin' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://hypercore.goldrushdata.com/info"
payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"coin\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://hypercore.goldrushdata.com/info")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"coin\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hypercore.goldrushdata.com/info")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"<string>\",\n \"coin\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"coin": "<string>",
"time": 123,
"height": 123,
"epoch": "<string>",
"seq": 123,
"levels": [
[
{
"px": "<string>",
"sz": "<string>",
"n": 123
}
]
]
}Processing
Realtime
type: "l2BookDiffSnapshot" is used to fetch a full-depth L2 order book snapshot for one coin, carrying the height, epoch, and per-coin seq needed to bootstrap and align the l2BookDiff2 diff stream.
- GoldRush-native.
l2BookDiffSnapshotis not aPOST api.hyperliquid.xyz/infomethod - it is served only by the GoldRush endpoint. - Bootstrap for
l2BookDiff2. That WebSocket stream is diff-only; this endpoint provides the initial book to seed from, plus theheight/epoch/seqto align the diffs onto it. - Full depth. Unlike the 20-level
l2Booksnapshot, this returns the complete resting book for the coin so your reconstruction starts from a complete state. - The snapshot already reflects every diff up to and including its own
height(it is taken after that block is applied), so discard any diff at or below it.
coin - two arrays of price levels (bids first, then asks), each carrying price, resting size, and order count - together with the height, epoch, and per-coin seq that tie the snapshot to the l2BookDiff2 stream.
Endpoint
POST https://hypercore.goldrushdata.com/info
Authorization: Bearer <GOLDRUSH_API_KEY>
Content-Type: application/json
Request
string
default:"l2BookDiffSnapshot"
required
Always
"l2BookDiffSnapshot".string
required
The asset symbol, e.g.
"BTC". For HIP-3 markets use the deployer-prefixed form; for spot use the pair symbol or @<index>.Example
curl -X POST https://hypercore.goldrushdata.com/info \
-H "Authorization: Bearer $GOLDRUSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "l2BookDiffSnapshot",
"coin": "HYPE"
}'
const response = 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: "l2BookDiffSnapshot",
coin: "HYPE",
}),
});
const snap = await response.json();
const { height, epoch, seq } = snap;
const [bids, asks] = snap.levels;
import os, requests
response = requests.post(
"https://hypercore.goldrushdata.com/info",
headers={"Authorization": f"Bearer {os.environ['GOLDRUSH_API_KEY']}"},
json={"type": "l2BookDiffSnapshot", "coin": "HYPE"},
)
snap = response.json()
height, epoch, seq = snap["height"], snap["epoch"], snap["seq"]
bids, asks = snap["levels"]
Response
A single JSON object.levels is a two-element array: element 0 is the bid side (descending price), element 1 is the ask side (ascending price). Each level is a {px, sz, n} object.
{
"coin": "HYPE",
"time": 1786379674524,
"height": 1105178185,
"epoch": "466bf60f-bb7a-4591-89a3-a2660234fef5",
"seq": 3669031,
"levels": [
[
{ "px": "54.208", "sz": "153.23", "n": 6 },
{ "px": "54.204", "sz": "48.81", "n": 1 }
],
[
{ "px": "54.214", "sz": "12.34", "n": 2 },
{ "px": "54.216", "sz": "80.71", "n": 3 }
]
]
}
Field descriptions
px and sz are returned as decimal strings, preserving upstream precision. Do not parse them as floats.string
The asset the book is for - echoes the request
coin.int
Snapshot timestamp in milliseconds since Unix epoch.
int
HyperCore block height the snapshot was taken at. Discard any
l2BookDiff2 batch whose block_height is ≤ this value.string
Server generation (UUID). Must match the
epoch on the l2BookDiff2 batches you apply; a different epoch means the stream reset and you should re-fetch.int
The per-coin sequence this snapshot is aligned to. The first
l2BookDiff2 diff you apply for this coin should have prev_seq == seq.array<array<object>>
Bootstrapping the l2BookDiff2 stream
Use this snapshot to seed a local book, then keep it current with thel2BookDiff2 WebSocket stream:
- Subscribe to
l2BookDiff2for your coin(s) and start bufferingUpdates. - Fetch this snapshot; note
height,epoch, andseq. - Drop any buffered batch whose
block_height≤height. - Confirm each remaining batch’s
epochequals this snapshot’sepoch(else re-fetch). - Apply diffs in order - the first for the coin has
prev_seq == seq. - Keep checking per-coin
prev_seqcontinuity; on a gap orepochchange, re-fetch and re-bootstrap.
Related endpoints
l2Book
fetch an aggregated Level-2 order book snapshot for a single coin - bids and asks as price, size, and order-count levels.
candleSnapshot
fetch historical OHLCV candles for a coin and interval over a time window for charting and backtesting.
allMids
fetch the current mid price for every actively traded asset in a single call.
fundingHistory
fetch a coin’s historical funding rates and premiums over a time window for funding analytics and basis strategies.