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 spot market data endpoints are all public — no API key is required. Use them to retrieve real-time price quotes, candlestick (kline) history, order book snapshots, recent trades, and the full list of supported currencies and trading pairs. All methods are available on the RestClient class from the bitmart-api package and return typed Promise responses.

Installation & Setup

import { RestClient } from 'bitmart-api';

const client = new RestClient();
// No credentials needed for public market data endpoints

System Endpoints

getSystemTime()

Returns the current server time in milliseconds. Useful for clock-sync checks and diagnosing timestamp errors.
getSystemTime(): Promise<APIResponse<{ server_time: number }>>
import { RestClient } from 'bitmart-api';

const client = new RestClient();

const response = await client.getSystemTime();
console.log('Server time (ms):', response.data.server_time);

getSystemStatus()

Returns the operational status of all BitMart services. Check this endpoint before trading to detect scheduled maintenance windows.
getSystemStatus(): Promise<APIResponse<{ service: ServiceStatus[] }>>
Response — ServiceStatus fields:
FieldTypeDescription
titlestringService name
service_typestringType identifier
statusnumber0 = normal, 1 = maintenance
start_timenumberMaintenance start (ms)
end_timenumberMaintenance end (ms)
import { RestClient } from 'bitmart-api';

const client = new RestClient();

const response = await client.getSystemStatus();
for (const svc of response.data.service) {
  const state = svc.status === 0 ? '✅ Normal' : '🔧 Maintenance';
  console.log(`${svc.title}: ${state}`);
}

Currencies & Trading Pairs

getSpotCurrenciesV1()

Returns all currencies supported on BitMart spot, including their deposit and withdrawal availability.
getSpotCurrenciesV1(): Promise<APIResponse<{ currencies: SpotCurrencyV1[] }>>
Response — SpotCurrencyV1 fields:
FieldTypeDescription
idstringCurrency ID (e.g. "BTC")
namestringFull currency name
withdraw_enabledbooleanWhether withdrawal is enabled
deposit_enabledbooleanWhether deposit is enabled
import { RestClient } from 'bitmart-api';

const client = new RestClient();

const response = await client.getSpotCurrenciesV1();
const active = response.data.currencies.filter(
  (c) => c.deposit_enabled && c.withdraw_enabled,
);
console.log(`Active currencies: ${active.length}`);
console.log(active.slice(0, 3));

getSpotTradingPairsV1()

Returns a flat list of all active spot trading pair symbols (e.g. ["BTC_USDT", "ETH_USDT", ...]).
getSpotTradingPairsV1(): Promise<APIResponse<{ symbols: string[] }>>
import { RestClient } from 'bitmart-api';

const client = new RestClient();

const response = await client.getSpotTradingPairsV1();
console.log('Total pairs:', response.data.symbols.length);
console.log('First 5:', response.data.symbols.slice(0, 5));

getSpotTradingPairDetailsV1()

Returns full details for all spot trading pairs including precision rules, minimum order sizes, and quote increments.
getSpotTradingPairDetailsV1(): Promise<APIResponse<{ symbols: SpotTradingPairDetailsV1[] }>>
Response — SpotTradingPairDetailsV1 fields:
FieldTypeDescription
symbolstringTrading pair symbol
base_currencystringBase asset (e.g. "BTC")
quote_currencystringQuote asset (e.g. "USDT")
quote_incrementstringMinimum price increment
base_min_sizestringMinimum base order size
base_max_sizestringMaximum base order size
price_min_precisionnumberMinimum price decimal places
price_max_precisionnumberMaximum price decimal places
min_buy_amountstringMinimum buy quote value
min_sell_amountstringMinimum sell base value
import { RestClient } from 'bitmart-api';

const client = new RestClient();

const response = await client.getSpotTradingPairDetailsV1();
const btcUsdt = response.data.symbols.find((s) => s.symbol === 'BTC_USDT');

if (btcUsdt) {
  console.log('BTC_USDT min buy amount:', btcUsdt.min_buy_amount);
  console.log('Price precision:', btcUsdt.price_max_precision);
}

Tickers (V3 — Current)

getSpotTickersV3()

Returns all spot tickers in compact array format. Each element is a fixed-position tuple.
getSpotTickersV3(): Promise<APIResponse<ArrayFormSpotTickerV3[]>>
ArrayFormSpotTickerV3 tuple positions:
IndexFieldDescription
[0]symbolTrading pair
[1]lastLast traded price
[2]v_24h24h base volume
[3]qv_24h24h quote volume
[4]open_24h24h open price
[5]high_24h24h high price
[6]low_24h24h low price
[7]fluctuation24h price change %
[8]bid_pxBest bid price
[9]bid_szBest bid size
[10]ask_pxBest ask price
[11]ask_szBest ask size
[12]tsTimestamp (ms)
import { RestClient } from 'bitmart-api';

const client = new RestClient();

const response = await client.getSpotTickersV3();
// Destructure the array format
const [symbol, last, v24h, , , high24h, low24h] = response.data[0];
console.log(`${symbol}: last=${last}, high=${high24h}, low=${low24h}`);

getSpotTickerV3(params?)

Returns the full ticker object for a single trading pair. When called without params, returns the first available ticker.
getSpotTickerV3(params?: { symbol: string }): Promise<APIResponse<SpotTickerV3>>
symbol
string
required
Trading pair symbol, e.g. BTC_USDT.
import { RestClient } from 'bitmart-api';

const client = new RestClient();

const response = await client.getSpotTickerV3({ symbol: 'BTC_USDT' });
const ticker = response.data;

console.log(`BTC_USDT`);
console.log(`  Last:       ${ticker.last}`);
console.log(`  24h High:   ${ticker.high_24h}`);
console.log(`  24h Low:    ${ticker.low_24h}`);
console.log(`  24h Change: ${ticker.fluctuation}`);
console.log(`  Best Bid:   ${ticker.bid_px} (${ticker.bid_sz})`);
console.log(`  Best Ask:   ${ticker.ask_px} (${ticker.ask_sz})`);

Kline / Candlestick Data

getSpotLatestKlineV3(params)

Returns the most recent klines (candlesticks) for a symbol, ordered newest-first.
getSpotLatestKlineV3(params: SpotKlineV3Request): Promise<APIResponse<ArrayFormSpotKlineV3[]>>
symbol
string
required
Trading pair symbol, e.g. BTC_USDT.
before
number
Query klines with timestamp before this value (ms). Used for pagination.
after
number
Query klines with timestamp after this value (ms).
step
number
Kline interval in minutes. Common values: 1, 3, 5, 15, 30, 60, 240, 1440, 10080, 43200.
limit
number
Number of klines to return. Default 100, max 200.
ArrayFormSpotKlineV3 tuple positions — [t, o, h, l, c, v, qv]:
IndexFieldDescription
[0]tOpen timestamp (ms)
[1]oOpen price
[2]hHigh price
[3]lLow price
[4]cClose price
[5]vBase volume
[6]qvQuote volume
import { RestClient } from 'bitmart-api';

const client = new RestClient();

// Fetch last 50 one-hour candles for BTC_USDT
const response = await client.getSpotLatestKlineV3({
  symbol: 'BTC_USDT',
  step: 60,
  limit: 50,
});

for (const [t, o, h, l, c, v] of response.data) {
  console.log(`Open: ${o}  High: ${h}  Low: ${l}  Close: ${c}  Vol: ${v}`);
}

getSpotHistoryKlineV3(params)

Returns historical kline data within a time window. Accepts the same SpotKlineV3Request parameters as getSpotLatestKlineV3.
getSpotHistoryKlineV3(params: SpotKlineV3Request): Promise<APIResponse<ArrayFormSpotKlineV3[]>>
symbol
string
required
Trading pair symbol, e.g. ETH_USDT.
before
number
Fetch klines with timestamp before this Unix ms value.
after
number
Fetch klines with timestamp after this Unix ms value.
step
number
Kline interval in minutes (default 1).
limit
number
Number of results (default 100, max 200).
import { RestClient } from 'bitmart-api';

const client = new RestClient();

const oneDayAgo = Date.now() - 24 * 60 * 60 * 1000;

const response = await client.getSpotHistoryKlineV3({
  symbol: 'ETH_USDT',
  step: 60,       // 1-hour candles
  after: oneDayAgo,
  limit: 24,
});

console.log(`Fetched ${response.data.length} hourly candles`);
const latest = response.data[0];
console.log(`Most recent close: ${latest[4]}`);

Order Book

getSpotOrderBookDepthV3(params)

Returns the current order book (bids and asks) for a trading pair.
getSpotOrderBookDepthV3(params: {
  symbol: string;
  limit?: number;
}): Promise<APIResponse<SpotOrderBookDepthResultV3>>
symbol
string
required
Trading pair symbol, e.g. BTC_USDT.
limit
number
Number of price levels per side. Max 50.
Response — SpotOrderBookDepthResultV3:
FieldTypeDescription
tsstringSnapshot timestamp (ms)
symbolstringTrading pair
asks[string, string][]Ask levels: [price, amount]
bids[string, string][]Bid levels: [price, amount]
import { RestClient } from 'bitmart-api';

const client = new RestClient();

const response = await client.getSpotOrderBookDepthV3({
  symbol: 'BTC_USDT',
  limit: 10,
});

const { bids, asks, ts } = response.data;
console.log(`Order book snapshot at ${ts}`);
console.log('Top bid:', bids[0][0], '×', bids[0][1]);
console.log('Top ask:', asks[0][0], '×', asks[0][1]);
console.log('Spread:', (parseFloat(asks[0][0]) - parseFloat(bids[0][0])).toFixed(2));

Recent Trades

getSpotRecentTrades(params)

Returns the most recent public trades for a symbol in compact array format.
getSpotRecentTrades(params: {
  symbol: string;
  limit?: number;
}): Promise<APIResponse<ArrayFormSpotRecentTrade[]>>
symbol
string
required
Trading pair symbol, e.g. BTC_USDT.
limit
number
Number of trades to return. Max 50.
ArrayFormSpotRecentTrade tuple positions — [symbol, ts, price, size, side]:
IndexFieldTypeDescription
[0]symbolstringTrading pair
[1]tsstringTrade timestamp (ms)
[2]pricestringExecution price
[3]sizestringTrade size (base asset)
[4]side'buy' | 'sell'Taker side
import { RestClient } from 'bitmart-api';

const client = new RestClient();

const response = await client.getSpotRecentTrades({
  symbol: 'BTC_USDT',
  limit: 20,
});

for (const [symbol, ts, price, size, side] of response.data) {
  const arrow = side === 'buy' ? '▲' : '▼';
  console.log(`${arrow} ${side.toUpperCase()} ${size} BTC @ ${price} USDT`);
}

Legacy Endpoints (V1 / V2)

The following endpoints are marked @deprecated in the SDK. Use V3 equivalents (getSpotTickersV3, getSpotLatestKlineV3, etc.) for new integrations.

getSpotTickersV2()

Returns all spot tickers in the legacy V2 format using the SpotTickerV1 object structure.
getSpotTickersV2(): Promise<APIResponse<{ tickers: SpotTickerV1[] }>>
import { RestClient } from 'bitmart-api';

const client = new RestClient();

const response = await client.getSpotTickersV2();
const btc = response.data.tickers.find((t) => t.symbol === 'BTC_USDT');
console.log('BTC last price:', btc?.last_price);

getSpotTickerV1(params)

Returns a single ticker in V1 format.
getSpotTickerV1(params: { symbol: string }): Promise<APIResponse<SpotTickerV1>>
symbol
string
required
Trading pair symbol, e.g. BTC_USDT.
import { RestClient } from 'bitmart-api';

const client = new RestClient();

const response = await client.getSpotTickerV1({ symbol: 'BTC_USDT' });
console.log('Last price:', response.data.last_price);
console.log('Best ask:', response.data.best_ask);
console.log('Best bid:', response.data.best_bid);

getSpotKlinesV1(params)

Returns historical kline data in V1 object format. Requires explicit from / to UNIX timestamps.
getSpotKlinesV1(params: SpotKlinesV1Request): Promise<APIResponse<{ klines: SpotKlineV1[] }>>
symbol
string
required
Trading pair symbol, e.g. BTC_USDT.
from
number
required
Start time as a UNIX timestamp in seconds.
to
number
required
End time as a UNIX timestamp in seconds.
step
number
Kline interval in minutes (default 1).
import { RestClient } from 'bitmart-api';

const client = new RestClient();

const now = Math.floor(Date.now() / 1000);
const oneDayAgo = now - 86400;

const response = await client.getSpotKlinesV1({
  symbol: 'BTC_USDT',
  from: oneDayAgo,
  to: now,
  step: 60, // 1-hour candles
});

for (const kline of response.data.klines) {
  console.log(`${new Date(kline.timestamp * 1000).toISOString()} — close: ${kline.close}`);
}

getSpotKLineStepsV1()

This method is marked @deprecated. Use V3 kline endpoints for new integrations.
Returns the list of supported kline step intervals (in minutes) for V1 kline endpoints.
getSpotKLineStepsV1(): Promise<APIResponse<{ steps: number[] }>>
import { RestClient } from 'bitmart-api';

const client = new RestClient();

const response = await client.getSpotKLineStepsV1();
console.log('Supported kline steps (minutes):', response.data.steps);

getSpotOrderBookDepthV1(params)

This method is marked @deprecated. Use getSpotOrderBookDepthV3 for new integrations.
Returns the order book for a symbol in the legacy V1 format with detailed level data.
getSpotOrderBookDepthV1(params: SpotOrderBookDepthV1Request): Promise<APIResponse<SpotOrderBookDepthResultV1>>
symbol
string
required
Trading pair symbol, e.g. BTC_USDT.
precision
string
Optional. Price precision for grouping order book levels.
size
number
Optional. Number of price levels per side.
Response — SpotOrderBookDepthResultV1:
FieldTypeDescription
timestampnumberSnapshot timestamp (ms)
buysSpotBookLevelV1[]Bid levels
sellsSpotBookLevelV1[]Ask levels
SpotBookLevelV1 fields:
FieldTypeDescription
amountstringTotal quantity at this level
totalstringCumulative total quantity
pricestringPrice level
countstringNumber of orders at this level
import { RestClient } from 'bitmart-api';

const client = new RestClient();

const response = await client.getSpotOrderBookDepthV1({
  symbol: 'BTC_USDT',
  size: 10,
});

const { buys, sells } = response.data;
console.log('Top bid:', buys[0]?.price, '×', buys[0]?.amount);
console.log('Top ask:', sells[0]?.price, '×', sells[0]?.amount);

Complete Market Snapshot Example

import { RestClient } from 'bitmart-api';

async function marketSnapshot(symbol: string) {
  const client = new RestClient();

  // Run public requests in parallel
  const [ticker, orderBook, trades, klines] = await Promise.all([
    client.getSpotTickerV3({ symbol }),
    client.getSpotOrderBookDepthV3({ symbol, limit: 5 }),
    client.getSpotRecentTrades({ symbol, limit: 5 }),
    client.getSpotLatestKlineV3({ symbol, step: 60, limit: 5 }),
  ]);

  console.log(`=== ${symbol} Snapshot ===`);
  console.log(`Last price:  ${ticker.data.last}`);
  console.log(`24h change:  ${ticker.data.fluctuation}`);
  console.log(`Top bid:     ${orderBook.data.bids[0][0]}`);
  console.log(`Top ask:     ${orderBook.data.asks[0][0]}`);
  console.log(`Last trade:  ${trades.data[0][2]} (${trades.data[0][4]})`);
  console.log(`Latest 1h candle close: ${klines.data[0][4]}`);
}

await marketSnapshot('BTC_USDT');

Build docs developers (and LLMs) love