Skip to content

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:

sh
npm install @siebly/hyperliquid-api
sh
pnpm add @siebly/hyperliquid-api
sh
yarn add @siebly/hyperliquid-api
sh
bun add @siebly/hyperliquid-api
sh
deno add npm:@siebly/hyperliquid-api
text
Package: @siebly/hyperliquid-api
npm: https://www.npmjs.com/package/@siebly/hyperliquid-api

For 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.

SetupGuides
Node.jsJavaScript or TypeScript
Alternative runtimesBun or Deno
Browser appsReact with Vite or Vite with plain JavaScript
Next.jsNode.js server Route Handler
Cloudflare WorkersPublic prices and authenticated orders
Mobile appsReact 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 ​

ClientPurpose
RestClientQuery market data and account state, or submit signed actions over HTTP.
WebsocketClientSubscribe to market data and account updates.
WebsocketAPIClientCall 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 ​

TaskGuide
Read prices, order books and candlesMarket data
Receive market updatesWebSocket subscriptions
Query accounts or configure a signerAuthentication
Choose a network and set timeoutsConfiguration

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-ws and axios for networking, ethers and @msgpack/msgpack for signing, fflate for compressed WebSocket messages, and events. The network libraries ws and axios are 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 ​

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.

Built by Siebly. Open source SDKs for exchange APIs.