HTX API SDK
@siebly/htx-api provides JavaScript and TypeScript clients for HTX Spot and futures APIs. Read market data, access account balances, manage orders and subscribe to public and private WebSocket channels.
JavaScript & TypeScript · v1.0.8 · MIT license
Installation
TypeScript definitions are included.
Install the npm package with your preferred tool:
npm install @siebly/htx-apipnpm add @siebly/htx-apiyarn add @siebly/htx-apibun add @siebly/htx-apideno add npm:@siebly/htx-apiPackage: @siebly/htx-api
npm: https://www.npmjs.com/package/@siebly/htx-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 setup for project recipes and required configuration.
First request
Start with the Node.js quickstart to read a public Bitcoin/USDT Spot price without credentials. The guides begin with Spot and explain where futures clients and connection keys differ. Examples use production services. See Testing without orders before enabling trading.
Choose a client
- SpotClient: Spot market data, balances, orders, margin and account operations.
- FuturesClient: futures market data and trading, including linear swaps, coin-margined swaps, delivery contracts and V5 endpoints.
- WebsocketClient: public market subscriptions and private account updates across HTX products.
- WebsocketAPIClient: promise-based Spot and derivatives trading commands over WebSockets.
Next steps
- Read market data or subscribe to prices.
- Read Spot balances and receive private updates.
- Manage Spot orders or send WebSocket trading requests.
- Choose a runtime setup, including Cloudflare Workers, or browse the API reference.