Hyperliquid API SDK for JavaScript and TypeScript
@siebly/hyperliquid-api is a Hyperliquid JavaScript SDK for Node.js, with TypeScript types included, covering Hyperliquid market data, account queries, signed trading actions and WebSocket subscriptions.
Start with a public price request, then add account access, orders or streaming updates as needed.
JavaScript & TypeScript · v1.0.5 · MIT license
Installation
TypeScript definitions are included.
Install the npm package with your preferred tool:
npm install @siebly/hyperliquid-apipnpm add @siebly/hyperliquid-apiyarn add @siebly/hyperliquid-apibun add @siebly/hyperliquid-apideno add npm:@siebly/hyperliquid-apiPackage: @siebly/hyperliquid-api
npm: https://www.npmjs.com/package/@siebly/hyperliquid-apiFor other npm-compatible tools, use the same package from npm. Runtime-specific setup is covered below.
Choose your setup
Follow the guide for your runtime or framework. Each includes a complete project with commands to install dependencies and run it.
| Setup | Guides |
|---|---|
| Node.js | JavaScript or TypeScript |
| Alternative runtimes | Bun or Deno |
| Browser apps | React with Vite or Vite with plain JavaScript |
| Next.js | Node.js server Route Handler |
| Cloudflare Workers | Public prices and authenticated orders |
| Mobile apps | React Native / Expo for iOS and Android |
Browser and Expo guides include SDK-specific bundler configuration and polyfills where needed. See Runtime compatibility for tested versions, required configuration and what the checks cover.
First request
Follow the Node.js quickstart to read a public BTC price. It includes the complete JavaScript program, run command and expected output. No credentials are needed.
Clients
| Client | Purpose |
|---|---|
RestClient | Query market data and account state, or submit signed actions over HTTP. |
WebsocketClient | Subscribe to market data and account updates. |
WebsocketAPIClient | Call the REST client's methods over a WebSocket connection. |
See Clients for setup and cleanup, or the API reference for methods and types.
Common tasks
| Task | Guide |
|---|---|
| Read prices, order books and candles | Market data |
| Receive market updates | WebSocket subscriptions |
| Query accounts or configure a signer | Authentication |
| Choose a network and set timeouts | Configuration |
Why use JavaScript or TypeScript for the Hyperliquid API
The Hyperliquid API is the same REST and WebSocket interface in every language. This is the leading community maintained open-source JavaScript and TypeScript SDK for that API:
- One package covers perpetuals, Spot, HIP-3 markets, account queries, signed exchange actions, WebSocket streams and the WebSocket API.
- Plain JavaScript runs in Node.js with no compile step. TypeScript types ship with the package if you want them later.
- The same client works in Node.js, Bun, Deno, Cloudflare Workers, and browser apps.
- Signing, nonces, asset IDs, reconnects and resubscribes are handled by the SDK, on Mainnet and Testnet.
Why not build your own Hyperliquid client?
A basic info request is easy to write. The work is everything after it: EIP-712 and MessagePack action signing, API wallet (agent wallet) approvals, nonces that stay unique per signer, mapping coin names to asset IDs across perpetuals, Spot and HIP-3, WebSocket heartbeats, reconnects and resubscribes, rate limits, and keeping up when Hyperliquid changes the API. That work never really finishes, and it becomes a real maintenance burden over time, especially at scale when a platform runs several exchange integrations in production. Lean on ours instead, and spend your time on what matters.
If you build with AI coding agents, the same applies to your usage limits. Every hour or token spent rebuilding, debugging and maintaining exchange connectivity is one not spent on your actual product. Point your agent at this SDK and it can get straight to your trading logic.
Frequently raised questions:
- Dependencies: a short list of well known packages:
ws,isomorphic-wsandaxiosfor networking,ethersand@msgpack/msgpackfor signing,fflatefor compressed WebSocket messages, andevents. The network librarieswsandaxiosare pinned to exact versions. - Track record: built and maintained by Siebly, the team behind 10 open-source exchange SDKs dating back to 2017, with over 4.8 million npm downloads and more than 1,900 GitHub stars so far. Every change runs test suites against the live Hyperliquid REST and WebSocket APIs.
- Lock-in: MIT licensed and fully typed. Trading methods accept Hyperliquid's own coin names and asset IDs, so the official API docs still map directly to your code.
- Size of change: you can adopt it for one part of your app, such as market data or account streams, without rewriting the rest.
The quickstart is a public price request in plain JavaScript. No wallet or private key is required.
Next steps
- Run your first request.
- Read market data, order books and candles.
- Subscribe to WebSocket streams or use the WebSocket API.
- Set up an API wallet, the Hyperliquid API key, and authenticate.
- Use Testnet.
- Stay within rate limits.
- Prepare for production or troubleshoot a problem.
- Browse the complete API reference.
Using the SDK
Error handling covers failed requests and rejected orders. Production usage covers retries, recovery and shutdown. Start with Troubleshooting for a specific failure.
For an overview of the Hyperliquid JavaScript SDK and a longer walkthrough, see the Hyperliquid JavaScript tutorial on Siebly.io.