0xArchive API Skill
Query historical and real-time crypto market data from 0xArchive using curl. Three exchanges are supported: Hyperliquid (perps DEX), Lighter.xyz (order-book DEX), and HIP-3 (Hyperliquid builder perps). Data types: orderbooks, trades, candles, funding rates, open interest, liquidations, and data quality metrics.
Authentication
All endpoints require the x-api-key header. The key is read from $OXARCHIVE_API_KEY.
CODEBLOCK0
Exchanges & Coin Naming
| Exchange | Path prefix | Coin format | Examples |
|---|
| Hyperliquid | INLINECODE3 | UPPERCASE | INLINECODE4 , ETH, INLINECODE6 |
| HIP-3 |
/v1/hyperliquid/hip3 | Case-sensitive,
builder:NAME |
km:US500,
xyz:GOLD,
hyna:BTC,
vntl:SPACEX,
flx:TSLA,
cash:NVDA |
| Lighter |
/v1/lighter | UPPERCASE |
BTC,
ETH |
Hyperliquid and Lighter auto-uppercase the symbol server-side. HIP-3 coin names are passed through as-is.
Timestamps
All timestamps are Unix milliseconds. Use these shell helpers:
CODEBLOCK1
Response Format
Every response follows this shape:
CODEBLOCK2
Endpoint Reference
Hyperliquid (/v1/hyperliquid)
| Endpoint | Params | Notes |
|---|
| INLINECODE19 | -- | List all instruments |
| INLINECODE20 |
-- | Single instrument details |
|
GET /orderbook/{symbol} |
timestamp,
depth | Latest or at timestamp |
|
GET /orderbook/{symbol}/history |
start,
end,
limit,
cursor,
depth | Historical snapshots |
|
GET /trades/{symbol} |
start,
end,
limit,
cursor | Trade history |
|
GET /candles/{symbol} |
start,
end,
limit,
cursor,
interval | OHLCV candles |
|
GET /funding/{symbol}/current | -- | Current funding rate |
|
GET /funding/{symbol} |
start,
end,
limit,
cursor,
interval | Funding rate history |
|
GET /openinterest/{symbol}/current | -- | Current open interest |
|
GET /openinterest/{symbol} |
start,
end,
limit,
cursor,
interval | OI history |
|
GET /liquidations/{symbol} |
start,
end,
limit,
cursor | Liquidation events |
|
GET /liquidations/{symbol}/volume |
start,
end,
limit,
cursor,
interval | Aggregated liquidation volume (USD) |
|
GET /liquidations/user/{address} |
start,
end,
limit,
cursor,
coin | Liquidations for a user |
|
GET /freshness/{symbol} | -- | Data freshness per data type |
|
GET /summary/{symbol} | -- | Combined market summary (price, funding, OI, volume, liquidations) |
|
GET /prices/{symbol} |
start,
end,
limit,
cursor,
interval | Mark/oracle/mid price history |
|
GET /orders/{symbol}/history |
start,
end,
user,
status,
order_type,
limit,
cursor | Order history with user attribution (Build+) |
|
GET /orders/{symbol}/flow |
start,
end,
interval,
limit | Order flow aggregation (Build+) |
|
GET /orders/{symbol}/tpsl |
start,
end,
user,
triggered,
limit,
cursor | TP/SL order history (Pro+) |
|
GET /orderbook/{symbol}/l4 |
timestamp,
depth | L4 orderbook reconstruction (Pro+) |
|
GET /orderbook/{symbol}/l4/diffs |
start,
end,
limit,
cursor | L4 orderbook diffs (Pro+) |
|
GET /orderbook/{symbol}/l4/history |
start,
end,
limit,
cursor | L4 orderbook checkpoints (Pro+) |
|
GET /orderbook/{symbol}/l2 |
timestamp,
depth | L2 full-depth orderbook derived from L4 (Build+) |
|
GET /orderbook/{symbol}/l2/history |
start,
end,
limit,
cursor,
depth | L2 full-depth checkpoints (Build+) |
|
GET /orderbook/{symbol}/l2/diffs |
start,
end,
limit,
cursor | L2 tick-level diffs (Pro+) |
HIP-3 (/v1/hyperliquid/hip3)
Coin names are case-sensitive (e.g., km:US500). Orderbook requires Pro+ tier.
| Endpoint | Params | Notes |
|---|
| INLINECODE129 | -- | List HIP-3 instruments |
| INLINECODE130 |
-- | Single instrument |
|
GET /orderbook/{coin} |
timestamp,
depth | Requires Pro+ tier |
|
GET /orderbook/{coin}/history |
start,
end,
limit,
cursor,
depth | Requires Pro+ tier |
|
GET /trades/{coin} |
start,
end,
limit,
cursor | Trade history |
|
GET /trades/{coin}/recent |
limit | Recent trades (no time range needed) |
|
GET /candles/{coin} |
start,
end,
limit,
cursor,
interval | OHLCV candles |
|
GET /funding/{coin}/current | -- | Current funding rate |
|
GET /funding/{coin} |
start,
end,
limit,
cursor,
interval | Funding history |
|
GET /openinterest/{coin}/current | -- | Current OI |
|
GET /openinterest/{coin} |
start,
end,
limit,
cursor,
interval | OI history |
|
GET /liquidations/{coin} |
start,
end,
limit,
cursor | Liquidation events |
|
GET /liquidations/{coin}/volume |
start,
end,
limit,
cursor,
interval | Aggregated liquidation volume (USD) |
|
GET /freshness/{coin} | -- | Data freshness per data type |
|
GET /summary/{coin} | -- | Combined market summary (price, funding, OI) |
|
GET /prices/{coin} |
start,
end,
limit,
cursor,
interval | Mark/oracle/mid price history |
|
GET /orders/{coin}/history |
start,
end,
user,
status,
order_type,
limit,
cursor | Order history with user attribution (Build+) |
|
GET /orders/{coin}/flow |
start,
end,
interval,
limit | Order flow aggregation (Build+) |
|
GET /orders/{coin}/tpsl |
start,
end,
user,
triggered,
limit,
cursor | TP/SL order history (Pro+) |
|
GET /orderbook/{coin}/l4 |
timestamp,
depth | L4 orderbook reconstruction (Pro+) |
|
GET /orderbook/{coin}/l4/diffs |
start,
end,
limit,
cursor | L4 orderbook diffs (Pro+) |
|
GET /orderbook/{coin}/l4/history |
start,
end,
limit,
cursor | L4 orderbook checkpoints (Pro+) |
|
GET /orderbook/{coin}/l2 |
timestamp,
depth | L2 full-depth orderbook derived from L4 (Build+) |
|
GET /orderbook/{coin}/l2/history |
start,
end,
limit,
cursor,
depth | L2 full-depth checkpoints (Build+) |
|
GET /orderbook/{coin}/l2/diffs |
start,
end,
limit,
cursor | L2 tick-level diffs (Pro+) |
Lighter (/v1/lighter)
Same data types as Hyperliquid except: no liquidations. Adds granularity on orderbook history and /recent trades.
| Endpoint | Params | Notes |
|---|
| INLINECODE236 | -- | List Lighter instruments |
| INLINECODE237 |
-- | Single instrument |
|
GET /orderbook/{symbol} |
timestamp,
depth | Latest or at timestamp |
|
GET /orderbook/{symbol}/history |
start,
end,
limit,
cursor,
depth,
granularity | Default granularity:
checkpoint |
|
GET /trades/{symbol} |
start,
end,
limit,
cursor | Trade history |
|
GET /trades/{symbol}/recent |
limit | Recent trades (no time range needed) |
|
GET /candles/{symbol} |
start,
end,
limit,
cursor,
interval | OHLCV candles |
|
GET /funding/{symbol}/current | -- | Current funding rate |
|
GET /funding/{symbol} |
start,
end,
limit,
cursor,
interval | Funding history |
|
GET /openinterest/{symbol}/current | -- | Current OI |
|
GET /openinterest/{symbol} |
start,
end,
limit,
cursor,
interval | OI history |
|
GET /freshness/{symbol} | -- | Data freshness per data type |
|
GET /summary/{symbol} | -- | Combined market summary (price, funding, OI) |
|
GET /prices/{symbol} |
start,
end,
limit,
cursor,
interval | Mark/oracle price history |
|
GET /l3orderbook/{symbol} |
timestamp,
depth,
account | L3 order-level orderbook (Pro+) |
|
GET /l3orderbook/{symbol}/history |
start,
end,
limit,
cursor,
granularity,
account | Historical L3 snapshots (Pro+) |
Data Quality (/v1/data-quality)
| Endpoint | Params | Notes |
|---|
| INLINECODE296 | -- | System health status |
| INLINECODE297 |
-- | Coverage summary, all exchanges |
|
GET /coverage/{exchange} | -- | Coverage for one exchange |
|
GET /coverage/{exchange}/{symbol} |
from,
to | Symbol-level coverage + gaps |
|
GET /incidents |
status,
exchange,
since,
limit,
offset | List incidents |
|
GET /incidents/{id} | -- | Single incident |
|
GET /latency | -- | Ingestion latency metrics |
|
GET /sla |
year,
month | SLA compliance report |
WebSocket Channels
Additional real-time channels available via WebSocket (wss://api.0xarchive.io/ws?apiKey=KEY):
| Channel | Notes |
|---|
| INLINECODE314 | L4 orderbook diffs with user attribution (Pro+, real-time only) |
| INLINECODE315 |
Order lifecycle events with user attribution (Pro+, real-time only) |
|
lighter_l3_orderbook | Lighter L3 order-level orderbook snapshots (Pro+, historical only) |
|
hip3_liquidations | HIP-3 liquidation events with long/short direction (Build+, historical only) |
|
hip3_l4_diffs | HIP-3 L4 orderbook diffs (Pro+, real-time only) |
|
hip3_l4_orders | HIP-3 order lifecycle events (Pro+, real-time only) |
Web3 Authentication (/v1)
Get API keys programmatically using an Ethereum wallet (SIWE). No API key required for these endpoints.
| Endpoint | Params | Notes |
|---|
| INLINECODE321 | INLINECODE322 (wallet address) | Returns SIWE message to sign |
| INLINECODE323 |
message,
signature | Returns free-tier API key |
|
POST /web3/keys |
message,
signature | List all keys for wallet |
|
POST /web3/keys/revoke |
message,
signature,
key_id | Revoke a key |
|
POST /web3/subscribe |
tier (
build or
pro),
payment-signature header | x402 USDC subscription (see flow below) |
Free-tier flow: Call /auth/web3/challenge with wallet address → sign the returned message with personal_sign (EIP-191) → submit to /web3/signup with the message and signature → receive API key.
Paid-tier flow (x402):
- 1.
POST /web3/subscribe with { "tier": "build" } → server returns 402 with payment.amount (micro-USDC), payment.pay_to (treasury address), payment.network. - Sign an EIP-712
TransferWithAuthorization (EIP-3009) on USDC Base:
- Domain:
{ name: "USD Coin", version: "2", chainId: 8453, verifyingContract: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" }
- Type:
TransferWithAuthorization(address from, address to, uint256 value, uint256 validAfter, uint256 validBefore, bytes32 nonce)
- Message:
{ from: <wallet>, to: <pay_to>, value: <amount>, validAfter: 0, validBefore: <now+3600>, nonce: <32 random bytes hex> }
- 3. Build x402 v2 payment payload:
{
"x402Version": 2,
"payload": {
"signature": "0x<EIP-712 signature hex>",
"authorization": {
"from": "0x<wallet>",
"to": "0x<pay_to from step 1>",
"value": "<amount as string>",
"validAfter": "0",
"validBefore": "<unix timestamp as string>",
"nonce": "0x<64 hex chars>"
}
}
}
- 4. Base64-encode the JSON and retry:
POST /web3/subscribe with { "tier": "build" } and header payment-signature: <base64 payload> → receive API key + subscription.
Important: All authorization values (value, validAfter, validBefore) must be strings, not numbers. See scripts/web3_subscribe.py for a complete working Python implementation.
Common Parameters
| Param | Type | Description |
|---|
| INLINECODE358 | int | Start timestamp (Unix ms). Defaults to 24h ago. |
| INLINECODE359 |
int | End timestamp (Unix ms). Defaults to now. |
|
limit | int | Max records. Default 100, max 1000 (max 10000 for candles). |
|
cursor | string | Pagination cursor from
meta.next_cursor. |
|
interval | string | Candle interval:
1m,
5m,
15m,
30m,
1h,
4h,
1d,
1w. Default:
1h. For OI/funding:
5m,
15m,
30m,
1h,
4h,
1d. Omit for raw data. |
|
depth | int | Orderbook depth (number of price levels per side). |
|
granularity | string | Lighter orderbook resolution:
checkpoint (default),
30s,
10s,
1s,
tick. |
|
account | int | Lighter L3 orderbook: filter by account index (e.g.,
281474976710654 for LLP vault). |
Smart Defaults
When the user does not specify a time range, default to the last 24 hours:
CODEBLOCK4
For candles with no explicit range, default to a range that makes sense for the interval (e.g., last 7 days for 4h candles, last 30 days for 1d candles).
Pagination
When meta.next_cursor is present in the response, more data is available. Append &cursor=VALUE to fetch the next page:
CODEBLOCK5
Tier Limits
| Tier | Price | Coins | Orderbook Depth | Lighter Granularity | Historical Depth | Rate Limit |
|---|
| Free | $0 | BTC only (HIP-3: km:US500 only) | 20 levels | -- | 30 days | 15 RPS |
| Build |
$49/mo | All | 50 levels | checkpoint, 30s, 10s | 1 year | 50 RPS |
| Pro | $199/mo | All | 100 levels | + 1s | Full history | 150 RPS |
| Enterprise | Custom | All | Full depth | + tick | Full history | Custom |
Error Handling
| HTTP Status | Meaning | Action |
|---|
| 400 | Bad request / validation error | Check params (missing start/end, invalid interval) |
| 401 |
Missing or invalid API key | Set
$OXARCHIVE_API_KEY |
| 403 | Tier restriction | Upgrade plan (e.g., non-BTC coin on Free tier) |
| 404 | Symbol not found | Check coin name spelling and exchange |
| 429 | Rate limited | Back off and retry |
Error responses return { "code": 400, "error": "description" }.
Example Queries
CODEBLOCK6
0xArchive API 技能
使用 curl 从 0xArchive 查询历史和实时加密货币市场数据。支持三个交易所:Hyperliquid(永续合约 DEX)、Lighter.xyz(订单簿 DEX)和 HIP-3(Hyperliquid 构建者永续合约)。数据类型包括:订单簿、交易、K线、资金费率、未平仓合约、清算数据以及数据质量指标。
身份验证
所有端点都需要 x-api-key 标头。密钥从 $OXARCHIVEAPIKEY 读取。
bash
curl -s -H x-api-key: $OXARCHIVEAPIKEY https://api.0xarchive.io/v1/...
交易所与币种命名
| 交易所 | 路径前缀 | 币种格式 | 示例 |
|---|
| Hyperliquid | /v1/hyperliquid | 大写 | BTC, ETH, SOL |
| HIP-3 |
/v1/hyperliquid/hip3 | 区分大小写,builder:NAME | km:US500, xyz:GOLD, hyna:BTC, vntl:SPACEX, flx:TSLA, cash:NVDA |
| Lighter | /v1/lighter | 大写 | BTC, ETH |
Hyperliquid 和 Lighter 会在服务端自动将币种符号转换为大写。HIP-3 的币种名称原样传递。
时间戳
所有时间戳均为 Unix 毫秒。使用以下 shell 辅助变量:
bash
NOW=$(( $(date +%s) * 1000 ))
HOUR_AGO=$(( NOW - 3600000 ))
DAY_AGO=$(( NOW - 86400000 ))
WEEK_AGO=$(( NOW - 604800000 ))
响应格式
每个响应都遵循以下结构:
json
{
success: true,
data: [ ... ],
meta: {
count: 100,
request_id: uuid,
next_cursor: 1706000000000 // 当存在更多页面时出现
}
}
端点参考
Hyperliquid (/v1/hyperliquid)
| 端点 | 参数 | 说明 |
|---|
| GET /instruments | -- | 列出所有交易品种 |
| GET /instruments/{symbol} |
-- | 单个交易品种详情 |
| GET /orderbook/{symbol} | timestamp, depth | 最新或指定时间戳的订单簿 |
| GET /orderbook/{symbol}/history | start, end, limit, cursor, depth | 历史快照 |
| GET /trades/{symbol} | start, end, limit, cursor | 交易历史 |
| GET /candles/{symbol} | start, end, limit, cursor, interval | OHLCV K线 |
| GET /funding/{symbol}/current | -- | 当前资金费率 |
| GET /funding/{symbol} | start, end, limit, cursor, interval | 资金费率历史 |
| GET /openinterest/{symbol}/current | -- | 当前未平仓合约 |
| GET /openinterest/{symbol} | start, end, limit, cursor, interval | 未平仓合约历史 |
| GET /liquidations/{symbol} | start, end, limit, cursor | 清算事件 |
| GET /liquidations/{symbol}/volume | start, end, limit, cursor, interval | 聚合清算量(美元) |
| GET /liquidations/user/{address} | start, end, limit, cursor, coin | 用户的清算记录 |
| GET /freshness/{symbol} | -- | 各数据类型的数据新鲜度 |
| GET /summary/{symbol} | -- | 综合市场摘要(价格、资金费率、未平仓合约、成交量、清算) |
| GET /prices/{symbol} | start, end, limit, cursor, interval | 标记价/预言机价/中间价历史 |
| GET /orders/{symbol}/history | start, end, user, status, order_type, limit, cursor | 带用户归属的订单历史(Build+) |
| GET /orders/{symbol}/flow | start, end, interval, limit | 订单流聚合(Build+) |
| GET /orders/{symbol}/tpsl | start, end, user, triggered, limit, cursor | 止盈/止损订单历史(Pro+) |
| GET /orderbook/{symbol}/l4 | timestamp, depth | L4 订单簿重建(Pro+) |
| GET /orderbook/{symbol}/l4/diffs | start, end, limit, cursor | L4 订单簿差异(Pro+) |
| GET /orderbook/{symbol}/l4/history | start, end, limit, cursor | L4 订单簿检查点(Pro+) |
| GET /orderbook/{symbol}/l2 | timestamp, depth | 从 L4 派生的 L2 全深度订单簿(Build+) |
| GET /orderbook/{symbol}/l2/history | start, end, limit, cursor, depth | L2 全深度检查点(Build+) |
| GET /orderbook/{symbol}/l2/diffs | start, end, limit, cursor | L2 逐笔差异(Pro+) |
HIP-3 (/v1/hyperliquid/hip3)
币种名称区分大小写(例如 km:US500)。订单簿需要 Pro+ 级别。
| 端点 | 参数 | 说明 |
|---|
| GET /instruments | -- | 列出 HIP-3 交易品种 |
| GET /instruments/{coin} |
-- | 单个交易品种 |
| GET /orderbook/{coin} | timestamp, depth | 需要 Pro+ 级别 |
| GET /orderbook/{coin}/history | start, end, limit, cursor, depth | 需要 Pro+ 级别 |
| GET /trades/{coin} | start, end, limit, cursor | 交易历史 |
| GET /trades/{coin}/recent | limit | 近期交易(无需时间范围) |
| GET /candles/{coin} | start, end, limit, cursor, interval | OHLCV K线 |
| GET /funding/{coin}/current | -- | 当前资金费率 |
| GET /funding/{coin} | start, end, limit, cursor, interval | 资金费率历史 |
| GET /openinterest/{coin}/current | -- | 当前未平仓合约 |
| GET /openinterest/{coin} | start, end, limit, cursor, interval | 未平仓合约历史 |
| GET /liquidations/{coin} | start, end, limit, cursor | 清算事件 |
| GET /liquidations/{coin}/volume | start, end, limit, cursor, interval | 聚合清算量(美元) |
| GET /freshness/{coin} | -- | 各数据类型的数据新鲜度 |
| GET /summary/{coin} | -- | 综合市场摘要(价格、资金费率、未平仓合约) |
| GET /prices/{coin} | start, end, limit, cursor, interval | 标记价/预言机价/中间价历史 |
| GET /orders/{coin}/history | start, end, user, status, order_type, limit, cursor | 带用户归属的订单历史(Build+) |
| GET /orders/{coin}/flow | start, end, interval, limit | 订单流聚合(Build+) |
| GET /orders/{coin}/tpsl | start, end, user, triggered, limit, cursor | 止盈/止损订单历史(Pro+) |
| GET /orderbook/{coin}/l4 | timestamp, depth | L4 订单簿重建(Pro+) |
| GET /orderbook/{coin}/l4/diffs | start, end, limit, cursor | L4