Skip to main content

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:

FieldTypeRequiredDescription
valuestringYesUSDC 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 ParamTypeDescription
coinstringAsset symbol (e.g. BTC, ETH)

Get Recent Trades

GET /hyperliquid/trades/:coin

Returns recent trades for a coin (up to 20). Cached ~5s.

Path ParamTypeDescription
coinstringAsset symbol

Get Candles

GET /hyperliquid/candles/:coin/:interval

Returns OHLC candles for a coin and interval.

Path ParamTypeDescription
coinstringAsset symbol
intervalstringOne of 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 8h, 12h, 1d, 3d, 1w, 1M
Query ParamTypeRequiredDescription
startTimenumberYesStart time (epoch ms)
endTimenumberNoEnd time (epoch ms, defaults to now)
note

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 EventPayloadEmitted EventDescription
subscribe:midPrices-midPricesAll asset mid prices
subscribe:orderBook{ coin }orderBookL2 order book for a coin
subscribe:trades{ coin }tradesRecent trades for a coin
subscribe:candle{ coin, interval }candleOHLC 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.