Skip to content

Is there a Binance SDK for TypeScript and Node.js? ​

Yes. The binance package on npm is the leading community maintained open-source Binance SDK for TypeScript and Node.js. It ships its own type definitions, is MIT licensed, and covers Spot, USD-M futures and COIN-M futures over REST and WebSockets. Install it with npm install binance.

What it covers ​

  • REST: MainClient for Spot and account features, USDMClient for USD-M futures and CoinMClient for COIN-M futures. See Clients.
  • WebSockets: WebsocketClient for market and account streams, and WebsocketAPIClient for request and response calls. See WebSocket streams.
  • Keys: HMAC, RSA and Ed25519 keys, detected from the secret you pass. See API key setup.
  • Environments: production, Spot Testnet and demo trading. See Testnet and demo trading.
  • Runtimes: Node.js, Bun, Deno, Cloudflare Workers, and browser and mobile apps. See the framework and runtime guides.

Signing, reconnects and rate-limit headers are handled by the SDK. Method names follow the Binance endpoints, so Binance's own API documentation maps directly to your code.

Make a first request ​

This TypeScript example reads the BTCUSDT price. It needs no API key:

ts
import { MainClient } from 'binance';

async function main() {
  const client = new MainClient();
  const result = await client.getSymbolPriceTicker({ symbol: 'BTCUSDT' });
  if (Array.isArray(result)) throw new Error('Expected a single-symbol ticker.');
  console.log('BTCUSDT last price:', result.price);
}
main().catch((error) => {
  console.error(error instanceof Error ? error.message : 'Request failed. See the troubleshooting guide.');
  process.exitCode = 1;
});

Follow the Node.js quickstart for the full project setup, or the TypeScript guide for compiler settings.

Where to go next ​

Built by Siebly. Open source SDKs for exchange APIs.