Chainstack Self-Hosted is now available! Launch production-grade blockchain nodes on infrastructure you control.    Get started
  • Pricing
  • Docs

Hyperliquid API guide: endpoints, SDK, and WebSocket

Created May 7, 2026 Updated May 8, 2026
Yh5baeaaaaalaaaaaabaaeaaaibraa7 logo

TL;DR

Most Hyperliquid integrations break at the same point: polling the Info API where a WebSocket subscription belongs, or hitting the Exchange API directly without understanding the signing model. This guide covers all three interfaces — Info, Exchange, and WebSocket — so you pick the right one from the start.

For developers, Hyperliquid exposes three main interfaces:

  • Info API → read data (prices, order books, positions)
  • Exchange API → signed trading actions
  • WebSocket → real-time updates

The typical workflow is simple: fetch market data → evaluate liquidity → sign using Python SDK and place an order → track it via WebSocket or polling. The system is fast (~500ms blocks) and supports high throughput, making it suitable for bots, dashboards, and execution systems.

Why build on Hyperliquid?

📖 Want to start building right away? Jump to the “Hyperliquid API” section below.

Unlike most exchanges that split execution across off-chain order books and on-chain settlement, Hyperliquid processes ~200,000 orders per second with ~500ms block times while running the entire trading lifecycle fully on-chain making execution, matching and settlement verifiable.

That means a fully trustless environment where the order book lives on-chain enabling real price discovery with liquidity driven by active trading in complete transparency.

It gets better.

Because everything happens on-chain, users always stay in control of their funds. There’s no custody layer and no need to trust an exchange. Your keys, your funds. This removes the kind of counterparty risk seen in collapses like FTX.

In practice, you get the speed and experience of a centralized exchange, but with full transparency and self-custody by default.

For developers building on Hyperliquid, it becomes real simple:

  • no need to sync off-chain + on-chain state
  • no hidden matching logic
  • same data source for everyone

As of May 2026, Hyperliquid reached $4.31T in cumulative trading volume with $906.21M in platform revenue. The builder ecosystem grew to 10.56M users and $232.16B in combined builder volume.

Yh5baeaaaaalaaaaaabaaeaaaibraa7 logo
Yh5baeaaaaalaaaaaabaaeaaaibraa7 logo
Yh5baeaaaaalaaaaaabaaeaaaibraa7 logo
Source: https://hyperscreener.asxn.xyz

This guide covers the full developer surface: what each endpoint does, how to call it in Python, how to stream data over WebSocket, and how to stay within rate limits.

Hyperliquid is available on Chainstack offering both HyperEVM and HyperCore RPC access, with just a few clicks. Check out how to setup a Hyperliquid RPC node here: https://youtu.be/nvK9V2Jh2Dk

How Hyperliquid API works: HyperCore, HyperEVM, and HyperBFT

Hyperliquid has three core components at the protocol level:

1. HyperCore (Trading Engine)

  • On-chain order book
  • Matching engine
  • Liquidation logic

Every action placing an order, canceling or filling becomes part of on-chain state.

2. HyperEVM (Smart Contract Layer)

HyperEVM is Hyperliquid’s native EVM-compatible execution environment.

  • supports Ethereum-compatible smart contracts
  • compatible with familiar Ethereum tooling
  • shares the same state and consensus layer as HyperCore

Applications built on HyperEVM can interact seamlessly with HyperCore, enabling users to launch tokens, build apps, and trade within a unified ecosystem.

3. HyperBFT (Consensus Layer)

HyperBFT is the foundation of the Hyperliquid blockchain.

  • variant of HotStuff consensus
  • ~500ms block time
  • single-block finality

HyperBFT enables a distributed set of validators to agree on the global state of the network. This unified state includes all applications built on both HyperCore and HyperEVM. This is what enables high throughput (~200k orders/sec), fast confirmation and consistent global state.

📖 This guide will cover how to use Hyperliquid API. If you wish to learn in detail about Hyperliquid, dive into Hyperliquid HIPS and also refer Hyperliquid Architecture.

Hyperliquid API

Hyperliquid is a fully on-chain Central Limit Order Book (CLOB) DEX that operates on its own Layer-1 blockchain. This exposes 3 different endpoints that developers can access:

  • Info: fetch information and read data
  • Exchange: trading and managing orders
  • WebSocket: real-time data streaming

Hyperliquid also provides a testnet to safely test all integrations before moving to production.

Hyperliquid Info API: how to query market data

This is the primary data access layer. Instead of multiple REST endpoints like /markets, /orders, etc., Hyperliquid uses a single POST endpoint with typed queries. No authentication required.

Endpoint: /info

Params: type: 'meta'

All on-chain state read from the chain flows through this one endpoint. The only thing that changes is the type field in the request.

Fetch perpetuals metadata, including universe and margin tables using meta :

import requests
url = "<https://hyperliquid-mainnet.core.chainstack.com/><KEY>/info"
payload = {
    "type": "meta",
    "dex": ""
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)

Similar to meta, but for spot markets instead of perps. Use spotMeta :

import requests
url = "<https://hyperliquid-mainnet.core.chainstack.com/><KEY>/info"
payload = { "type": "spotMeta" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)

l2Book returns the live order book for a given asset.

import requests
url = "<https://api.hyperliquid.xyz/info>"
payload = {
    "type": "l2Book",
    "coin": "ETH"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)

It is important to note that this is only a snapshot. For real-time updates, switch to WebSockets ( see “WebsSockets” section below )

⚠️ Some methods are only available on the public Hyperliquid infrastructure. If you wish to check all available types that can be requested, see all hyperliquid methods here.

Hyperliquid Exchange API: how to place and manage orders

This is the execution layer of Hyperliquid, everything that changes state flows through here. Placing orders, canceling them, updating leverage, or moving funds are all submitted to this endpoint and committed on-chain.

  • Mainnet: https://api.hyperliquid.xyz/exchange
  • Testnet: https://api.hyperliquid-testnet.xyz

Unlike the info endpoint, interacting with the Exchange endpoint directly requires manual signing, payload encoding, and strict formatting. Authentication is handled entirely through cryptographic signatures. Hyperliquid provides an official Python SDK that already handles everything:

  • build the requests
  • payload signing
  • submission to the exchange endpoint

This allows focus on trading logic instead of low-level cryptography.

Installation

pip install hyperliquid-python-sdk

At a high level, exchange actions fall into two categories. The SDK handles all the complex details of message formatting and signing depending on the action that needs to be performed.

L1 Actions (trading ops)

All trading operations use a phantom agent from the actions hash and signed locally using your private key on “Exchange” domain using Msgpack binary format.

Chain ID: 1337

Actions

  • order: place a single order
  • cancel: cancel a single order by OID
  • modify: modify an existing order
  • updateLeverage: set the leverage for the asset, cross-margin or isolated

❓ The SDK’s sign_l1_action() utility handles all the actions. Developers do not need to interact with this signing method. If using SDK, the exchange class will handle the signing for you.

For a complete list of L1 actions and detailed examples, refer to: https://docs.chainstack.com/docs/hyperliquid-l1-action-signing

User Actions (admin ops)

These are administrative actions that are not directly tied to the L1 order book state but manage funds and account state. They use direct EIP-712 signing on “HyperliquidSignTransaction” domain.

Chain ID: 0x66eee (421614 in decimal)

Actions

  • usdSend: used to move USDC between Hyperliquid accounts internally
  • spotSend: Initiates a withdrawal of USDC to an L1 wallet via the bridge.

The SDK also provides these URLs in hyperliquid.utils.constants:

from hyperliquid.utils import constants
mainnet_url = constants.MAINNET_API_URL
testnet_url = constants.TESTNET_API_URL

It is recommended to start on testnet with small amounts. Actions signed for one network are not valid on the other. Always verify behavior on testnet before connecting production keys and real funds.

Configure:

The SDK reads credentials from a config.json file when using the example utilities. Copy the example file and edit it with your keys:

First, copy the example configuration file:

cp examples/config.json.example examples/config.json

Now, open examples/config.json and edit it:

{
    "secret_key": "YOUR_PRIVATE_KEY_HERE",
    "account_address": "YOUR_PUBLIC_ADDRESS_HERE"
}
  • secret_key: Your 64-character hexadecimal private key (prefixed with 0x). This can be the key for your main wallet or a dedicated API wallet.
  • account_address: The public address of your main Hyperliquid account. This is required, especially if you are using an API wallet’s secret_key.

At this point, the client is ready to send signed transactions via the exchange endpoint with any action. All interactions follow a consistent structure:

{
  "action": { ... },
  "nonce": <timestamp>,
  "signature": { ... }
}
  • action : defines what operation to perform (place order, cancel, etc.)
  • nonce : prevents replay attacks (current timestamp)
  • signature : proves ownership of the wallet initiating the action

Each request modifies on-chain state and is processed by the matching engine.

Place an Order using/exchange endpoint

The order action places a single limit order. The order field keys in the raw payload use short names to minimize payload size.

import requests
url = "<https://api.hyperliquid.xyz/exchange>"
payload = {
    "action": {
        "type": "order",
        "orders": [
            {
                "a": 0,
                "b": True,
                "p": "50000.0",
                "s": "0.01",
                "r": False,
                "t": { "limit": { "tif": "Gtc" } }
            }
        ],
        "grouping": "na"
    },
    "nonce": 1705234567890,
    "signature": {
        "r": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "s": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "v": 27
    },
    "vaultAddress": None
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
KeyFull nameDescription
aassetAsset index from meta response
bisBuytrue = buy, false = sell
ppriceLimit price as a decimal string
ssizeOrder size in base asset
rreduceOnlyIf true, order only reduces an open position
ttypeOrder type: limit with tif, or trigger
ccloidOptional client-assigned order ID (128-bit hex)

Withdraw using/exchange endpoint

Withdraw USDC to an L1 wallet via the bridge. This is a User Action, signed with direct EIP-712 on the “HyperliquidSignTransaction” domain, distinct from L1 Actions. The SDK handles the difference automatically. After making this request, L1 validators sign and send the withdrawal to the bridge contract. Withdrawals typically complete in approximately 5 minutes.

import requests
url = "<https://api.hyperliquid.xyz/exchange>"
payload = {
    "action": {
        "type": "withdraw3",
        "hyperliquidChain": "Mainnet",
        "signatureChainId": "0xa4b1",
        "destination": "0x1234567890abcdef1234567890abcdef12345678",
        "amount": "500.0",
        "time": 1705234567890
    },
    "nonce": 1705234567890,
    "signature": {
        "r": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "s": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "v": 27
    },
    "vaultAddress": None
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)

Alternatively, if using Python SDK:

# Withdraw 100 USDC to an L1 wallet address
result = exchange.withdraw_from_bridge("100", "0xDestinationAddress")
print(result)

🤔 For more complete, end-to-end SDK examples, refer to: https://github.com/hyperliquid-dex/hyperliquid-python-sdk/tree/master/examples

Hyperliquid WebSocket API: real-time data streaming

Polling /info repeatedly introduces latency and inefficiency. By the time data is fetched and processed, market state may already be outdated. For any system beyond simple scripts: trading bots, dashboards, execution engines, WebSockets are essential. They stream updates continuously as new blocks are produced (~500ms).

  • Mainnet: wss://api.hyperliquid.xyz/ws
  • Testnet: wss://api.hyperliquid-testnet.xyz/ws

WebSockets follow a simple subscribe → stream pattern:

  1. Open a connection
  2. Send a subscription request
  3. Receive continuous updates

All messages are JSON-based and event-driven. Example usage to subscribes to BTC order book updates:

import asyncio
import json
import websockets
WS_URL = "wss://api.hyperliquid.xyz/ws"
async def main():
    async with websockets.connect(WS_URL) as ws:
        # subscribe to BTC trades
        await ws.send(json.dumps({
            "method": "subscribe",
            "subscription": {
                "type": "l2Book",
                "coin": "BTC"
            }
        }))
        while True:
            msg = await ws.recv()
            data = json.loads(msg)
            print(data)
asyncio.run(main())

For the full list of websockets feeds: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions

The server closes connections that are idle for 60 seconds. Send a ping message every 20 seconds:

{ "method": "ping" }

Server response:

{ "channel": "pong" }

Full heartbeat behavior: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/timeouts-and-heartbeats

Hyperliquid Python SDK and developer tools

Official SDK

  • Official Python SDK: Core SDK for interacting with Hyperliquid, including trading, market data, and account management.
  • SDK documentation: Guides, examples, and full API reference for the Python SDK.

Community SDKs

Analytics and Infrastructure

Core Documentation

Production considerations

Before building on Hyperliquid, account for the following:

Leverage Risk: Trading perpetuals involves leverage and volatility. Losses can exceed expectations if positions are not managed properly.

Market Risk: Order book systems can be influenced by manipulation strategies:

  • Spoofing, placing fake orders to mislead participants
  • Frontrunning, trading ahead of visible order flow

Latency Sensitivity: Although fast (~500ms blocks), performance depends heavily on:

  • Server location (recommended: us-east-1)
  • WebSocket reliability
  • Network conditions

Rate Limits: Two systems:

  • IP-based limits (REST usage)
  • Address-based limits (trading actions)

Improper design can throttle your system.

On-Chain Constraints: Even with high throughput:

  • Block timing still matters
  • Execution is deterministic
  • Failed transactions are possible

Key Management: All execution depends on private key signing:

  • Compromise = full account risk
  • Use secure key storage (HSM, vaults)

Liquidity Fragmentation: Not all markets have equal depth:

  • Smaller pairs may have thin books
  • Slippage can be significant

Conclusion

Hyperliquid represents a shift in exchange design: a fully on-chain order book with performance approaching centralized systems. By combining high throughput, low latency, and deterministic execution, it creates a new category of infrastructure for trading applications.

For developers, the platform is cleanly structured:

  • Info API for data
  • Exchange API for execution
  • WebSocket for real-time systems

The barrier to entry is low, with no API keys, standard EVM wallets, and simple SDKs, but the ceiling is high. You can build anything from lightweight dashboards to high-frequency trading systems on top of the same primitives.

The ecosystem is still early. Most advanced tooling such as analytics layers, strategy engines, and automation frameworks remains underbuilt.

That leaves a wide surface area for developers to explore.

The order book is on-chain.

Getting started with Hyperliquid on Chainstack

The public Hyperliquid endpoints work for experimentation, but production trading systems need something more reliable. Chainstack runs fully synced, managed Hyperliquid nodes — both mainnet and testnet — with private HTTPS and WebSocket RPC URLs, 99.9%+ uptime SLA, and global infrastructure optimized for low latency. You get dedicated access to both HyperCore and HyperEVM from one endpoint, without the overhead of running your own node or competing for throughput on a shared public API.

FAQ

What is the Hyperliquid Info API?

The Info API is Hyperliquid’s read-only data layer. It’s a single POST /info endpoint where the type field determines what you get — market metadata, order books, account positions, funding rates, and more. No authentication required.

How do I authenticate with the Hyperliquid Exchange API?

There are no API keys. Authentication is handled entirely through cryptographic signatures. L1 trading actions (orders, cancels) are signed with your private key on the “Exchange” domain using Msgpack. Administrative actions (withdrawals, transfers) use EIP-712 signing. The official Python SDK handles both automatically.

What is the difference between HyperCore and HyperEVM?

HyperCore is the trading engine — it runs the on-chain order book, matching engine, and liquidation logic. HyperEVM is the Ethereum-compatible execution layer where you deploy Solidity smart contracts. Both run under the same HyperBFT consensus and share the same state.

Does Hyperliquid have rate limits?

Yes, two separate systems. IP-based limits apply to REST requests via the Info API. Address-based limits apply to trading actions through the Exchange API. The thresholds are documented in the official rate limits reference.

How do I connect to the Hyperliquid WebSocket API?

Connect to wss://api.hyperliquid.xyz/ws (mainnet) or wss://api.hyperliquid-testnet.xyz/ws (testnet). Send a JSON subscription message with a method: "subscribe" field and your chosen feed type. Send a {"method": "ping"} every 20 seconds to keep the connection alive — the server closes idle connections after 60 seconds.

Can I use the Hyperliquid Python SDK on testnet?

Yes. The SDK exposes constants.TESTNET_API_URL for testnet. Actions signed for mainnet are not valid on testnet and vice versa. Always test on testnet with small amounts before connecting production keys.

Additional resources

SHARE THIS ARTICLE
Utkarshini Arora

Utkarshini Arora

A SheFi Scholar and dedicated Blockchain Researcher. As an educator and content creator, she focuses on creating clear tools and explanations that help developers understand and apply modern technologies.


Customer Stories

LinkPool

Maintaining unparalleled performance and up time under heavy network strain in securing the Chainlink oracle network.

Nexo

Nexo slashed Web3 infrastructure costs by a 5x margin using an Elastic Business data profile on Chainstack.

Brave Wallet

Brave Wallet optimizes cross-chain operations with reliable Chainstack RPC infrastructure, enhancing user experience and security.