Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/tiagosiebler/bitmart-api/llms.txt

Use this file to discover all available pages before exploring further.

The BitMart API SDK is a production-ready Node.js and TypeScript library for integrating with BitMart’s full trading platform. It covers every public and private REST endpoint across spot and futures markets, a unified WebSocket client with automatic reconnection, and ships with complete TypeScript type declarations for every request and response.

Quickstart

Install the SDK and make your first API call in minutes

Authentication

Set up API keys and understand HMAC signing

REST Clients

Explore RestClient for spot and FuturesClientV2 for futures

WebSocket Client

Subscribe to real-time market data and account updates

What’s included

The SDK exports three primary classes and a full set of TypeScript types:

RestClient

Spot trading, margin, account management, and earn products

FuturesClientV2

USD-M perpetual futures with V2 domain and demo trading support

WebsocketClient

Unified real-time client for all spot and futures streams

Get started

1

Install the package

npm install bitmart-api
2

Create a client

import { RestClient } from 'bitmart-api';

const client = new RestClient({
  apiKey: 'YOUR_API_KEY',
  apiSecret: 'YOUR_API_SECRET',
  apiMemo: 'YOUR_API_MEMO',
});
3

Make your first call

const tickers = await client.getSpotTickersV3();
console.log(tickers.data);
4

Subscribe to real-time data

import { WebsocketClient } from 'bitmart-api';

const ws = new WebsocketClient();
ws.on('update', (data) => console.log(data));
ws.subscribe('spot/ticker:BTC_USDT', 'spot');

Key features

Full TypeScript Support

Strongly-typed requests and responses for every endpoint. Autocomplete and compile-time safety out of the box.

Auto-Reconnecting WebSockets

Smart WebSocket persistence with heartbeat detection, automatic reconnection, and topic resubscription.

Browser Compatible

HMAC signing via the Web Crypto API works in both Node.js and browser environments without native modules.

ESM & CJS

Dual-build output. Import with import or require — the correct entry point is resolved automatically.

Demo Trading

Simulate futures strategies against BitMart’s demo environment using the same API keys.

Custom HMAC Signing

Inject a faster Node.js createHmac implementation instead of Web Crypto for high-throughput scenarios.

Build docs developers (and LLMs) love