---
title: "BitMart JavaScript & TypeScript SDK for Node.js | Siebly"
description: "BitMart JavaScript SDK by Siebly with TypeScript-first REST and WebSocket clients, Node.js runtime guidance, examples, endpoint references, and release links."
canonical: "https://siebly.io/sdk/bitmart/javascript"
---

# BitMart JavaScript SDK

Build with the BitMart REST API and WebSockets using the JavaScript SDK, TypeScript-first declarations, and Node.js-compatible runtime patterns.

Use the same TypeScript-first REST API and WebSocket clients from plain JavaScript or TypeScript in Node.js-compatible runtimes.

## Install

```shell
# Via your favourite package manager, e.g. npm:
npm install bitmart-api
# or pnpm:
pnpm install bitmart-api
# or yarn:
yarn add bitmart-api
```

- [npm: bitmart-api](https://www.npmjs.com/package/bitmart-api)
- [GitHub repository](https://github.com/tiagosiebler/bitmart-api)
- [README](https://github.com/tiagosiebler/bitmart-api#readme)
- [BitMart examples](/examples/Bitmart)

## Coverage

- Spot
- Margin
- Futures
- WebSockets
- Framework-neutral JavaScript snippets that stay approachable in Node.js-compatible runtimes.
- TypeScript-first package declarations for stricter services, shared libraries, and editor-assisted integrations.

## Integration Profile

**REST API:** Use the BitMart SDK for spot, margin, futures, account, order, balance, and market data workflows that need exchange-specific REST clients.

**WebSockets:** Use WebSocket clients for BitMart market channels and private account/order streams where the SDK exposes matching subscription flows.

**Reliability:** Keep product and contract identifiers plus spot/margin/futures boundaries explicit; monitor response codes, rate limits, and stream reconnect behavior.

## Quickstart

Get started with just a few lines of JavaScript. TypeScript, while not required, is absolutely recommended. TypeScript declarations are included with all our SDKs and provide convenient definitions on request & response fields, WebSocket payloads, and generally safer integrations.

### REST API

Easily start calling Bitmart's spot REST APIs in JavaScript.

- Install the Bitmart JavaScript SDK via NPM: `npm install bitmart-api`.
- Import the RestClient class (REST API wrapper for Bitmart APIs).
- Create an authenticated RestClient instance with your API credentials (`apiKey`, `apiSecret`, `apiMemo`).
- Call REST API methods as functions and await the promise containing the response.

In this example, we:

- Prepare an authenticated REST client using environment variables.
- Submit a spot market sell order on `BTC_USDT` using `submitSpotOrderV2`.
- Log the full API response to the console.

Commented examples are also included in the script to show how to prepare market and limit buy order payloads.

For a full map of available REST API methods, check out the endpoint reference below.

```typescript
import { RestClient } from 'bitmart-api';

const account = {
  key: process.env.API_KEY || 'apiKeyHere',
  secret: process.env.API_SECRET || 'apiSecretHere',
  memo: process.env.API_MEMO || 'apiMemoHere',
};

async function start() {
  const client = new RestClient({
    apiKey: account.key,
    apiSecret: account.secret,
    apiMemo: account.memo,
  });

  try {
    // const usdValue = 6;
    // const price = 52000;
    // const qty = usdValue / price;

    // const limitBuyOrder = {
    //   symbol: 'BTC_USDT',
    //   side: 'buy',
    //   type: 'limit',
    //   size: String(qty),
    //   price: String(price),
    // };

    // const res = await client.submitSpotOrder({
    //   symbol: 'BTC_USDT',
    //   side: 'buy',
    //   type: 'market',
    //   size: String(qty),
    // });

    const res = await client.submitSpotOrderV2({
      symbol: 'BTC_USDT',
      side: 'sell',
      type: 'market',
      size: String(0.00011),
    });
    console.log('res ', JSON.stringify(res, null, 2));
  } catch (e) {
    console.error('Req error: ', e);
  }
}

start();
```

[View the source example](https://github.com/sieblyio/crypto-api-examples/blob/master/examples/Bitmart/Rest/Spot/spot-submit-order.ts)

### WebSocket Streams

Connecting to Bitmart's private spot WebSocket streams is straightforward with the WebsocketClient.

- Install the Bitmart JavaScript SDK via NPM: `npm install bitmart-api`.
- Import the WebsocketClient and (optionally) a custom logger.
- Create an authenticated WebsocketClient instance with your API credentials (`apiKey`, `apiSecret`, `apiMemo`).
- Configure event handlers for key events such as `open`, `update`, `response`, `reconnect`, `reconnected`, `close`, `authenticated`, and `exception`.
- Subscribe to private spot topics and process incoming updates in real time.

In this example, we:

- Open an authenticated private WebSocket connection for spot.
- Subscribe to order progress updates for `BTC_USDT`.
- Demonstrate an additional (commented) private balance update topic.

This setup allows you to consume live account-level trading events without polling REST endpoints.

```typescript
import { LogParams, WebsocketClient } from 'bitmart-api';

const account = {
  key: process.env.API_KEY || 'apiKeyHere',
  secret: process.env.API_SECRET || 'apiSecretHere',
  memo: process.env.API_MEMO || 'apiMemoHere',
};

const customLogger = {
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  trace: (...params: LogParams): void => {
    console.log('trace', ...params);
  },
  info: (...params: LogParams): void => {
    console.log('info', ...params);
  },
  error: (...params: LogParams): void => {
    console.error('error', ...params);
  },
};

async function start() {
  const client = new WebsocketClient(
    {
      apiKey: account.key,
      apiSecret: account.secret,
      apiMemo: account.memo,
    },
    customLogger,
  );

  client.on('open', (data) => {
    console.log('connected ', data?.wsKey);
  });

  // Data received
  client.on('update', (data) => {
    console.info('data received: ', JSON.stringify(data));
  });

  // Something happened, attempting to reconnect
  client.on('reconnect', (data) => {
    console.log('reconnect: ', data);
  });

  // Reconnect successful
  client.on('reconnected', (data) => {
    console.log('reconnected: ', data);
  });

  // Connection closed. If unexpected, expect reconnect -> reconnected.
  client.on('close', (data) => {
    console.error('close: ', data);
  });

  // Reply to a request, e.g. "subscribe"/"unsubscribe"/"authenticate"
  client.on('response', (data) => {
    console.info('response: ', data);
  });

  client.on('exception', (data) => {
    console.error('exception: ', data);
  });

  client.on('authenticated', (data) => {
    console.error('authenticated: ', data);
  });

  try {
    // order progress
    client.subscribe('spot/user/order:BTC_USDT', 'spot');

    // balance updates
    // client.subscribe('spot/user/balance:BALANCE_UPDATE', 'spot');
  } catch (e) {
    console.error('Req error: ', e);
  }
}

start();
```

[View the source example](https://github.com/sieblyio/crypto-api-examples/blob/master/examples/Bitmart/Websocket/ws-spot-private.ts)

## Endpoint Reference

[View the endpoint map source](https://github.com/tiagosiebler/bitmart-api/blob/master/docs/endpointFunctionList.md)

### Endpoint maps

<p align="center">
  <a href="https://www.npmjs.com/package/bitmart-api">
    <picture>
      <source media="(prefers-color-scheme: dark)" srcset="https://github.com/tiagosiebler/bitmart-api/blob/master/docs/images/logoDarkMode2.svg?raw=true#gh-dark-mode-only">
      <img alt="SDK Logo" src="https://github.com/tiagosiebler/bitmart-api/blob/master/docs/images/logoBrightMode2.svg?raw=true#gh-light-mode-only">
    </picture>
  </a>
</p>

Each REST client is a JavaScript class, which provides functions individually mapped to each endpoint available in the exchange's API offering.

The following table shows all methods available in each REST client, whether the method requires authentication (automatically handled if API keys are provided), as well as the exact endpoint each method is connected to.

This can be used to easily find which method to call, once you have [found which endpoint you're looking to use](https://github.com/tiagosiebler/awesome-crypto-examples/wiki/How-to-find-SDK-functions-that-match-API-docs-endpoint).

All REST clients are in the [src](https://github.com/tiagosiebler/bitmart-api/tree/master/src) folder. For usage examples, make sure to check the [examples](https://github.com/tiagosiebler/bitmart-api/tree/master/examples) folder.

List of clients:

- [RestClient](#restclientts)
- [FuturesClientV2](#futuresclientv2ts)

If anything is missing or wrong, please open an issue or let us know in our [Node.js Traders](https://t.me/nodetraders) telegram group!

#### How to use table

Table consists of 4 parts:

- Function name
- AUTH
- HTTP Method
- Endpoint

**Function name** is the name of the function that can be called through the SDK. Check examples folder in the repo for more help on how to use them!

**AUTH** is a boolean value that indicates if the function requires authentication - which means you need to pass your API key and secret to the SDK.

**HTTP Method** shows HTTP method that the function uses to call the endpoint. Sometimes endpoints can have same URL, but different HTTP method so you can use this column to differentiate between them.

**Endpoint** is the URL that the function uses to call the endpoint. Best way to find exact function you need for the endpoint is to search for URL in this table and find corresponding function name.

### RestClient.ts

This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in [RestClient.ts](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts).

| Function                                                                                                                   | AUTH | HTTP Method | Endpoint                                             |
| -------------------------------------------------------------------------------------------------------------------------- | :--: | :---------: | ---------------------------------------------------- |
| [getSystemTime()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L240)                          |      |     GET     | `system/time`                                        |
| [getSystemStatus()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L244)                        |      |     GET     | `system/service`                                     |
| [getSpotCurrenciesV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L254)                    |      |     GET     | `spot/v1/currencies`                                 |
| [getSpotTradingPairsV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L260)                  |      |     GET     | `spot/v1/symbols`                                    |
| [getSpotTradingPairDetailsV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L264)            |      |     GET     | `spot/v1/symbols/details`                            |
| [getSpotTickersV3()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L270)                       |      |     GET     | `spot/quotation/v3/tickers`                          |
| [getSpotTickerV3()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L274)                        |      |     GET     | `spot/quotation/v3/ticker`                           |
| [getSpotLatestKlineV3()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L280)                   |      |     GET     | `spot/quotation/v3/lite-klines`                      |
| [getSpotHistoryKlineV3()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L286)                  |      |     GET     | `spot/quotation/v3/klines`                           |
| [getSpotOrderBookDepthV3()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L292)                |      |     GET     | `spot/quotation/v3/books`                            |
| [getSpotRecentTrades()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L299)                    |      |     GET     | `spot/quotation/v3/trades`                           |
| [getSpotTickersV2()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L315)                       |      |     GET     | `spot/v2/ticker`                                     |
| [getSpotTickerV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L322)                        |      |     GET     | `spot/v1/ticker_detail`                              |
| [getSpotKLineStepsV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L331)                    |      |     GET     | `spot/v1/steps`                                      |
| [getSpotKlinesV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L338)                        |      |     GET     | `spot/v1/symbols/kline`                              |
| [getSpotOrderBookDepthV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L347)                |      |     GET     | `spot/v1/symbols/book`                               |
| [getAccountBalancesV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L359)                   |  🔐  |     GET     | `account/v1/wallet`                                  |
| [getAccountInfoV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L369)                       |  🔐  |     GET     | `uapi-key/v1/account/info`                           |
| [submitAccountTransferV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L377)                |  🔐  |     POST    | `account/v1/transfer`                                |
| [getAccountCurrenciesV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L383)                 |      |     GET     | `account/v1/currencies`                              |
| [getSpotWalletBalanceV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L389)                 |  🔐  |     GET     | `spot/v1/wallet`                                     |
| [getAccountDepositAddressV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L395)             |  🔐  |     GET     | `account/v1/deposit/address`                         |
| [getAccountWithdrawQuotaV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L401)              |  🔐  |     GET     | `account/v1/withdraw/charge`                         |
| [submitWithdrawalV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L407)                     |  🔐  |     POST    | `account/v1/withdraw/apply`                          |
| [getWithdrawAddressList()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L413)                 |  🔐  |     GET     | `account/v1/withdraw/address/list`                   |
| [getDepositWithdrawHistoryV2()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L421)            |  🔐  |     GET     | `account/v2/deposit-withdraw/history`                |
| [getDepositWithdrawDetailV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L427)             |  🔐  |     GET     | `account/v1/deposit-withdraw/detail`                 |
| [getMarginAccountDetailsV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L433)              |  🔐  |     GET     | `spot/v1/margin/isolated/account`                    |
| [submitMarginAssetTransferV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L439)            |  🔐  |     POST    | `spot/v1/margin/isolated/transfer`                   |
| [getBasicSpotFeeRateV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L445)                  |  🔐  |     GET     | `spot/v1/user_fee`                                   |
| [getActualSpotTradeFeeRateV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L449)            |  🔐  |     GET     | `spot/v1/trade_fee`                                  |
| [submitSpotOrderV2()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L461)                      |  🔐  |     POST    | `spot/v2/submit_order`                               |
| [submitMarginOrderV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L467)                    |  🔐  |     POST    | `spot/v1/margin/submit_order`                        |
| [submitSpotBatchOrdersV2()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L476)                |  🔐  |     POST    | `spot/v2/batch_orders`                               |
| [cancelSpotOrderV3()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L482)                      |  🔐  |     POST    | `spot/v3/cancel_order`                               |
| [submitSpotBatchOrdersV4()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L488)                |  🔐  |     POST    | `spot/v4/batch_orders`                               |
| [cancelSpotBatchOrdersV4()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L499)                |  🔐  |     POST    | `spot/v4/cancel_orders`                              |
| [cancelAllSpotOrders()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L505)                    |  🔐  |     POST    | `spot/v4/cancel_all`                                 |
| [cancelSpotOrdersV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L515)                     |  🔐  |     POST    | `spot/v1/cancel_orders`                              |
| [getSpotOrderByIdV4()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L525)                     |  🔐  |     POST    | `spot/v4/query/order`                                |
| [getSpotOrderByClientOrderIdV4()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L534)          |  🔐  |     POST    | `spot/v4/query/client-order`                         |
| [getSpotOpenOrdersV4()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L540)                    |  🔐  |     POST    | `spot/v4/query/open-orders`                          |
| [getSpotHistoricOrdersV4()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L546)                |  🔐  |     POST    | `spot/v4/query/history-orders`                       |
| [getSpotAccountTradesV4()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L555)                 |  🔐  |     POST    | `spot/v4/query/trades`                               |
| [getSpotAccountOrderTradesV4()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L564)            |  🔐  |     POST    | `spot/v4/query/order-trades`                         |
| [submitSpotAlgoOrderV4()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L571)                  |  🔐  |     POST    | `spot/v4/algo/submit_order`                          |
| [cancelSpotAlgoOrderV4()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L577)                  |  🔐  |     POST    | `spot/v4/algo/cancel_order`                          |
| [cancelAllSpotAlgoOrdersV4()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L583)              |  🔐  |     POST    | `spot/v4/algo/cancel_all`                            |
| [getSpotAlgoOrderByIdV4()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L589)                 |  🔐  |     POST    | `spot/v4/query/algo/order`                           |
| [getSpotAlgoOrderByClientOrderIdV4()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L595)      |  🔐  |     POST    | `spot/v4/query/algo/client-order`                    |
| [getSpotAlgoOpenOrdersV4()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L601)                |  🔐  |     POST    | `spot/v4/query/algo/open-orders`                     |
| [getSpotAlgoHistoryOrdersV4()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L607)             |  🔐  |     POST    | `spot/v4/query/algo/history-orders`                  |
| [marginBorrowV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L619)                         |  🔐  |     POST    | `spot/v1/margin/isolated/borrow`                     |
| [marginRepayV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L625)                          |  🔐  |     POST    | `spot/v1/margin/isolated/repay`                      |
| [getMarginBorrowRecordV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L631)                |  🔐  |     GET     | `spot/v1/margin/isolated/borrow_record`              |
| [getMarginRepayRecordV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L637)                 |  🔐  |     GET     | `spot/v1/margin/isolated/repay_record`               |
| [getMarginBorrowingRatesV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L646)              |  🔐  |     GET     | `spot/v1/margin/isolated/pairs`                      |
| [submitMainTransferSubToMainV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L661)          |  🔐  |     POST    | `account/sub-account/main/v1/sub-to-main`            |
| [submitSubTransferSubToMainV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L670)           |  🔐  |     POST    | `account/sub-account/sub/v1/sub-to-main`             |
| [submitMainTransferMainToSubV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L676)          |  🔐  |     POST    | `account/sub-account/main/v1/main-to-sub`            |
| [submitMainTransferSubToSubV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L682)           |  🔐  |     POST    | `account/sub-account/main/v1/sub-to-sub`             |
| [submitSubTransferSubToSubV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L688)            |  🔐  |     POST    | `account/sub-account/sub/v1/sub-to-sub`              |
| [getSubTransfersV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L694)                      |  🔐  |     GET     | `account/sub-account/main/v1/transfer-list`          |
| [getAccountSubTransfersV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L700)               |  🔐  |     GET     | `account/sub-account/v1/transfer-history`            |
| [getSubSpotWalletBalancesV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L706)             |  🔐  |     GET     | `account/sub-account/main/v1/wallet`                 |
| [getSubAccountsV1()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L712)                       |  🔐  |     GET     | `account/sub-account/main/v1/subaccount-list`        |
| [getFuturesContractDetails()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L733)              |      |     GET     | `contract/public/details`                            |
| [getFuturesContractDepth()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L742)                |      |     GET     | `contract/public/depth`                              |
| [getFuturesOpenInterest()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L751)                 |      |     GET     | `contract/public/open-interest`                      |
| [getFuturesFundingRate()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L760)                  |      |     GET     | `contract/public/funding-rate`                       |
| [getFuturesKlines()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L769)                       |      |     GET     | `contract/public/kline`                              |
| [getFuturesAccountAssets()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L784)                |  🔐  |     GET     | `contract/private/assets-detail`                     |
| [getFuturesAccountOrder()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L797)                 |  🔐  |     GET     | `contract/private/order`                             |
| [getFuturesAccountOrderHistory()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L806)          |  🔐  |     GET     | `contract/private/order-history`                     |
| [getFuturesAccountOpenOrders()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L815)            |  🔐  |     GET     | `contract/private/get-open-orders`                   |
| [getFuturesAccountPlanOrders()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L824)            |  🔐  |     GET     | `contract/private/current-plan-order`                |
| [getFuturesAccountPositions()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L833)             |  🔐  |     GET     | `contract/private/position`                          |
| [getPositionRiskDetails()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L842)                 |  🔐  |     GET     | `contract/private/position-risk`                     |
| [getFuturesAccountTrades()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L851)                |  🔐  |     GET     | `contract/private/trades`                            |
| [getFuturesTransfers()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L860)                    |  🔐  |     GET     | `account/v1/transfer-contract-list`                  |
| [submitFuturesOrder()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L871)                     |  🔐  |     POST    | `contract/private/submit-order`                      |
| [cancelFuturesOrder()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L879)                     |  🔐  |     POST    | `contract/private/cancel-order`                      |
| [cancelAllFuturesOrders()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L888)                 |  🔐  |     POST    | `contract/private/cancel-orders`                     |
| [submitFuturesPlanOrder()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L897)                 |  🔐  |     POST    | `contract/private/submit-plan-order`                 |
| [cancelFuturesPlanOrder()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L908)                 |  🔐  |     POST    | `contract/private/cancel-plan-order`                 |
| [submitFuturesTransfer()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L917)                  |  🔐  |     POST    | `account/v1/transfer-contract`                       |
| [setFuturesLeverage()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L926)                     |  🔐  |     POST    | `contract/private/submit-leverage`                   |
| [submitFuturesSubToMainTransferFromMain()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L941) |  🔐  |     POST    | `account/contract/sub-account/main/v1/sub-to-main`   |
| [submitFuturesMainToSubTransferFromMain()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L953) |  🔐  |     POST    | `account/contract/sub-account/main/v1/main-to-sub`   |
| [submitFuturesSubToMainSubFromSub()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L965)       |  🔐  |     POST    | `account/contract/sub-account/sub/v1/sub-to-main`    |
| [getFuturesSubWallet()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L977)                    |  🔐  |     GET     | `account/contract/sub-account/main/v1/wallet`        |
| [getFuturesSubTransfers()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L991)                 |  🔐  |     GET     | `account/contract/sub-account/main/v1/transfer-list` |
| [getFuturesSubTransferHistory()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1003)          |  🔐  |     GET     | `account/contract/sub-account/v1/transfer-history`   |
| [getFuturesAffiliateRebates()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1021)            |  🔐  |     GET     | `contract/private/affiliate/rebate-list`             |
| [getFuturesAffiliateTrades()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1030)             |  🔐  |     GET     | `contract/private/affiliate/trade-list`              |
| [getEarnAccountPosition()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1042)                |  🔐  |     GET     | `newearn/cloud/v1/earn`                              |
| [getFlexibleSavingProducts()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1046)             |  🔐  |     GET     | `newearn/cloud/v1/saving/product`                    |
| [subscribeFlexibleSaving()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1052)               |  🔐  |     POST    | `newearn/cloud/v1/saving/subscribe`                  |
| [redeemFlexibleSaving()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1058)                  |  🔐  |     POST    | `newearn/cloud/v1/saving/redeem`                     |
| [getFlexibleSavingPositions()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1064)            |  🔐  |     GET     | `newearn/cloud/v1/saving/earn`                       |
| [getFlexibleSavingHistory()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1070)              |  🔐  |     GET     | `newearn/cloud/v1/saving/record`                     |
| [getFixedSavingProducts()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1076)                |  🔐  |     GET     | `newearn/cloud/v1/saving/fixed/product`              |
| [subscribeFixedSaving()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1082)                  |  🔐  |     POST    | `newearn/cloud/v1/saving/fixed/subscribe`            |
| [getFixedSavingPositions()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1088)               |  🔐  |     GET     | `newearn/cloud/v1/saving/fixed/earn`                 |
| [getFixedSavingHistory()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1094)                 |  🔐  |     GET     | `newearn/cloud/v1/saving/fixed/record`               |
| [redeemFixedSavingEarly()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1100)                |  🔐  |     POST    | `newearn/cloud/v1/saving/fixed/redeem`               |
| [updateFixedSavingAutoReinvest()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1106)         |  🔐  |     POST    | `newearn/cloud/v1/saving/fixed/subscribe/operate`    |
| [setAutoSavingBatch()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1115)                    |  🔐  |     POST    | `newearn/cloud/v1/saving/subscribe/batch/operate`    |
| [getAutoSavingBatchStatus()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1124)              |  🔐  |     GET     | `newearn/cloud/v1/saving/subscribe/batch`            |
| [setFlexibleSavingAutoSubscribe()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1128)        |  🔐  |     POST    | `newearn/cloud/v1/saving/subscribe/operate`          |
| [getFlexibleSavingAutoSubscribeStatus()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1137)  |  🔐  |     GET     | `newearn/cloud/v1/saving/subscribe/status`           |
| [getBrokerRebate()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/RestClient.ts#L1149)                       |  🔐  |     GET     | `spot/v1/broker/rebate`                              |

### FuturesClientV2.ts

This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in [FuturesClientV2.ts](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts).

| Function                                                                                                                          | AUTH | HTTP Method | Endpoint                                             |
| --------------------------------------------------------------------------------------------------------------------------------- | :--: | :---------: | ---------------------------------------------------- |
| [getSystemTime()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L113)                            |      |     GET     | `system/time`                                        |
| [getSystemStatus()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L117)                          |      |     GET     | `system/service`                                     |
| [getFuturesContractDetails()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L138)                |      |     GET     | `contract/public/details`                            |
| [getFuturesContractDepth()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L144)                  |      |     GET     | `contract/public/depth`                              |
| [getFuturesMarketTrade()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L150)                    |      |     GET     | `contract/public/market-trade`                       |
| [getFuturesOpenInterest()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L157)                   |      |     GET     | `contract/public/open-interest`                      |
| [getFuturesFundingRate()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L163)                    |      |     GET     | `contract/public/funding-rate`                       |
| [getFuturesFundingRateV2()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L173)                  |      |     GET     | `contract/public/funding-rate-v2`                    |
| [getFuturesKlines()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L179)                         |      |     GET     | `contract/public/kline`                              |
| [getFuturesMarkPriceKlines()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L185)                |      |     GET     | `contract/public/markprice-kline`                    |
| [getFuturesFundingRateHistory()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L191)             |      |     GET     | `contract/public/funding-rate-history`               |
| [getFuturesLeverageBracket()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L207)                |      |     GET     | `contract/public/leverage-bracket`                   |
| [getFuturesAccountAssets()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L221)                  |  🔐  |     GET     | `contract/private/assets-detail`                     |
| [getFuturesTradeFeeRate()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L231)                   |  🔐  |     GET     | `contract/private/trade-fee-rate`                    |
| [getFuturesAccountOrder()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L241)                   |  🔐  |     GET     | `contract/private/order`                             |
| [getFuturesAccountOrderHistory()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L247)            |  🔐  |     GET     | `contract/private/order-history`                     |
| [getFuturesAccountOpenOrders()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L253)              |  🔐  |     GET     | `contract/private/get-open-orders`                   |
| [getFuturesAccountPlanOrders()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L259)              |  🔐  |     GET     | `contract/private/current-plan-order`                |
| [getFuturesAccountPositions()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L265)               |  🔐  |     GET     | `contract/private/position`                          |
| [getFuturesAccountPositionsV2()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L272)             |  🔐  |     GET     | `contract/private/position-v2`                       |
| [getPositionRiskDetails()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L282)                   |  🔐  |     GET     | `contract/private/position-risk`                     |
| [getFuturesAccountTrades()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L289)                  |  🔐  |     GET     | `contract/private/trades`                            |
| [getFuturesAccountTransactionHistory()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L295)      |  🔐  |     GET     | `contract/private/transaction-history`               |
| [getFuturesAutoRepayment()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L304)                  |  🔐  |     GET     | `contract/private/auto_repayment`                    |
| [getFuturesCrossCollateralInterestLog()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L313)     |  🔐  |     GET     | `contract/private/cross_collateral/interest_log`     |
| [getFuturesTransfers()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L322)                      |  🔐  |     GET     | `account/v1/transfer-contract-list`                  |
| [submitFuturesOrder()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L330)                       |  🔐  |     POST    | `contract/private/submit-order`                      |
| [updateFuturesLimitOrder()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L336)                  |  🔐  |     POST    | `contract/private/modify-limit-order`                |
| [cancelFuturesOrder()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L345)                       |  🔐  |     POST    | `contract/private/cancel-order`                      |
| [cancelAllFuturesOrders()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L351)                   |  🔐  |     POST    | `contract/private/cancel-orders`                     |
| [cancelAllFuturesOrdersAfter()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L357)              |  🔐  |     POST    | `contract/private/cancel-all-after`                  |
| [closeAllFuturesPositions()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L368)                 |  🔐  |     POST    | `contract/private/close-all-position`                |
| [submitFuturesPlanOrder()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L374)                   |  🔐  |     POST    | `contract/private/submit-plan-order`                 |
| [cancelFuturesPlanOrder()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L382)                   |  🔐  |     POST    | `contract/private/cancel-plan-order`                 |
| [submitFuturesTransfer()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L388)                    |  🔐  |     POST    | `account/v1/transfer-contract`                       |
| [submitFuturesFundingAccountTransfer()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L398)      |  🔐  |     POST    | `contract/private/account/v1/transfer`               |
| [setFuturesLeverage()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L404)                       |  🔐  |     POST    | `contract/private/submit-leverage`                   |
| [submitFuturesTPSLOrder()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L410)                   |  🔐  |     POST    | `contract/private/submit-tp-sl-order`                |
| [updateFuturesPlanOrder()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L419)                   |  🔐  |     POST    | `contract/private/modify-plan-order`                 |
| [updateFuturesPresetPlanOrder()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L427)             |  🔐  |     POST    | `contract/private/modify-preset-plan-order`          |
| [updateFuturesTPSLOrder()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L440)                   |  🔐  |     POST    | `contract/private/modify-tp-sl-order`                |
| [submitFuturesTrailOrder()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L448)                  |  🔐  |     POST    | `contract/private/submit-trail-order`                |
| [cancelFuturesTrailOrder()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L456)                  |  🔐  |     POST    | `contract/private/cancel-trail-order`                |
| [setPositionMode()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L465)                          |  🔐  |     POST    | `contract/private/set-position-mode`                 |
| [getPositionMode()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L474)                          |  🔐  |     GET     | `contract/private/get-position-mode`                 |
| [submitFuturesSubToMainTransferFromMain()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L486)   |  🔐  |     POST    | `account/contract/sub-account/main/v1/sub-to-main`   |
| [submitFuturesMainToSubTransferFromMain()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L495)   |  🔐  |     POST    | `account/contract/sub-account/main/v1/main-to-sub`   |
| [submitFuturesSubToMainSubFromSub()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L504)         |  🔐  |     POST    | `account/contract/sub-account/sub/v1/sub-to-main`    |
| [getFuturesSubWallet()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L513)                      |  🔐  |     GET     | `account/contract/sub-account/main/v1/wallet`        |
| [getFuturesSubTransfers()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L524)                   |  🔐  |     GET     | `account/contract/sub-account/main/v1/transfer-list` |
| [getFuturesSubTransferHistory()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L533)             |  🔐  |     GET     | `account/contract/sub-account/v1/transfer-history`   |
| [getFuturesAffiliateRebates()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L548)               |  🔐  |     GET     | `contract/private/affiliate/rebate-list`             |
| [getFuturesAffiliateTrades()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L554)                |  🔐  |     GET     | `contract/private/affiliate/trade-list`              |
| [getFuturesAffiliateRebateUser()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L564)            |  🔐  |     GET     | `contract/private/affiliate/rebate-user`             |
| [getFuturesAffiliateInviteCheck()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L574)           |  🔐  |     GET     | `contract/private/affiliate/invite-check`            |
| [getFuturesAffiliateCustomerInfo()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L584)          |  🔐  |     GET     | `contract/private/affiliate/aff-customer-info`       |
| [getFuturesAffiliateRebateInviteUser()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L598)      |  🔐  |     GET     | `contract/private/affiliate/rebate-inviteUser`       |
| [getFuturesAffiliateRebateApi()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L612)             |  🔐  |     GET     | `contract/private/affiliate/rebate-api`              |
| [getFuturesAffiliateDepositWithdrawalList()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L622) |  🔐  |     GET     | `contract/private/affiliate/deposit-withdrawal-list` |
| [submitFuturesSimulatedClaim()](https://github.com/tiagosiebler/bitmart-api/blob/master/src/FuturesClientV2.ts#L647)              |  🔐  |     POST    | `contract/private/claim`                             |

## BitMart JavaScript FAQ

### What does the BitMart JavaScript SDK cover?

BitMart supports Spot, Margin, Futures, and WebSockets workflows. The JavaScript guide covers the main REST and WebSocket integration patterns.

### How do I authenticate private BitMart API calls in JavaScript?

Install bitmart-api from npm & pass API credentials into the SDK client options, as shown in the BitMart JavaScript examples above. The SDK handles the exchange-specific signing requirements for private requests.

### Does the BitMart JavaScript SDK help with WebSocket connection management?

Yes. Use the SDK WebSocket client for subscriptions, reconnect handling, and stream lifecycle management instead of building raw socket flows yourself.

### Where should I start on the BitMart JavaScript page: REST or WebSocket?

Start with the REST quick start for installation, authentication, and request and response flows. Move to the WebSocket example when you need streaming market or account updates.

## Machine Resources

- [AI prompt framework](/ai)
- [LLM discovery](/llms.txt)
- [SDK catalog](/.well-known/siebly-sdk-catalog.json)
- [Agent skill](/.well-known/agent-skills/siebly-crypto-exchange-api/SKILL.md)
