Hyperliquid API SDK
@siebly/hyperliquid-api provides JavaScript and TypeScript clients for 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 |
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 a longer walkthrough, see the Hyperliquid JavaScript tutorial on Siebly.io.