Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/tiagosiebler/binance/llms.txt

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

MainClient is the primary REST client for Binance Spot and associated APIs. It covers the full breadth of the Binance REST surface: public market data, authenticated order management, margin trading, wallet operations, convert, staking, and sub-account endpoints — all accessible through a single, typed TypeScript class.
This page highlights the most commonly used methods. The complete endpoint-to-function mapping — including every SAPI and WAPI method — is available in the endpointFunctionList reference on GitHub.

Installation & Instantiation

import { MainClient } from 'binance';

const client = new MainClient({
  api_key: process.env.BINANCE_API_KEY,
  api_secret: process.env.BINANCE_API_SECRET,
});

Market Data

These methods are public — no API key or signature is required.
MethodHTTPEndpointDescription
testConnectivity()GETapi/v3/pingTest server connectivity
getExchangeInfo(params?)GETapi/v3/exchangeInfoExchange trading rules and symbol info
getOrderBook(params)GETapi/v3/depthOrder book depth for a symbol
getRecentTrades(params)GETapi/v3/tradesLatest trades for a symbol
getHistoricalTrades(params)GETapi/v3/historicalTradesOlder trades for a symbol
getHistoricalBlockTrades(params)GETapi/v3/historicalBlockTradesHistorical block trade data
getAggregateTrades(params)GETapi/v3/aggTradesCompressed / aggregate trade list
getKlines(params)GETapi/v3/klinesKline / candlestick data
getUIKlines(params)GETapi/v3/uiKlinesKlines optimised for UI display
getAvgPrice(params)GETapi/v3/avgPriceCurrent average price for a symbol
getExecutionRules(params?)GETapi/v3/executionRulesSpot execution rules
getReferencePrice(params)GETapi/v3/referencePriceReference price for a symbol
get24hrChangeStatistics(params?)GETapi/v3/ticker/24hr24-hour rolling window price stats
getTradingDayTicker(params)GETapi/v3/ticker/tradingDayTrading day ticker statistics
getSymbolPriceTicker(params?)GETapi/v3/ticker/priceLatest price for one or more symbols
getSymbolOrderBookTicker(params?)GETapi/v3/ticker/bookTickerBest bid/ask for one or more symbols
getRollingWindowTicker(params)GETapi/v3/tickerRolling-window price change statistics

Code Example — Market Data

import { MainClient } from 'binance';

const client = new MainClient();

// Test connectivity
await client.testConnectivity();

// Fetch order book (top 5 levels)
const book = await client.getOrderBook({ symbol: 'BTCUSDT', limit: 5 });
console.log(book.bids, book.asks);

// 24-hour statistics for a single symbol
const stats = await client.get24hrChangeStatistics({ symbol: 'ETHUSDT' });
console.log(stats.priceChangePercent);

// Latest price ticker for multiple symbols
const prices = await client.getSymbolPriceTicker({
  symbols: ['BTCUSDT', 'BNBUSDT'],
});

Order Management

These methods require authentication (API key + secret).
MethodHTTPEndpointDescription
submitNewOrder(params)POSTapi/v3/orderPlace a new spot order
testNewOrder(params)POSTapi/v3/order/testTest order placement without sending to matching engine
getOrder(params)GETapi/v3/orderQuery the status of a specific order
cancelOrder(params)DELETEapi/v3/orderCancel an active order
cancelAllSymbolOrders(params)DELETEapi/v3/openOrdersCancel all open orders for a symbol
replaceOrder(params)POSTapi/v3/order/cancelReplaceCancel an existing order and submit a new one
amendOrderKeepPriority(params)PUTfapi/v1/order/amend/keepPriorityReduce order quantity while keeping queue priority
getOpenOrders(params?)GETapi/v3/openOrdersRetrieve all open orders (optionally for one symbol)
getAllOrders(params)GETapi/v3/allOrdersRetrieve all orders (open, cancelled, filled)
submitNewOCO(params)POSTapi/v3/order/ocoPlace an OCO (One-Cancels-the-Other) order (deprecated)
submitNewOrderList(params)POSTapi/v3/orderList/ocoPlace a new OCO order list
submitNewOrderListOTO(params)POSTapi/v3/orderList/otoPlace a new OTO order list
submitNewOrderListOTOCO(params)POSTapi/v3/orderList/otocoPlace a new OTOCO order list
submitNewOrderListOPO(params)POSTapi/v3/orderList/opoPlace a new OPO order list
submitNewOrderListOPOCO(params)POSTapi/v3/orderList/opocoPlace a new OPOCO order list
cancelOCO(params)DELETEapi/v3/orderListCancel an entire order list by list ID
getOCO(params?)GETapi/v3/orderListQuery a specific order list
getAllOCO(params?)GETapi/v3/allOrderListRetrieve all order lists
getAllOpenOCO()GETapi/v3/openOrderListRetrieve all open OCO order lists
submitNewSOROrder(params)POSTapi/v3/sor/orderPlace an order using Smart Order Routing
testNewSOROrder(params)POSTapi/v3/sor/order/testTest SOR order placement

Code Example — Order Management

import { MainClient } from 'binance';

const client = new MainClient({
  api_key: process.env.BINANCE_API_KEY,
  api_secret: process.env.BINANCE_API_SECRET,
});

// Place a LIMIT BUY order
const order = await client.submitNewOrder({
  symbol: 'BTCUSDT',
  side: 'BUY',
  type: 'LIMIT',
  timeInForce: 'GTC',
  quantity: 0.001,
  price: 50000,
});
console.log('Order ID:', order.orderId);

// Check its status
const status = await client.getOrder({
  symbol: 'BTCUSDT',
  orderId: order.orderId,
});

// Cancel it
await client.cancelOrder({
  symbol: 'BTCUSDT',
  orderId: order.orderId,
});

Account

MethodHTTPEndpointDescription
getAccountInformation(params?)GETapi/v3/accountCurrent account balances and permissions
getAccountTradeList(params)GETapi/v3/myTradesTrades for a specific symbol
getOrderRateLimit()GETapi/v3/rateLimit/orderCurrent order count usage against rate limits
getPreventedMatches(params)GETapi/v3/myPreventedMatchesOrders that expired due to STP
getAllocations(params)GETapi/v3/myAllocationsAllocations resulting from SOR orders
getCommissionRates(params)GETapi/v3/account/commissionCommission rates for a symbol

Margin Trading

MethodHTTPEndpointDescription
getAllCrossMarginPairs()GETsapi/v1/margin/allPairsAll cross-margin trading pairs
getAllMarginAssets()GETsapi/v1/margin/allAssetsAll assets available for margin borrowing
getCrossMarginCollateralRatio()GETsapi/v1/margin/crossMarginCollateralRatioCross-margin collateral ratios
getIsolatedMarginAllSymbols(params?)GETsapi/v1/margin/isolated/allPairsAll isolated margin symbols
queryMarginPriceIndex(params)GETsapi/v1/margin/priceIndexMargin price index for an asset
submitMarginAccountBorrowRepay(params)POSTsapi/v1/margin/borrow-repayBorrow or repay margin assets
getMarginAccountBorrowRepayRecords(params)GETsapi/v1/margin/borrow-repayMargin borrow/repay records
marginAccountNewOrder(params)POSTsapi/v1/margin/orderPlace a margin order
marginAccountCancelOrder(params)DELETEsapi/v1/margin/orderCancel a margin order
marginAccountCancelOpenOrders(params)DELETEsapi/v1/margin/openOrdersCancel all open margin orders
marginAccountNewOCO(params)POSTsapi/v1/margin/order/ocoPlace a margin OCO order
marginAccountCancelOCO(params)DELETEsapi/v1/margin/orderListCancel a margin OCO order list
queryMarginAccountOrder(params)GETsapi/v1/margin/orderQuery a margin order
queryMarginAccountOpenOrders(params)GETsapi/v1/margin/openOrdersQuery open margin orders
queryMarginAccountAllOrders(params)GETsapi/v1/margin/allOrdersQuery all margin orders
queryMarginAccountTradeList(params)GETsapi/v1/margin/myTradesMargin account trade list
queryCrossMarginAccountDetails()GETsapi/v1/margin/accountCross-margin account details
getIsolatedMarginAccountInfo(params?)GETsapi/v1/margin/isolated/accountIsolated margin account details
queryMaxBorrow(params)GETsapi/v1/margin/maxBorrowableMaximum amount borrowable
queryMaxTransferOutAmount(params)GETsapi/v1/margin/maxTransferableMaximum amount transferable out
getMarginInterestHistory(params)GETsapi/v1/margin/interestHistoryMargin interest history
getMarginInterestRateHistory(params)GETsapi/v1/margin/interestRateHistoryHistorical margin interest rates
submitMarginOTOOrder(params)POSTsapi/v1/margin/order/otoPost a margin OTO order
submitMarginOTOCOOrder(params)POSTsapi/v1/margin/order/otocoSubmit a margin OTOCO order
toggleBNBBurn(params)POSTsapi/v1/bnbBurnEnable or disable BNB fee burn
getBNBBurn()GETsapi/v1/bnbBurnQuery BNB fee burn status

Wallet

MethodHTTPEndpointDescription
getBalances()GETsapi/v1/capital/config/getallAll coin balances (deposit/withdrawal info)
withdraw(params)POSTsapi/v1/capital/withdraw/applySubmit a withdrawal request
getWithdrawHistory(params?)GETsapi/v1/capital/withdraw/historyWithdrawal history
getDepositHistory(params?)GETsapi/v1/capital/deposit/hisrecDeposit history
getDepositAddress(params)GETsapi/v1/capital/deposit/addressDeposit address for a coin
getDepositAddresses(params)GETsapi/v1/capital/deposit/address/listList of deposit addresses
getAssetDetail(params?)GETsapi/v1/asset/assetDetailWithdraw fee and minimum amount per asset
getWalletBalances(params?)GETsapi/v1/asset/wallet/balanceWallet balances across account types
getUserAsset(params)POSTsapi/v3/asset/getUserAssetAsset balances with optional non-zero filter
submitUniversalTransfer(params)POSTsapi/v1/asset/transferTransfer assets between account types
getUniversalTransferHistory(params)GETsapi/v1/asset/transferUniversal transfer history
getDust(params)POSTsapi/v1/asset/dust-btcGet small asset balances convertible to BNB
convertDustToBnb(params)POSTsapi/v1/asset/dustConvert dust assets to BNB
convertDustAssets(params)POSTsapi/v1/asset/dust-convert/convertConvert dust to a target asset
getDustLog(params?)GETsapi/v1/asset/dribbletDust conversion log
getTradeFee(params?)GETsapi/v1/asset/tradeFeeMaker/taker trade fee per symbol
getAccountInfo()GETsapi/v1/account/infoGeneral account information
getDailyAccountSnapshot(params)GETsapi/v1/accountSnapshotDaily account balance snapshot
getAccountStatus()GETsapi/v1/account/statusAccount status
getApiKeyPermissions()GETsapi/v1/account/apiRestrictionsAPI key permissions

Convert

MethodHTTPEndpointDescription
getConvertPairs(params)GETsapi/v1/convert/exchangeInfoAll supported convert trading pairs
getConvertAssetInfo()GETsapi/v1/convert/assetInfoAsset precision and limits
convertQuoteRequest(params)POSTsapi/v1/convert/getQuoteRequest a convert quote
acceptQuoteRequest(params)POSTsapi/v1/convert/acceptQuoteAccept a convert quote
getConvertTradeHistory(params)GETsapi/v1/convert/tradeFlowConvert trade history
getOrderStatus(params)GETsapi/v1/convert/orderStatusConvert order status
submitConvertLimitOrder(params)POSTsapi/v1/convert/limit/placeOrderPlace a convert limit order
cancelConvertLimitOrder(params)POSTsapi/v1/convert/limit/cancelOrderCancel a convert limit order
getConvertLimitOpenOrders()GETsapi/v1/convert/limit/queryOpenOrdersOpen convert limit orders

ETH Staking

MethodHTTPEndpointDescription
getEthStakingAccountV2()GETsapi/v2/eth-staking/accountETH staking account information
getEthStakingQuota()GETsapi/v1/eth-staking/eth/quotaETH staking quota
subscribeEthStakingV2(params)POSTsapi/v2/eth-staking/eth/stakeStake ETH
redeemEth(params)POSTsapi/v1/eth-staking/eth/redeemRedeem staked ETH
wrapBeth(params)POSTsapi/v1/eth-staking/wbeth/wrapWrap BETH to WBETH
getEthStakingHistory(params)GETsapi/v1/eth-staking/eth/history/stakingHistoryETH staking history
getEthRedemptionHistory(params)GETsapi/v1/eth-staking/eth/history/redemptionHistoryETH redemption history
For Futures-related transfers from the Spot wallet (e.g. moving funds between Spot and USD-M Futures), use submitUniversalTransfer() with the appropriate type parameter rather than the older submitNewFutureAccountTransfer() method.

Full Usage Example

import { MainClient } from 'binance';

const client = new MainClient({
  api_key: process.env.BINANCE_API_KEY,
  api_secret: process.env.BINANCE_API_SECRET,
});

async function main() {
  // --- Market data (public) ---
  const exchangeInfo = await client.getExchangeInfo({ symbol: 'BTCUSDT' });
  console.log('Status:', exchangeInfo.symbols[0].status);

  const klines = await client.getKlines({
    symbol: 'BTCUSDT',
    interval: '1h',
    limit: 10,
  });
  console.log('Last close:', klines[klines.length - 1][4]);

  // --- Account (authenticated) ---
  const account = await client.getAccountInformation();
  const usdtBalance = account.balances.find((b) => b.asset === 'USDT');
  console.log('USDT free:', usdtBalance?.free);

  // --- Trade fee ---
  const fees = await client.getTradeFee({ symbol: 'BTCUSDT' });
  console.log('Maker fee:', fees[0].makerCommission);

  // --- Wallet: deposit address ---
  const depositAddr = await client.getDepositAddress({
    coin: 'USDT',
    network: 'TRX',
  });
  console.log('Deposit address:', depositAddr.address);
}

main();

Build docs developers (and LLMs) love