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 package is a professional, production-ready SDK for the BitMart cryptocurrency exchange. It wraps every BitMart REST endpoint and WebSocket stream in a clean, promise-driven TypeScript interface — so you can build spot trading bots, futures strategies, and real-time dashboards without ever hand-rolling HTTP requests or WebSocket reconnection logic.

Quickstart

Install the SDK and make your first API call in under five minutes.

Authentication

Learn how API keys, secrets, and the memo field work together for signed requests.

REST Client

Full reference for the RestClient and FuturesClientV2 classes.

WebSockets

Subscribe to real-time spot and futures streams with automatic reconnection.

Main Exported Classes

The SDK exports three top-level client classes, each targeting a different part of the BitMart platform:
ClassPurpose
RestClientSpot trading, margin, and general account operations (V1 API domain)
FuturesClientV2USD-M futures trading (V2 API domain, includes demo trading support)
WebsocketClientUnified WebSocket client for public and private spot and futures streams
import { RestClient, FuturesClientV2, WebsocketClient } from 'bitmart-api';

Key Features

Full TypeScript Support

Strongly typed request parameters and response shapes for every endpoint. Your IDE will autocomplete arguments and catch mistakes at compile time.

ESM & CommonJS

The published npm package ships both ESM and CJS builds. Node.js automatically picks the correct entry point for your project.

Browser-Friendly Signing

HMAC-SHA256 request signing uses the Web Crypto API, so the SDK works in browser and edge-runtime environments without Node.js-specific crypto modules.

Auto-Reconnecting WebSockets

The WebsocketClient maintains persistent connections with built-in heartbeats. If a connection drops it reconnects and resubscribes automatically, emitting a reconnected event when ready.

Demo / Simulated Trading

Pass demoTrading: true to FuturesClientV2 or WebsocketClient to route requests to BitMart’s simulated environment — no real funds involved.

Custom HMAC Signing

Inject your own customSignMessageFn to use Node.js’s native createHmac for higher-throughput signing in latency-sensitive applications.

API Domains

ClientBase URL
RestClient (spot)https://api-cloud.bitmart.com
FuturesClientV2 (live)https://api-cloud-v2.bitmart.com
FuturesClientV2 (demo)https://demo-api-cloud-v2.bitmart.com

Build docs developers (and LLMs) love