Hyperliquid API
Endpoints for Hyperliquid perpetuals market data, USDC deposit bridging, and real-time WebSocket feeds.
Base path: /hyperliquid. Market-data endpoints are public (no authentication required). The deposit endpoint requires a connected wallet.
Deposit
Create Deposit Transaction
POST /hyperliquid/deposit
Builds an unsigned USDC transfer to the Hyperliquid bridge on Arbitrum. The client signs and submits the returned transaction.
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
value | string | Yes | USDC amount to deposit |
Response: an unsigned transaction object (to, data, value, etc.) for the client to sign.
Market Data
Get Mid Prices
GET /hyperliquid/mids
Returns mid prices for all assets. Cached ~15s.
Get Order Book
GET /hyperliquid/orderbook/:coin
Returns the L2 order book (bids/asks) for a coin. Cached ~5s.
| Path Param | Type | Description |
|---|---|---|
coin | string | Asset symbol (e.g. BTC, ETH) |
Get Recent Trades
GET /hyperliquid/trades/:coin
Returns recent trades for a coin (up to 20). Cached ~5s.
| Path Param | Type | Description |
|---|---|---|
coin | string | Asset symbol |
Get Candles
GET /hyperliquid/candles/:coin/:interval
Returns OHLC candles for a coin and interval.
| Path Param | Type | Description |
|---|---|---|
coin | string | Asset symbol |
interval | string | One of 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 8h, 12h, 1d, 3d, 1w, 1M |
| Query Param | Type | Required | Description |
|---|---|---|---|
startTime | number | Yes | Start time (epoch ms) |
endTime | number | No | End time (epoch ms, defaults to now) |
If the upstream Hyperliquid API is briefly unavailable, the most recent cached candles are served from the database as a fallback.
Get Connection Status
GET /hyperliquid/status
Returns the WebSocket connection status: connected, reconnectAttempts, lastConnected, and activeSubscriptions.
WebSocket Feeds
Real-time updates are delivered on the Socket.io namespace /hyperliquid. Subscriptions are authenticated - pass a JWT in the handshake (socket.handshake.auth.token or the Authorization header).
| Subscribe Event | Payload | Emitted Event | Description |
|---|---|---|---|
subscribe:midPrices | - | midPrices | All asset mid prices |
subscribe:orderBook | { coin } | orderBook | L2 order book for a coin |
subscribe:trades | { coin } | trades | Recent trades for a coin |
subscribe:candle | { coin, interval } | candle | OHLC candle for a coin/interval |
Each has a matching unsubscribe:* event with the same payload. Send ping to keep the connection alive (the server responds pong). Subscriptions are reference-counted, and the client reconnects automatically with exponential backoff.