Movatterモバイル変換


[0]ホーム

URL:


NAV
简体中文
    中文
    Example

    Update Plan

    Change Log

    2025-06-24

    REST API

    2025-05-29

    Websocket Stream

    2025-05-15

    REST API

    2025-04-17

    REST API

    2025-02-18

    REST API

    2025-02-11

    REST API

    2025-01-01

    REST API
    Remove EndpointRemove Endpoint DescribeReplace Endpoint
    /spot/v1/submit_orderNew Order(v1)/spot/v2/submit_order
    /spot/v1/batch_orders
    /spot/v2/batch_orders
    New Batch Order(v1)
    New Batch Order(v2)
    /spot/v4/batch_orders
    /spot/v1/cancel_order
    /spot/v2/cancel_order
    Cancel Order(v1)
    Cancel Order(v2)
    /spot/v3/cancel_order
    /spot/v1/cancel_ordersCancel Batch Order(v1)/spot/v4/cancel_orders
    /spot/v4/cancel_all
    /spot/v2/order_detailQuery Order(v2)/spot/v4/query/order
    /spot/v3/ordersAccount Orders(v3)/spot/v4/query/open-orders
    /spot/v2/tradesAccount Trade List(v2)/spot/v4/query/trades
    /spot/v1/ticker
    /spot/v2/ticker
    Get Ticker of All Pairs (V1)
    Get Ticker of All Pairs (V2)
    /spot/quotation/v3/tickers
    /spot/v1/ticker_detailGet Ticker of a Trading Pair (V1)/spot/quotation/v3/ticker
    /spot/v1/stepsGet K-Line Step (V1)Fixed enumeration value, no need for endpoint query
    /spot/v1/symbols/klineGet K-Line (V1)/spot/quotation/v3/lite-klines
    /spot/quotation/v3/klines
    /spot/v1/symbols/bookGet Depth (V1)/spot/quotation/v3/books
    /spot/v1/symbols/tradesGet Recent Trades (V1)/spot/quotation/v3/trades

    2024-11-11

    REST API

    2024-10-21

    REST API

    2024-10-09

    REST API

    2024-08-06

    REST API

    2024-07-24

    REST API

    2024-06-30

    WebSocket Steam: User private channels will implement the following frequency and flow limits::

    The specific restriction rules are as follows:


    2024-05-28

    Websocket Stream

    2024-05-17

    REST API

    2024-04-23

    Websocket Stream

    2024-04-03

    REST API

    2024-03-12

    REST API

    2024-03-07

    REST API

    2024-02-29

    Websocket Stream

    2024-02-19

    REST API

    2023-10-27

    Websocket Stream

    2023-09-08

    Websocket Stream

    2023-08-14

    REST API

    2023-05-09

    REST API

    2023-03-03

    REST API

    2022-12-22

    2022-11-03

    2022-11-01

    2022-10-11

    2022-09-29

    2022-08-16

    2022-07-07

    2022-05-24

    2022-04-19

    2022-03-29

    2022-03-08

    2022-03-01

    2022-02-15

    2022-01-20

    2022-01-18

    2021-11-24

    2021-11-06

    2021-01-19

    2020-07-15

    2020-06-29

    2020-05-14

    Introduction

    API Key Create

    PNG

    If you accidentally leak your API key, delete it immediately and generate a new one.

    After creating an API Key, you will receive three pieces of information that you must remember:

    • Access Key: represents the identity of the account, this is your api key
    • Secret Key: used for API signature
    • Memo: used for API signature

    PNG

    The Access Key and Secret Key will be randomly generated and provided by BitMart, and the Memo will be provided by you to ensure the security of API access.

    API Key Permission Settings

    • The default permission of a newly created API isRead-Only.
    • To withdraw funds through the API, you need to modify the permissions in the UI and selectWithdraw.
    • Permission descriptions:
      • Read-only (query spot trading orders, query contract trading orders, query funds)
      • Spot-Trade (place orders, cancel orders)
      • Withdraw (withdraw funds)
      • Margin-Trade (repayment, borrowing, placing orders, etc.)
      • Future-Trade (long position, short position, closing position, etc.)

    PNG

    Read-Only Permissions:
    API NameAuthentication TypeDescription
    /account/v1/walletKEYEDQuery account assets
    /account/v1/deposit/addressKEYEDQuery deposit addresses for each currency
    /account/v1/withdraw/address/listKEYEDQuery withdraw address list
    /account/v2/deposit-withdraw/historyKEYEDQuery deposit and withdrawal history
    /account/v1/deposit-withdraw/detailKEYEDQuery deposit and withdrawal details
    /spot/v1/walletKEYEDQuery wallet balance for all currencies
    /spot/v4/query/orderSIGNEDQuery order by id (v4)
    /spot/v4/query/client-orderSIGNEDQuery order by client order id (v4)
    /spot/v4/query/open-ordersSIGNEDCurrent open orders (v4)
    /spot/v4/query/history-ordersSIGNEDAccount orders (v4)
    /spot/v4/query/tradesSIGNEDAccount trade list (v4)
    /spot/v4/query/order-tradesSIGNEDOrder trade list(v4)
    /spot/v1/user_feeKEYEDQuery basic fee rate for current user
    /spot/v1/trade_feeKEYEDQuery fee rate for a specific trading pair for current user
    /spot/v1/margin/isolated/pairsKEYEDQuery loan interest rate and limit for a trading pair
    /spot/v1/margin/isolated/accountKEYEDQuery isolated margin account information
    /spot/v1/margin/isolated/borrow_recordKEYEDQuery isolated margin borrowing record
    /spot/v1/margin/isolated/repay_recordKEYEDQuery isolated margin repayment record
    /contract/private/get-open-ordersKEYEDQuery Contract All Open Orders
    /contract/private/orderKEYEDQuery contract order details
    /contract/private/trade-fee-rateKEYEDQuery Trade Fee Rate
    /contract/private/order-historyKEYEDQuery contract order history
    /contract/private/tradesKEYEDQuery contract trade details
    /contract/private/transaction-historyKEYEDGet Contract Transaction History
    /contract/private/assets-detailKEYEDQuery contract asset details
    /contract/private/positionKEYEDQuery position details
    /contract/private/position-v2KEYEDQuery position details V2
    /contract/private/current-plan-orderKEYEDQuery Current Plan Orders
    /contract/private/position-riskKEYEDQuery Position Risk Details
    /contract/private/get-position-modeKEYEDGet position mode
    Withdraw Permissions:
    API NameAuthentication TypeDescription
    /account/v1/withdraw/chargeKEYEDQuery withdrawal limits
    /account/v1/withdraw/applySIGNEDApply for withdrawal
    Spot-Trade Permissions:
    API NameAuthentication TypeDescription
    /spot/v1/submit_orderSIGNEDPlace an order
    /spot/v2/submit_orderSIGNEDPlace an order
    /spot/v1/batch_ordersSIGNEDPlace multiple orders
    /spot/v2/batch_ordersSIGNEDPlace multiple orders
    /spot/v4/batch_ordersSIGNEDPlace multiple orders
    /spot/v1/cancel_orderSIGNEDCancel an unfinished order
    /spot/v3/cancel_orderSIGNEDCancel an unfinished order
    /spot/v1/cancel_ordersSIGNEDCancel multiple orders
    /spot/v4/cancel_ordersSIGNEDCancel multiple orders
    Margin-Trade Permissions:
    API NameAuthentication TypeDescription
    /spot/v1/margin/submit_orderSIGNEDMargin order placement
    /spot/v1/margin/isolated/transferSIGNEDTransfer funds between margin and spot accounts
    /spot/v1/margin/isolated/borrowSIGNEDIsolated margin borrowing
    /spot/v1/margin/isolated/repaySIGNEDRepay isolated margin debt
    Future-Trade Permissions:
    API NameAuthentication TypeDescription
    /contract/private/submit-orderSIGNEDPlace an order for a futures contract
    /contract/private/cancel-orderSIGNEDCancel a single futures order
    /contract/private/cancel-ordersSIGNEDBatch cancel futures orders
    /contract/private/submit-plan-orderSIGNEDPlace a plan order for futures contracts
    /contract/private/cancel-plan-orderSIGNEDCancel futures plan orders
    /account/v1/transfer-contractSIGNEDFuture account transfer
    /account/v1/transfer-contract-listSIGNEDGet Future account transfer list
    /contract/private/submit-tp-sl-orderSIGNEDPlace a tp or sl order for a futures contract
    /contract/private/modify-plan-orderSIGNEDModify a plan order for a futures contract
    /contract/private/modify-preset-plan-orderSIGNEDModify a preset plan order for a futures contract
    /contract/private/modify-tp-sl-orderSIGNEDModify a tp or sl order for a futures contract
    /contract/private/submit-trail-orderSIGNEDPlace a trail order for futures contracts
    /contract/private/cancel-trail-orderSIGNEDCancel futures trail order
    /contract/private/modify-limit-orderSIGNEDModify futures limit order
    /contract/private/cancel-all-afterSIGNEDTimed cancel all open orders
    /contract/private/set-position-modeSIGNEDSet position mode
    Sub-Account Permissions:

    You need to enterInstitution Verification to use the sub-account endpoints.

    After the creation is successful, the sub-account hasRead-only permission by default.

    PNG

    Sub-Account Spot-Trade Permissions:

    Same as the above spot trading authority

    Sub-Account Contract-Trade Permissions:

    Same as above futures trading authority

    Sub-Account Inter-Account Transfer Permissions:
    API NameAuthentication TypeDescription
    /account/sub-account/main/v1/sub-to-mainSIGNEDSub-Account Transfer to Main-Account (For Main Account, use spot account)
    /account/sub-account/sub/v1/sub-to-mainSIGNEDSub-Account Transfer to Main-Account (For Sub-Account, use spot account)
    /account/sub-account/main/v1/main-to-subSIGNEDMain-Account Transfer to Sub-Account (For Main Account, use spot account)
    /account/sub-account/main/v1/sub-to-subSIGNEDSub-Account Transfer to Sub-Account (For Main Account, use spot account)
    /account/sub-account/main/v1/transfer-listKEYEDGet Sub-Account Transfer History (For Main Account, use spot account)
    /account/sub-account/v1/transfer-historyKEYEDGet Account Spot Asset Transfer History (For Main/Sub Account, use spot account)
    /account/sub-account/main/v1/walletKEYEDGet Sub-Account Spot Wallet Balance (For Main Account, use spot account)
    /account/sub-account/main/v1/subaccount-listKEYEDGet Sub-Account List (For Main Account, use spot account)
    /account/contract/sub-account/main/v1/sub-to-mainSIGNEDSub-Account Transfer to Main-Account (For Main Account, use futures account)
    /account/contract/sub-account/main/v1/main-to-subSIGNEDMain-Account Transfer to Sub-Account (For Main Account, use futures account)
    /account/contract/sub-account/sub/v1/sub-to-mainSIGNEDSub-Account Transfer to Main-Account (For Sub-Account, use futures account)
    /account/contract/sub-account/main/v1/walletKEYEDGet Sub-Account Futures Wallet Balance (For Main Account, use futures account)
    /account/contract/sub-account/v1/transfer-historyKEYEDGet Account Futures Asset Transfer History (For Main/Sub Account, use futures account)
    /account/contract/sub-account/main/v1/transfer-listKEYEDGet Sub-Account Transfer History (For Main Account, use futures account)

    API Library

    In order to facilitate access, we provide SDK in some languages for reference.For more programming codes, please refer to theQuick Start API on the page.

    Available SDK:

    In addition to the SDK, we also provide code samples in multiple languages, and the samples mainly demonstrate how to use the signed interface.It can be built and run standalone or as part of your codebase.

    FAQ

    Here are some frequently asked questions.

    Q1. Will different API KEY in the same account return different data?

    Different API KEY data under the same account is the same.

    Q2. How to fill information in when applying for APIKEY?

    1. `memo` is provided by the user, it can be any string, used to confuse the signature algorithm
    2. Binding ip is optional, it is recommended to fill in for account security
    3. API permissions can be checked according to user needs

    Q3. How is the HTTP status code 429 created?

    The request interface exceeds the access frequency limit, it is recommended to reduce the access frequency.

    Q4. Using ccxt, the API KEY is correctly filled in, but it will also prompt 'message': 'Header X-BM-SIGN is wrong'

    The parameter uid of ccxt needs to be filled in as the memo when creating the API
    Here is an example of initialization:

    bitmart = ccxt.bitmart({
    'apiKey': 'your_api_key',
    'secret': 'your_api_secret',
    'uid': 'your_api_memo' // not your uid, is the api memo
    });

    Q5. The program I wrote myself always prompts 'message': 'Header X-BM-SIGN is wrong'

    Please refer toQuick Access API, select the language you use, and there are correct signature methods for reference.

    Q6. Where is the location of BitMart servers?

    We are using Google Cloud Services and deployed in Taiwan.

    Q7. When will the VIP fee I applied for take effect?

    We will update on the 8th, 18th and 28th of every month.

    Q8. Why does it prompt "IP is forbidden. We recommend enabling IP whitelist for API trading. "

    Because you set up an IP whitelist when creating the API, which means that this API KEY can only send requests through this IP, and other IPs using this API KEY will prompt that it is prohibited.
    Why set up: IP whitelist is a network security measure used to control who can access specific network resources or services. If a whitelist IP is added, the service will only accept API requests from that IP and reject API requests from other IPs.

    Contact Us

    Basic Information

    API Basic Information

    1. This article lists the rest baseurl of the interfaces: https://api-cloud.bitmart.com
    2. All interface responses are in JSON format.

    Request Parameter Settings

    HTTP Response Codes

    API Returned Codes

    For details, please refer toError Code List

    Signature

    The authentication type of each API endpoint will be indicated. If it is marked asSIGNED,it means that the endpoint requires a signature to access. If it is marked asKEYED, it means that the endpoint only requires an API Access KEY to be set in the request header.

    Authentication Type

    1. Setting Request Parameters

    1.1 Set Request Header Key

    Create X-BM-TIMESTAMP

    // JavaSystem.currentTimeMillis();// Pythonint(time.time() * 1000) // Golangtime.Now().UnixNano() / int64(time.Millisecond)// Nodejs & TypeScriptDate.now();// JavascriptDate.now();// PHPround(microtime(true) * 1000)// C#DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
    1.2 Set Request Body Params

    2. Example

    Shell Example

    echo-n'1589793796145#test001#{"symbol":"BTC_USDT","price":"8600","count":"100"}' | openssl dgst-sha256-hmac"6c6c98544461bbe71db2bca4c6d7fd0021e0ba9efc215f9c6ad41852df9d9df9"(stdin)= c31dc326bf87f38bfb49a3f8494961abfa291bd549d0d98d9578e87516cee46d    curl--location--request POST'localhost:8080/spot/v1/test-post'--header'Content-Type: application/json'--header'X-BM-KEY: 80618e45710812162b04892c7ee5ead4a3cc3e56'--header'X-BM-SIGN: c31dc326bf87f38bfb49a3f8494961abfa291bd549d0d98d9578e87516cee46d'--header'X-BM-TIMESTAMP: 1589793796145'--d'{"symbol":"BTC_USDT","price":"8600","count":"100"}'

    Then set the following:

    Assuming the key you applied for is as follows:

    then the right side is a complete request

    You can also refer to the SDK orQuick Start API below to implement

    Rate Limit

    The speed of the public interface is limited according to the IP, and the speed of the private interface is limited according to the API KEY. When the requests exceed the rate limit, the 429 status will be returned: the request is too frequent.

    The specific interface limits are as follows:

    System InterfaceInterface NameLimit TargetRate
    /system/timeGet system timeIP10 times/sec
    /system/serviceGet system service statusIP10 times/sec
    Funding Account InterfaceInterface NameLimit TargetRate
    /account/v1/currenciesGet currenciesIP2 times/2 sec
    /account/v1/walletGet account balanceX-BM-KEY12 times/2 sec
    /account/v1/deposit/addressDeposit addressX-BM-KEY2 times/2 sec
    /account/v1/withdraw/chargeWithdraw quotaX-BM-KEY2 times/2 sec
    /account/v1/withdraw/applyWithdrawX-BM-KEY8 times/2 sec
    /account/v1/withdraw/address/listWithdraw AddressX-BM-KEY2 times/2 sec
    /account/v2/deposit-withdraw/historyGet deposit and withdraw history V2X-BM-KEY8 times/2 sec
    /account/v1/deposit-withdraw/detailGet a deposit Or withdraw detailX-BM-KEY8 times/2 sec
    /spot/v1/margin/isolated/accountGet Margin Account Details(Isolated)X-BM-KEY12 times/2 sec
    /spot/v1/margin/isolated/transferMargin Asset TransferX-BM-KEY2 times/2 sec
    /spot/v1/user_feeBasic Fee RateX-BM-KEY2 times/2 sec
    /spot/v1/trade_feeActual Trade Fee RateX-BM-KEY2 times/2 sec
    Spot Public Market InterfaceInterface NameLimit TargetRate
    /spot/v1/currenciesGet a list of all cryptocurrenciesIP8 times/2 sec
    /spot/v1/symbolsGet a list of all trading pairsIP8 times/2 sec
    /spot/v1/symbols/detailsGet a detailed list of all trading pairsIP12 times/2 sec
    /spot/quotation/v3/tickersGet Ticker of All Pairs (V3)IP10 times/2 sec
    /spot/quotation/v3/tickerGet Ticker of a Trading Pair(V3)IP15 times/2 sec
    /spot/quotation/v3/lite-klinesGet Latest K-Line (V3)IP15 times/2 sec
    /spot/quotation/v3/klinesGet History K-Line (V3)IP10 times/2 sec
    /spot/quotation/v3/booksGet Depth(V3)IP15 times/2 sec
    /spot/quotation/v3/tradesGet Recent Trades(V3)IP15 times/2 sec
    Spot Trading InterfaceInterface NameLimit TargetRate
    /spot/v1/walletGet the user's wallet balance(KEYED)X-BM-KEY12 times/2 sec
    /spot/v2/submit_orderNew Order(v2) (SIGNED)UID40 times/2 sec
    /spot/v4/batch_ordersNew Batch Order(v4) (SIGNED)UID40 times/2 sec
    /spot/v1/margin/submit_orderNew Margin Order (SIGNED)UID20 times/1 sec
    /spot/v3/cancel_orderCancel Order(v3) (SIGNED)UID40 times/2 sec
    /spot/v4/cancel_ordersCancel Batch Order(v4) (SIGNED)UID40 times/2 sec
    /spot/v4/cancel_allCancel All Order(v4) (SIGNED)UID1 times/3 sec
    /spot/v4/query/orderQuery Order By Id(v4) (SIGNED)X-BM-KEY50 times/2 sec
    /spot/v4/query/client-orderQuery Order By clientOrderId(v4) (SIGNED)X-BM-KEY50 times/2 sec
    /spot/v4/query/open-ordersCurrent Open Orders(v4) (SIGNED)X-BM-KEY12 times/2 sec
    /spot/v4/query/history-ordersAccount Orders(v4) (SIGNED)X-BM-KEY12 times/2 sec
    /spot/v4/query/tradesAccount Trade List(v4) (SIGNED)X-BM-KEY12 times/2 sec
    /spot/v4/query/order-tradesOrder Trade List(v4) (SIGNED)X-BM-KEY12 times/2 sec
    Sub-Account InterfaceInterface NameLimit TargetRate
    /account/sub-account/main/v1/sub-to-mainSub-Account Spot Asset Transfer (For Main Account)X-BM-KEY2 times/2 sec
    /account/sub-account/sub/v1/sub-to-mainSub-Account Spot Asset Transfer (For Sub-Account)X-BM-KEY2 times/2 sec
    /account/sub-account/main/v1/main-to-subMain Account Spot Asset Transfer (For Main Account)X-BM-KEY2 times/2 sec
    /account/sub-account/sub/v1/sub-to-subSub-Account to Sub-Account Spot Asset Transfer (For Sub-Account)X-BM-KEY2 times/2 sec
    /account/sub-account/main/v1/sub-to-subSub-account to Sub-Account Spot Asset Transfer (For Main Account)X-BM-KEY2 times/2 sec
    /account/sub-account/main/v1/transfer-listQuery Sub-account Spot Asset Transfer History (For Main Account)X-BM-KEY8 times/2 sec
    /account/sub-account/v1/transfer-historyGet Account Spot Asset Transfer HistoryX-BM-KEY8 times/2 sec
    /account/sub-account/main/v1/walletGet Sub-Account Spot Wallet Balance (For Main Account)X-BM-KEY12 times/2 sec
    /account/sub-account/main/v1/subaccount-listGet Sub-account List (For Main Account)X-BM-KEY8 times/2 sec
    Margin Loan InterfaceInterface NameLimit TargetRate
    /spot/v1/margin/isolated/borrowMargin Borrow (Isolated)X-BM-KEY2 times/2 sec
    /spot/v1/margin/isolated/repayMargin Repay (Isolated)X-BM-KEY2 times/2 sec
    /spot/v1/margin/isolated/borrow_recordGet Borrow Record(Isolated)X-BM-KEY150 times/2 sec
    /spot/v1/margin/isolated/repay_recordGet Repayment Record(Isolated)X-BM-KEY150 times/2 sec
    /spot/v1/margin/isolated/pairsGet Trading Pair Borrowing Rate and AmountX-BM-KEY2 times/2 sec

    REST API

    Speed limit judgment:

    Each call to the interface will return 3 Response Headers with limit tags, as shown below:

    Example:

    X-BM-RateLimit-Remaining:10X-BM-RateLimit-Limit:600X-BM-RateLimit-Reset:60Theabovesettingmeansthatitcanbecalled600timeswithin60seconds,andcurrentlyhasbeencalled10times
    Response HeaderDescription
    X-BM-RateLimit-RemainingThe number of requests that have been used in the current time window
    X-BM-RateLimit-LimitThe max number of requests in the current time window
    X-BM-RateLimit-ResetCurrent time window, in seconds
    Note that when X-BM-RateLimit-Remaining> X-BM-RateLimit-Limit, please do not continue to call, otherwise it will be banned

    About recvWindow, timestamp

    Currently only applicable to v4 interfaces

    Time synchronization security

    Signed interfaces require the timestamp parameter to be passed, whose value should be the Unix timestamp (in milliseconds) at the time the request is sent, set in theX-BM-TIMESTAMP header of the request. When the server receives the request, it will check the timestamp in the request. If it was sent more than 5000 milliseconds ago, the request will be considered invalid. This time window value can be defined by sending the optional parameterrecvWindow.

    The pseudo code for this logic is as follows:

    if(timestamp<(serverTime+1000)&&(serverTime-timestamp)<=recvWindow){// process request}else{// reject request}

    About trade timeliness

    The internet is not always stable and reliable, so there may be latency fluctuations between your program and the BitMart server. This is the purpose of settingrecvWindow. If you are engaged in high-frequency trading and have high requirements for trade timeliness, you can set recvWindow flexibly to meet your requirements.

    It is recommended to use a recvWindow of less than 5 seconds! It cannot exceed 60 seconds at most!

    Public API Definitions

    Field description

    • currency Currency refers to the basic unit that can be transferred in and out, such as BTC, ETH, EOS, etc
    • symbol Trading pair name, consists of base and quote currency. Taking BTC_USDT as an example, BTC is the base currency, and USDT is the quote currency. Trading pairs are mainly used in spot trading
    • orderId Order number, the order ID under the same currency pair of each business line is unique
    • tradeId The unique number of the trade

    Order State (Field:state)

    • new=The order has been accepted by the engine.
    • partially_filled=A part of the order has been filled.
    • filled=The order has been completed.
    • canceled=The order has been canceled.
    • partially_canceled=A part of the order has been filled, and the order has been canceled.

    Order Cancellation Reason (Field:cancelSource)

    • user=User manually canceled.
    • system=System automatically canceled.
    • stp=Stp Cancelled.

    Self transaction protection type (Field:stpMode)

    • none=none
    • cancel_maker=cancel_maker
    • cancel_taker=cancel_taker
    • cancel_both=cancel_both

    Order Side (Field:side)

    • buy=Buy
    • sell=Sell

    Order Type (Field:type)

    • limit=Limit Order
    • market=Market Order
    • limit_maker=PostOnly Order
    • ioc=IOC Order

    Trade Role (Field:tradeRole)

    • taker=Take orders, take the initiative to deal
    • maker=Pending order, passive transaction

    Timestamp

    All the times returned by the system are in the form of timestamps.

    System Status

    Get System Time

    Get system time

    Request URL

    GET https://api-cloud.bitmart.com/system/time

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl https://api-cloud.bitmart.com/system/time

    None

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1","message":"OK","data":{"server_time":1527777538000}}
    FieldTypeDescription
    server_timeLongCurrent system time (timestamp, accuracy in milliseconds)

    Get System Service Status

    Get system service status

    Request URL

    GET https://api-cloud.bitmart.com/system/service

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl https://api-cloud.bitmart.com/system/service

    None

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1","message":"OK","data":{"service":[{"title":"Spot API Stop","service_type":"spot","status":"2","start_time":1527777538000,"end_time":1527777538000},{"title":"Contract API Stop","service_type":"contract","status":"2","start_time":1527777538000,"end_time":1527777538000}]}}
    FieldTypeDescription
    titleStringSystem maintenance instructions title
    statusLongSystem maintenance status
    -0=Waiting
    -1=Working
    -2=Completed
    service_typeStringService type
    -spot=Spot API service
    -contract=Contract API service
    -account=Account API service
    start_timeLongSystem maintenance start time, UTC-0, timestamp accuracy in milliseconds
    end_timeLongSystem maintenance end time, UTC-0, timestamp accuracy in milliseconds

    Public Market Data

    Get Currency List (V1)

    Get a list of all cryptocurrencies on the platform

    Request URL

    GET https://api-cloud.bitmart.com/spot/v1/currencies

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl https://api-cloud.bitmart.com/spot/v1/currencies

    None

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1","message":"OK","data":{"currencies":[{"id":"BTC","name":"Bitcoin","withdraw_enabled":true,"deposit_enabled":true},{"id":"ETH","name":"Ethereum","withdraw_enabled":true,"deposit_enabled":true}]}}
    FieldTypeDescription
    idStringCurrency abbreviation, such as BTC
    nameStringCurrency full name, such as Bitcoin
    withdraw_enabledBooleanWhether this currency can be withdrawn on the platform
    -true=can
    -false=no
    deposit_enabledBooleanWhether this currency can be deposited on the platform
    -true=can
    -false=no
    If the currency you need is not included in the returned response, the currency may have been delisted.

    Get Trading Pairs List (V1)

    Get a list of all trading pairs on the platform

    Request URL

    GET https://api-cloud.bitmart.com/spot/v1/symbols

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl https://api-cloud.bitmart.com/spot/v1/symbols

    None

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1","message":"OK","data":{"symbols":["BMX_ETH","XLM_ETH","MOBI_ETH"]}}
    FieldTypeDescription
    symbolsListArray of trading pairs
    Note

    Get Trading Pair Details (V1)

    Get a detailed list of all trading pairs on the platform

    Request URL

    GET https://api-cloud.bitmart.com/spot/v1/symbols/details

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl https://api-cloud.bitmart.com/spot/v1/symbols/details

    None

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1","message":"OK","data":{"symbols":[{"symbol":"GXC_BTC","symbol_id":1024,"base_currency":"GXC","quote_currency":"BTC","quote_increment":"1.00000000","base_min_size":"1.00000000","price_min_precision":6,"price_max_precision":8,"expiration":"NA","min_buy_amount":"0.00010000","min_sell_amount":"0.00010000","trade_status":"trading"}]}}
    FieldTypeDescription
    symbolsListArray of trading pair details
    symbolStringTrading pair name
    symbol_idIntTrading pair id
    base_currencyStringBase currency
    quote_currencyStringQuote currency
    quote_incrementStringThe minimum order quantity is also the minimum order quantity increment
    base_min_sizeStringMinimum order quantity
    price_min_precisionNumberMinimum price accuracy (decimal places), used to query k-line and depth
    price_max_precisionNumberMaximum price accuracy (decimal places), used to query k-line and depth
    expirationStringExpiration time of trading pair
    min_buy_amountStringMinimum order amount
    min_sell_amountStringMinimum sell amount
    trade_statusStringTrade Status
    -trading=is trading
    -pre-trade=pre-open

    Get Ticker of All Pairs (V3)

    Get all trading pairs with a volume greater than 0 within 24 hours.Market data includes: latest transaction price, best bid price, best ask price and 24-hour transaction volume snapshot information.Note that the interface is not real-time data, if you need real-time data, please use websocket to subscribe Ticker channel

    Request URL

    GET https://api-cloud.bitmart.com/spot/quotation/v3/tickers

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl https://api-cloud.bitmart.com/spot/quotation/v3/tickers`

    None

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-1231","message":"success","data":[["BTC_USDT",//symbol"30000.00",//last"582.08066",//v_24h"4793098.48",//qv_24h"28596.30",//open_24h"31012.44",//high_24h"12.44",//low_24h"0.04909",//fluctuation"30000",//bid_px"1",//bid_sz"31012.44",//ask_px"69994.75267",//ask_sz"1691671091933"//ts],["ETH_USDT","1840.00","2.00000","3680.00","1842.18","1842.18","1840.00","-0.00118","1812.35","4.61989","1859.34","4.07793","1691671094213"]]}
    FieldTypeDescription
    symbolStringTrading pair
    lastStringLatest price
    v_24hString24-hour trade volume in base currency
    qv_24hString24-hour trade volume in quote currency
    open_24hString24-hour open price
    high_24hString24-hour highest price
    low_24hString24-hour lowest price
    fluctuationString24-hour price change
    bid_pxStringtop buy price
    bid_szStringSize of top buy order
    ask_pxStringtop sell price
    ask_szStringSize of top sell order
    tsStringTime of generation(in milliseconds)

    Get Ticker of a Trading Pair (V3)

    Applicable to query the aggregated market price of a certain trading pair, and return the latest ticker information. Note that the interface is not real-time data, if you need real-time data, please use websocket to subscribe Ticker channel

    Request URL

    GET https://api-cloud.bitmart.com/spot/quotation/v3/ticker

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl https://api-cloud.bitmart.com/spot/quotation/v3/ticker?symbol=BTC_USDT
    FieldTypeRequired?Description
    symbolStringYesTrading pair (e.g. BMX_USDT)

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-1231","message":"success","data":{"symbol":"BTC_USDT","last":"30000.00","v_24h":"582.08066","qv_24h":"4793098.48","open_24h":"28596.30","high_24h":"31012.44","low_24h":"12.44","fluctuation":"0.04909","bid_px":"30000","bid_sz":"1","ask_px":"31012.44","ask_sz":"69994.75267","ts":"1691671061919"}}
    FieldTypeDescription
    symbolStringTrading pair
    lastStringLatest price
    v_24hString24-hour trade volume in base currency
    qv_24hString24-hour trade volume in quote currency
    open_24hString24-hour open price
    high_24hString24-hour highest price
    low_24hString24-hour lowest price
    fluctuationString24-hour price change
    bid_pxStringtop buy price
    bid_szStringSize of top buy order
    ask_pxStringtop sell price
    ask_szStringSize of top sell order
    tsStringTime of generation(in milliseconds)
    1.If no corresponding trading pair is found, this trading pair has been delisted.
    2.For frequent query needs, we recommend using this endpoint to obtain aggregated ticker for a single trading pair.

    Get Latest K-Line (V3)

    Query the latest K-line and return a maximum of 1000 data. Note that the latest K-line of the interface is not real-time data. If you want real-time data, please use websocket to subscribe to K-line channel

    Request URL

    GET https://api-cloud.bitmart.com/spot/quotation/v3/lite-klines

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl https://api-cloud.bitmart.com/spot/quotation/v3/lite-klines?symbol=BMX_ETH&step=15&limit=10
    FieldTypeRequired?Description
    symbolStringYesTrading pair (e.g.BMX_USDT)
    beforeLongNoQuery timestamp (unit: second, e.g. 1525760116), query the data before this time
    afterLongNoQuery timestamp (unit: second, e.g. 1525769116), query the data after this time
    stepIntNok-line step, value[1, 5, 15, 30, 60,
    120, 240, 1440, 10080, 43200] unit: minute, default 1
    limitIntNoReturn number, the maximum value is 200, default is 100
    A total of four query modes are supported:
    1. If only before is passed, check forward according to the time
    2. If only after is passed, check backward according to the time
    3. Both before and after need to verify whether the time interval is legal, and if it is legal, check the interval
    4. If neither before nor after is passed, the latest K-line will be returned in reverse order

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-1231","message":"success","data":[["1689736680",//t"3.721",//o"3.743",//h"3.677",//l"3.708",//c"22698348.04828491",//v"12698348.04828491"//qv],["1689736620","3.731","3.799","3.494","3.72","67632347.24399722","37632347.24399722"]]}
    FieldTypeDescription
    tStringCreate timestamp (in seconds), It can be used as the unique identification of K line
    oStringOpen price
    hStringHighest price
    lStringLowest price
    cStringClose price
    vStringTrading volume, with a unit of currency (If in BTC_USDT, The unit is BTC)
    qvStringTrading volume, the value is the quantity in quote currency (If in BTC_USDT, The unit is USDT)

    Get History K-Line (V3)

    Get k-line data within a specified time range of a specified trading pair.Note that the interface is not real-time data, if you need real-time data, please use websocket to subscribe KLine channel

    Request URL

    GET https://api-cloud.bitmart.com/spot/quotation/v3/klines

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl https://api-cloud.bitmart.com/spot/quotation/v3/klines?symbol=BMX_ETH&step=15&limit=10
    FieldTypeRequired?Description
    symbolStringYesTrading pair (e.g.BMX_USDT)
    beforeLongNoQuery timestamp (unit: second, e.g. 1525760116), query the data before this time
    afterLongNoQuery timestamp (unit: second, e.g. 1525769116), query the data after this time
    stepIntNok-line step, value[1, 5, 15, 30, 60,
    120, 240, 1440, 10080, 43200] unit: minute, default 1
    limitIntNoReturn number, the maximum value is 200, default is 100
    A total of four query modes are supported:
    1. If only before is passed, check forward according to the time
    2. If only after is passed, check backward according to the time
    3. Both before and after need to verify whether the time interval is legal, and if it is legal, check the interval
    4. If neither before nor after is passed, the latest K-line will be returned in reverse order

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-1231","message":"success","data":[["1689736680",//t"3.721",//o"3.743",//h"3.677",//l"3.708",//c"22698348.04828491",//v"12698348.04828491"//qv],["1689736620","3.731","3.799","3.494","3.72","67632347.24399722","37632347.24399722"]]}
    FieldTypeDescription
    tStringCreate timestamp (in seconds), It can be used as the unique identification of K line
    oStringOpen price
    hStringHighest price
    lStringLowest price
    cStringClose price
    vStringTrading volume, with a unit of currency (If in BTC_USDT, The unit is BTC)
    qvStringTrading volume, the value is the quantity in quote currency (If in BTC_USDT, The unit is USDT)

    Get Depth (V3)

    Get full depth of trading pairs.Note that the interface is not real-time data, if you need real-time data, please use websocket to subscribe Depth channel

    Request URL

    GET https://api-cloud.bitmart.com/spot/quotation/v3/books

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl https://api-cloud.bitmart.com/spot/quotation/v3/books?symbol=BTC_USDT&limit=1
    FieldTypeRequired?Description
    symbolStringYesTrading pair (e.g.BMX_USDT)
    limitIntNoOrder book depth per side. Maximum 50, e.g. 50 bids + 50 asks. Default returns to 35 depth data, e.g. 35 bids + 35 asks.

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-1231","message":"success","data":{"ts":"1691672864874","symbol":"BTC_USDT","asks":[["31012.44",//price"69994.75267"//amount]],"bids":[["30000.00",//price"1.00000"//amount]]}}
    FieldTypeDescription
    tsStringCreate time(Timestamp in milliseconds)
    symbolStringTrading pair
    asksList[]Order book on sell side
    bidsList[]Order book on buy side
    amountStringTotal number of current price depth
    priceStringThe price at current depth

    Get Recent Trades (V3)

    Get the latest trade records of the specified trading pair.Note that the interface is not real-time data, if you need real-time data, please use websocket to subscribe Trade channel

    Request URL

    GET https://api-cloud.bitmart.com/spot/quotation/v3/trades

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl https://api-cloud.bitmart.com/spot/quotation/v3/trades?symbol=BMX_ETH&limit=10
    FieldTypeRequired?Description
    symbolStringYesTrading pair (e.g.BMX_USDT)
    limitIntNoNumber of returned items, maximum is 50, default 50

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-1231","message":"success","data":[["BMX_ETH",//symbol"1691743270994",//ts"1.00000000",//price"1.0",//size"sell"//side]]}
    FieldTypeDescription
    symbolStringTrading pair
    tsStringTrade time (in milliseconds)
    priceStringTrade price
    sizeStringTrade number
    sideStringOrder Side
    -buy
    -sell

    Funding Account

    Get Account Balance (KEYED)

    Gets Account Balance

    Request URL

    GET https://api-cloud.bitmart.com/account/v1/wallet

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'https://api-cloud.bitmart.com/account/v1/wallet?currency=USDT&needUsdValuation=true
    FieldTypeRequired?Description
    currencyStringNoCurrency
    needUsdValuationBoolNoWhether to return the USD valuation, default isfalse

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"ef834248-51d3-4223-9481-f862aa9dd39f","data":{"wallet":[{"currency":"USDT","name":"Tether USD","available":"1000.00000000","available_usd_valuation":"1002.00000000","frozen":"0.00000000","unAvailable":"0.00000000"}]}}
    FieldTypeDescription
    currencyStringToken symbol, e.g., 'BTC'
    nameStringToken name, e.g., 'Bitcoin'
    availableStringAvailable Balance
    available_usd_valuationStringAvailable Balance USD valuation
    frozenStringTrading frozen Balance
    unAvailableStringTrading frozen Balance + Other frozen Balance
    Only assets with a balance greater than 0 will be returned.

    Get Currencies

    Gets the currency of the asset for withdrawal

    Request URL

    GET https://api-cloud.bitmart.com/account/v1/currencies

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl https://api-cloud.bitmart.com/account/v1/currencies?currencies=BTC,ETH,BMX
    FieldTypeRequired?Description
    currenciesStringNoSingle query, such asBTC; multiple queries, such asBTC,ETH,BMX, can have a maximum of 20.

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1","message":"OK","data":{"currencies":[{"currency":"USDT","name":"Tether USD","contract_address":null,"network":"OMNI","withdraw_enabled":false,"deposit_enabled":false,"withdraw_minsize":null,"withdraw_minfee":null,"withdraw_fee":"10","withdraw_fee_estimate":"10.3"},{"currency":"USDT-TRC20","name":"USDT-TRC20","contract_address":"TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t","network":"TRC20","withdraw_enabled":true,"deposit_enabled":true,"withdraw_minsize":"10","withdraw_minfee":null,"withdraw_fee":"10","withdraw_fee_estimate":"10.3"},{"currency":"USDT-ERC20","name":"USDT-ERC20","contract_address":"0xdac17f958d2ee523a2206206994597c13d831ec7","network":"ERC20","withdraw_enabled":true,"deposit_enabled":true,"withdraw_minsize":"26","withdraw_minfee":null,"withdraw_fee":"26","withdraw_fee_estimate":"26.3"}]}}
    FieldTypeDescription
    currencyStringToken symbol, e.g., 'BTC'
    nameStringToken name, e.g., 'Bitcoin'
    contract_addressStringContract address
    networkStringnetwork, e.g., 'ERC20'
    withdraw_enabledBooleanAvailability to withdraw
    -true=available
    -false=not available
    deposit_enabledBooleanAvailability to deposit
    -true=available
    -false=not available
    withdraw_minsizeStringMinimum withdrawal amount
    withdraw_minfeeStringMinimum withdrawal fee (After 2025-05-18, the field will be removed)
    withdraw_feeStringWithdrawal fee. The unit corresponds to the currency
    withdraw_fee_estimateStringWithdrawal fee estimate. The unit is USD.
    1. If the returned response does not contain the currency you need, the currency may have been removed.
    2. There are multiple USDT currencies. Note that:
    `currency` = `USDT` default is OMNI network
    `currency` = `USDT-TRC20` , is TRC20 network
    `currency` = `USDT-ERC20`, is ERC20 network

    Get Spot Wallet Balance (KEYED)

    Get the user's wallet balance for all currencies

    Request URL

    GET https://api-cloud.bitmart.com/spot/v1/wallet

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}' https://api-cloud.bitmart.com/spot/v1/wallet

    None

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1","message":"OK","data":{"wallet":[{"id":"BTC","available":"10.000000","name":"Bitcoin","frozen":"10.000000",},...]}}
    FieldTypeDescription
    idStringCryptocurrency abbreviation
    nameStringFull name
    availableStringAvailable balance
    frozenStringFrozen balance

    Deposit Address (KEYED)

    Gets Deposit Address

    Request URL

    GET https://api-cloud.bitmart.com/account/v1/deposit/address

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'https://api-cloud.bitmart.com/account/v1/deposit/address?currency=USDT-TRC20
    FieldTypeRequired?Description
    currencyStringYesToken symbol, e.g., 'BTC'

    Instruction

    PNG

    USDT has multiple recharge addresses, please select them correctly. For example:
    `currency` = `USDT` default is OMNI;
    `currency` = `USDT-TRC20` is TRC20;
    `currency` = `USDT-ERC20` is ERC20;

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"0e6edd79-f77f-4251-abe5-83ba75d06c1a","data":{"currency":"USDT-TRC20","chain":"USDT-TRC20","address":"TGR3ghy2b5VLbyAYrmiE15jasR6aPHTvC5","address_memo":""}}
    FieldTypeDescription
    currencyStringToken symbol, e.g., 'BTC'
    chainStringToken chain
    addressStringDeposit address
    address_memoStringTag (tag/payment_id/memo); If some currencies need to withdraw currency, it will return data. If not, it will return empty string
    This interface is not available for sub-accountThe tag names required by each currency are different, such as (tag/payment_id/memo). For convenience, BitMart is uniformly defined as address_Memo. This means that regardless of the currency in which tag/payment_id/memo is required, the service returns the address_Memo field uniformly. Please pay attention to the distinction.
    Tag are required for some tokens. Please include them while making deposits to ensure the your funds will be properly credited.
    IOTA and HLX COINS are temporarily not supported for deposit.

    Forgot to write Memo/Wrote a wrong Memo?

    Withdraw Quota (KEYED)

    Query withdraw quota for currencies

    Request URL

    GET https://api-cloud.bitmart.com/account/v1/withdraw/charge

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}' https://api-cloud.bitmart.com/account/v1/withdraw/charge?currency=BTC
    FieldTypeRequired?Description
    currencyStringYesToken symbol, e.g., 'BTC'

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"62a80bde-0cb4-4bf1-b8e5-5ad2c71463e7","data":{"today_available_withdraw_BTC":"100.0000","min_withdraw":"0.00000000","withdraw_precision":8,"withdraw_fee":"0.00000000","withdraw_Precision_GeTen":10}}
    FieldTypeDescription
    today_available_withdraw_BTCStringAmount available for withdrawal today, unit: BTC
    min_withdrawStringMinimum withdrawal amount
    withdraw_precisionIntWithdrawal amount must be accurate to several decimal places.
    withdraw_feeStringWithdrawal fee
    withdraw_Precision_GeTenLongWithdrawal amount must be an integral multiple of this value. If it is null, it means there is no such requirement.
    This interface is not available for sub-account1. When `withdraw_precision`=5, then the decimal point of the withdrawal amount cannot exceed 5 digits.
    2. When `withdraw_Precision_GeTen`=10, then the withdrawal amount must be an integral multiple of 10.

    Withdraw (SIGNED)

    Creates a withdraw request from spot account to an external address

    The API can only make withdrawal to verified addresses, and verified addresses can be set by WEB/APP.

    Request URL

    POST https://api-cloud.bitmart.com/account/v1/withdraw/apply

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    FieldTypeRequired?Description
    currencyStringYesToken symbol, e.g., 'BTC'
    amountStringYesThe amount of currency to withdraw

    Parameters for Withdraw to the blockchain

    1.Request: Withdraw to the blockchain

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{{    "currency": "USDT-TRC20",    "amount": "100.000",    "destination": "To Digital Address",    "address": "0x1EE6FA5A3803608fc22a1f3F76********",    "address_memo": ""}'https://api-cloud.bitmart.com/account/v1/withdraw/apply
    FieldTypeRequired?Description
    addressStringYesWithdraw address (only the address added on the official website is supported)
    address_memoStringNoAddress tag(tag Or payment_id Or memo)
    destinationStringNoRemark

    Parameters for Withdraw to BitMart account

    2.Request: Withdraw to BitMart account

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{{    "currency": "USDT-TRC20",    "amount": "100.000",    "type": 1,    "value": "876940329",    "areaCode": ""}'https://api-cloud.bitmart.com/account/v1/withdraw/apply
    FieldTypeRequired?Description
    typeIntYesAccount type
    1=CID
    2=Email
    3=Phone
    valueStringYesAccount
    areaCodeStringYesPhone area code, required when account type is phone, e.g.: 61
    Important notes on request parameters
    1. If the currency has multiple blockchains, please pay attention to passing parameters: such as USDT
    `currency`=`USDT-TRX` network is TRX
    `currency`=`USDT-ETH` network is ETH
    `currency`=`USDT-BSC_BNB` network is BSC_BNB
    `currency`=`USDT-SOL` network is SOL
    `currency`=`USDT-ALGO` network is ALGO
    find more currencies network
    2. Withdraw only supports addresses in the list of commonly used addresses of users. IOTA, HLX one-time currency withdrawal address cannot be set as the common address, so IOTA, HLX withdrawal address is not supported.
    3. Without the withdrawal tag, `address_memo` does not pass or pass an empty string.
    4. If the parameters for `Withdraw to the blockchain` and the parameters for `Withdraw to BitMart account` are transmitted at the same time, the parameters for `Withdraw to the blockchain` will take precedence.

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1","message":"OK","data":{"withdraw_id":"121212"}}
    FieldTypeDescription
    withdraw_idStringWithdrawa ID
    Note
    This interface is not available for sub-account

    1. When withdraw_id is returned, it means that the withdrawal request has been sent successfully.

    2. You can check the tx_id of this withdrawal by using the interface ofGet A Deposit Or Withdraw Detail, and use it to query the withdrawal progress on the blockchain.

    3. If you get an error message, message=This address is not verified. Please add and verify this address on the client
    You need to add the address to the whitelist address according to the following 3 steps.

    Step 1: After logging in to the account on the Web or APP, enter the withdrawal page.

    Step 2: Click【Add withdrawal address】

    PNG

    Step 3: On the address management page, save the withdrawal address as [Verified Address], which supports API withdrawal.

    PNGPNG

    4. Address Types:

    1. Standard Address: Can be withdrawn to a specified currency and network address.
    2. Universal Address: Can be withdrawn to all currencies on the specified network.
    3. EVM Address: Can be withdrawn to currencies on EVM type networks.

    5. Verified Addresses:

    1. When saving an address, it can be pre-verified to skip the verification during withdrawal (Verified addresses will not need to be verified again during the withdrawal process).
    2. API withdrawal must use verified addresses; un-verified addresses cannot be used for withdrawal via API.

    Withdraw Address (KEYED)

    Gets Withdraw Address List

    Request URL

    GET https://api-cloud.bitmart.com/account/v1/withdraw/address/list

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'https://api-cloud.bitmart.com/account/v1/withdraw/address/list

    None

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"0e6edd79-f77f-4251-abe5-83ba75d06c1a","data":{"list":[{"currency":"ETH","network":"ETH","address":"0x1121","memo":"12","remark":"12","addressType":0,"verifyStatus":0}]}}
    FieldTypeDescription
    addressStringWithdraw Address
    memoStringMemo
    remarkStringRemark
    verifyStatusIntAddress verify status
    -0=Unverified
    -1=Verified
    addressTypeIntAddress Type
    -0=Standard Address
    -1=Universal Address
    -2=EVM Address
    networkStringNetwork. The value is present only when the address type is a Standard address or Universal Address
    currencyStringThe value is present only when the address type is a Standard address

    Get Deposit And Withdraw History (KEYED)

    The original /account/v1/deposit-withdraw/history interface, the old interface is no longer supported, please switch to the new interface as soon as possible

    Search for all existed withdraws and deposits and return their latest status.

    Request URL

    GET https://api-cloud.bitmart.com/account/v2/deposit-withdraw/history

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'https://api-cloud.bitmart.com/account/v2/deposit-withdraw/history?N=100&operation_type=withdraw&startTime=1739499865000
    FieldTypeRequired?Description
    currencyStringNoToken symbol, e.g., 'BTC'
    operation_typeStringYestype
    -deposit=deposit
    -withdraw=withdraw
    startTimeLongNoDefault: 90 days from current timestamp (milliseconds)
    endTimeLongNoDefault: present timestamp (milliseconds)
    NIntYesRecent N records (value range 1-1000)

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"142bf92a-fc50-4689-92b6-590886f90b97","data":{"records":[{"withdraw_id":"1679952","deposit_id":"","operation_type":"withdraw","currency":"BMX","apply_time":1588867374000,"arrival_amount":"59.000000000000","fee":"1.000000000000","status":0,"address":"0xe57b69a8776b37860407965B73cdFFBDFe668Bb5","address_memo":"","tx_id":""}]}}
    FieldTypeDescription
    withdraw_idStringwithdraw id
    deposit_idStringdeposit id
    operation_typeStringtype
    -deposit=deposit
    -withdraw=withdraw
    currencyStringToken symbol, e.g., 'BTC'
    apply_timeLongThe request timestamp is accurate to milliseconds(UTC-0)
    arrival_amountStringActual amount received
    feeStringfee
    statusIntstatus
    -0=Create
    -1=Submitted, waiting for withdrawal
    -2=Processing
    -3=Done
    -4=Cancel
    -5=Fail
    addressStringAddress
    address_memoStringAddress tag
    tx_idStringHash record
    1. The deposit id has a value when `operation_type` = 'deposit'. The withdraw id has a value when `operation_type` = 'withdraw'.
    2. Tx_id is an empty string before it is chained.
    3. Please notice the default startTime and endTime to make sure that time interval is within 0-90 days.
    4. If both startTime and endTime are sent, time between startTime and endTime must be less than 90 days.
    This endpoint is not available for sub-account

    Get A Deposit Or Withdraw Detail (KEYED)

    Query a single charge record

    Request URL

    GET https://api-cloud.bitmart.com/account/v1/deposit-withdraw/detail

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'https://api-cloud.bitmart.com/account/v1/deposit-withdraw/detail?id=1679952
    FieldTypeRequired?Description
    idStringYeswithdraw_id ordeposit_id

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"f7f74924-14da-42a6-b7f2-d3799dd9a612","data":{"record":{"withdraw_id":"1679952","deposit_id":"","operation_type":"withdraw","currency":"BMX","apply_time":1588867374000,"arrival_amount":"59.000000000000","fee":"1.000000000000","status":0,"address":"0xe57b69a8776b37860407965B73cdFFBDFe668Bb5","address_memo":"","tx_id":""}}}
    FieldTypeDescription
    withdraw_idStringwithdraw id
    deposit_idStringdeposit id
    operation_typeStringtype
    -deposit=deposit
    -withdraw=withdraw
    currencyStringToken symbol, e.g., 'BTC'
    apply_timeLongThe request timestamp is accurate to milliseconds(UTC-0)
    arrival_amountStringActual amount received
    feeStringfee
    statusIntstatus
    -0=Create
    -1=Submitted, waiting for withdrawal
    -2=Processing
    -3=Done
    -4=Cancel
    -5=Fail
    addressStringaddress
    address_memoStringaddress tag
    tx_idStringHash record
    1. The deposit id has a value when `operation_type` = 'deposit'. The withdraw id has a value when `operation_type` = 'withdraw'.
    2. Tx_id is an empty string before it is chained.
    This interface is not available for sub-account

    Get Margin Account Details(Isolated) (KEYED)

    Applicable for isolated margin account inquiries

    Request URL

    GET https://api-cloud.bitmart.com/spot/v1/margin/isolated/account

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}' https://api-cloud.bitmart.com/spot/v1/margin/isolated/account?symbol=BTC_USDT
    FieldTypeRequired?Description
    symbolStringNoTrading pair (e.g. BMX_USDT), no symbol is passed, and all isolated margin assets are returned

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"f7f74924-14da-42a6-b7f2-d3799dd9a612","data":{"symbols":[{"symbol":"BTC_USDT","risk_rate":"18.77","risk_level":"1","buy_enabled":true,"sell_enabled":true,"liquidate_price":"-0.09408905","liquidate_rate":"1.1","base":{"currency":"BTC","borrow_enabled":false,"borrowed":"2.00000000","borrow_unpaid":"0.84478234","interest_unpaid":"0.01385763","available":"112.89603334","frozen":"0.00000000","net_asset":"110.89603334","net_assetBTC":"0.00000000","total_asset":"112.89603334"},"quote":{"currency":"USDT","borrow_enabled":true,"borrowed":"0.00000000","borrow_unpaid":"0.84478234","interest_unpaid":"0.01385763","available":"10.00000000","frozen":"0.00000000","net_asset":"10.00000000","net_assetBTC":"0.00000000","total_asset":"10.00000000"}},...]}}
    FieldTypeDescription
    symbolStringTrading pair
    risk_rateStringCurrent risk rate
    risk_levelStringRisk level
    buy_enabledBooleanWhether open to buy
    sell_enabledBooleanWhether open to sell
    liquidate_priceStringLiquidation price (precision: 8 decimal places)
    liquidate_rateStringLiquidation rate
    currencyStringCurrency
    borrow_enabledBooleanWhether open to borrow
    borrowedStringBorrowed assets (precision: 8 decimal places)
    borrow_unpaidStringOutstanding principal amount (precision: 8 decimal places)
    interest_unpaidStringInterest outstanding (precision: 8 decimal places)
    availableStringAvailable assets (precision: 8 decimal places)
    frozenStringTrading frozen assets (precision: 8 decimal places)
    net_assetStringNet assets (precision: 8 decimal places)
    net_assetBTCStringConverted BTC net assets (precision: 8 decimal places)
    total_assetStringTotal assets (precision: 8 decimal places)

    Margin Asset Transfer (SIGNED)

    For fund transfers between a margin account and spot account

    Request URL

    POST https://api-cloud.bitmart.com/spot/v1/margin/isolated/transfer

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{    "symbol":"BTC_USDT",    "currency":"BTC",    "amount":"1",    "side":"in"}'https://api-cloud.bitmart.com/spot/v1/margin/isolated/transfer
    FieldTypeRequired?Description
    symbolStringYesTrading pair (e.g. BMX_USDT)
    currencyStringYesCurrency
    amountStringYesAmount of transfers (precision: 8 decimal places)
    sideStringYesTransfer direction
    -in=Transfer in
    -out=Transfer out

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"f7f74924-14da-42a6-b7f2-d3799dd9a612","data":{"transfer_id":"124532"}}
    FieldTypeDescription
    transfer_idStringTransfer order id, only successful transfers will be returned

    Get Basic Fee Rate (KEYED)

    For querying the base rate of the current user

    Request URL

    GET https://api-cloud.bitmart.com/spot/v1/user_fee

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}' https://api-cloud.bitmart.com/spot/v1/user_fee

    None

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"0187ba0c876e4236ac191d9848a0f719.94.16778301620100121","data":{"user_rate_type":0,"level":"LV1","taker_fee_rate_A":"0.001","maker_fee_rate_A":"0.001","taker_fee_rate_B":"0.0025","maker_fee_rate_B":"0.0025","taker_fee_rate_C":"0.004","maker_fee_rate_C":"0.004","taker_fee_rate_D":"0.006","maker_fee_rate_D":"0.006"}}
    FieldTypeDescription
    user_rate_typeLongRate type:
    -0=Normal Users
    -1=VIP Users
    -2=Special VIP Users
    levelStringUser Level
    taker_fee_rate_AStringTaker fee rate for Class-A pairs
    maker_fee_rate_AStringMaker fee rate for Class-A pairs
    taker_fee_rate_BStringTaker fee rate for Class-B pairs
    maker_fee_rate_BStringMaker fee rate for Class-B pairs
    taker_fee_rate_CStringTaker fee rate for Class-C pairs
    maker_fee_rate_CStringMaker fee rate for Class-C pairs
    taker_fee_rate_DStringTaker fee rate for Class-D pairs
    maker_fee_rate_DStringMaker fee rate for Class-D pairs

    Get Actual Trade Fee Rate (KEYED)

    For the actual fee rate of the trading pairs

    Request URL

    GET https://api-cloud.bitmart.com/spot/v1/trade_fee

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'https://api-cloud.bitmart.com/spot/v1/trade_fee?symbol=BTC_USDT
    FieldTypeRequired?Description
    symbolStringYesTrading pair (e.g. BMX_USDT)

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"87614aa8-5327-4fe2-aafc-02e2ddca7210","data":{"symbol":"BTC_USDT","buy_taker_fee_rate":"0.0008","sell_taker_fee_rate":"0.0008","buy_maker_fee_rate":"0.0006","sell_maker_fee_rate":"0.0006"}}
    FieldTypeDescription
    symbolStringTrading pair
    buy_taker_fee_rateStringTaker fee rate (Buy)
    sell_taker_fee_rateStringTaker fee rate (Sell)
    buy_maker_fee_rateStringMaker fee rate (Buy)
    sell_maker_fee_rateStringMaker fee rate (Sell)

    Spot / Margin Trading

    New Order(v2) (SIGNED)

    Send in a new order.

    Request URL

    POST https://api-cloud.bitmart.com/spot/v2/submit_order

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{    "symbol":"BTC_USDT",    "side":"buy",    "type":"limit",    "size":"10",    "price":"7000"    "stpMode":"none"}'https://api-cloud.bitmart.com/spot/v2/submit_order
    FieldTypeRequired?Description
    symbolStringYesTrading pair (e.g. BTC_USDT)
    sideStringYesSide
    -buy=Buy order
    -sell=Sell order
    typeStringYesOrder type
    -limit=Limit order
    -market=Market order
    -limit_maker=PostOnly order
    -ioc=IOC order
    client_order_idStringNoClient-defined OrderId(A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters)
    stpModeStringNoSelf transaction protection type(default:none)
    -none
    -cancel_maker
    -cancel_taker
    -cancel_both

    Special Parameters for Limit Orders/PostOnly Orders/IOC Orders (type=limit/limit_maker/ioc)

    FieldTypeRequired?Description
    sizeStringYesOrder size
    priceStringYesPrice

    Special Parameters for Market Buy Orders (type=market,side=buy)

    FieldTypeRequired?Description
    notionalStringYesRequired for placing orders by amount

    Special Parameters for Market Sell Orders (type=market,side=sell)

    FieldTypeRequired?Description
    sizeStringYesRequired for placing orders by quantity

    Instruction

    Buy-limit-maker

    Sell-limit-maker

    Buy-ioc,Sell-ioc

    Self trade prevention (STP)

    The trading platform imposes self trade prevention at account level. The default STP mode is none. Users can also utilize the stpMode request parameter of the placing order endpoint to determine the stpMode of a certain order.Self trade prevention will not lead to latency.

    There are three STP modes.

    1. Cancel Maker: Which cancels the maker order to prevent self-trading. Then, the taker order continues to match with the next order based on the order book priority.
    2. Cancel Taker: The taker order is canceled to prevent self-trading. If the user's own maker order is lower in the order book priority, the taker order is partially filled and then canceled. FOK orders are always honored and canceled if they would result in self-trading.
    3. Cancel Both: Both taker and maker orders are canceled to prevent self-trading. If the user's own maker order is lower in the order book priority, the taker order is partially filled. Then, the remaining quantity of the taker order and the first maker order are canceled. FOK orders are not supported in this mode.

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1","message":"OK","data":{"order_id":"1223181"}}
    FieldTypeDescription
    order_idStringOrder ID
    The request is successful only when order_id is returned.

    Cancel Order(v3) (SIGNED)

    Applicable to the cancellation of a specified unfinished order

    Request URL

    POST https://api-cloud.bitmart.com/spot/v3/cancel_order

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{    "symbol": "BTC_USDT",    "order_id": "112121212"}'https://api-cloud.bitmart.com/spot/v3/cancel_order
    FieldTypeRequired?Description
    symbolStringYesTrading pair (e.g. BMX_USDT)
    order_idStringorder_id, client_order_id, one of them is requiredOrder ID
    client_order_idStringorder_id, client_order_id, one of them is requiredClient-defined Order ID
    In each request, you must select one of the parameters order_id and client_order_id to submit

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1","message":"OK","data":{"result":true}}
    FieldTypeDescription
    resultBooleanCancel result
    -true=Cancel successfully
    -false=Cancel failed
    `result` = 'true' indicates successful cancel; `result` = 'false' indicates that the cancel failed because the order was matched or cancelled.

    New Batch Order(v4) (SIGNED)

    Batch order

    Request URL

    POST https://api-cloud.bitmart.com/spot/v4/batch_orders

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{    "symbol":"BTC_USDT",    "orderParams":[{          "clientOrderId":"123456789",          "size":"0.1",          "price":"8800",          "side":"buy",          "type":"limit"          "stpMode":"none"    }],    "recvWindow":5000}'https://api-cloud.bitmart.com/spot/v4/batch_orders
    FieldTypeRequired?Description
    symbolStringYesTrading pair (e.g. BTC_USDT)
    orderParamsListYesOrder parameters, the number of transactions cannot exceed 10
    recvWindowLongNoTrade time limit, allowed range (0,60000], default: 5000 milliseconds

    orderParams

    FieldTypeRequired?Description
    sideStringYesSide
    -buy=Buy order
    -sell=Sell order
    typeStringYesOrder type
    -limit=Limit order
    -market=Market order
    -limit_maker=PostOnly order
    -ioc=IOC order
    clientOrderIdStringNoClient-defined OrderId(A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters)
    stpModeStringNoSelf transaction protection type(default:none)
    -none
    -cancel_maker
    -cancel_taker
    -cancel_both
    Special Parameters for Limit Orders/PostOnly Orders/IOC Orders (type=limit/limit_maker/ioc)
    FieldTypeRequired?Description
    sizeStringYesOrder size
    priceStringYesPrice

    Special Parameters for Market Buy Orders (type=market,side=buy)

    FieldTypeRequired?Description
    notionalStringYesRequired for placing orders by amount

    Special Parameters for Market Sell Orders (type=market,side=sell)

    FieldTypeRequired?Description
    sizeStringYesRequired for placing orders by quantity

    Instruction

    Buy-limit-maker

    Sell-limit-maker

    Buy-ioc,Sell-ioc

    Self trade prevention (STP)

    The trading platform imposes self trade prevention at account level. The default STP mode is none. Users can also utilize the stpMode request parameter of the placing order endpoint to determine the stpMode of a certain order.Self trade prevention will not lead to latency.

    There are three STP modes.

    1. Cancel Maker: Which cancels the maker order to prevent self-trading. Then, the taker order continues to match with the next order based on the order book priority.
    2. Cancel Taker: The taker order is canceled to prevent self-trading. If the user's own maker order is lower in the order book priority, the taker order is partially filled and then canceled. FOK orders are always honored and canceled if they would result in self-trading.
    3. Cancel Both: Both taker and maker orders are canceled to prevent self-trading. If the user's own maker order is lower in the order book priority, the taker order is partially filled. Then, the remaining quantity of the taker order and the first maker order are canceled. FOK orders are not supported in this mode.

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"5fc697fb817a4b5396284786a9b2609a.263.17022620476480263","data":{"code":0,"msg":"success","data":{"orderIds":["212751308355553320"]}}}
    FieldTypeDescription
    orderIdsListOrder ID
    The request is successful only when orderIds is returned.

    Cancel Batch Order(v4) (SIGNED)

    Cancel all outstanding orders in the specified direction for the specified trading pair or cancel based on the order ID

    Request URL

    POST https://api-cloud.bitmart.com/spot/v4/cancel_orders

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{  "symbol":"BTC_USDT",  "orderIds":[    "5e925f3981"  ],  "recvWindow":5000}'https://api-cloud.bitmart.com/spot/v4/cancel_orders
    FieldTypeRequired?Description
    symbolStringYesTrading pair (e.g. BTC_USDT)
    orderIdsListorderIds, clientOrderIds, one of them is requiredOrder Id List (Limited to 10 ids)
    clientOrderIdsListorderIds, clientOrderIds, one of them is requiredClient-defined OrderId List (Limited to 10 ids)
    recvWindowLongNoTrade time limit, allowed range (0,60000], default: 5000 milliseconds
    In each request, you must select one of the parameters orderIds and clientOrderIds to submit

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"c4edbce860164203954f7c3c81d60fc6.309.17022669632770001","data":{"successIds":["213055379155243012"],"failIds":[],"totalCount":1,"successCount":1,"failedCount":0}}
    FieldTypeDescription
    successIdsListSuccessfully canceled order IDs
    failIdsListOrder IDs that failed to cancel
    totalCountIntNumber of submissions
    successCountIntNumber of successes
    failedCountIntNumber of failures

    Cancel All Order(v4) (SIGNED)

    Cancel all orders

    Request URL

    POST https://api-cloud.bitmart.com/spot/v4/cancel_all

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{  "symbol":"BTC_USDT",  "side":"buy"}'https://api-cloud.bitmart.com/spot/v4/cancel_all
    FieldTypeRequired?Description
    symbolStringNoTrading pair (e.g. BTC_USDT)
    sideStringNoOrder side
    -buy
    -sell

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1","message":"OK","data":{}}

    If code is equal to 1000, it means the cancellation is successful.

    New Margin Order(v1) (SIGNED)

    Applicable for margin order placement

    Request URL

    POST https://api-cloud.bitmart.com/spot/v1/margin/submit_order

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{    "symbol":"BTC_USDT",    "side":"buy",    "type":"limit",    "size":"10",    "price":"7000"}'https://api-cloud.bitmart.com/spot/v1/margin/submit_order
    FieldTypeRequired?Description
    symbolStringYesTrading pair (e.g. BTC_USDT)
    sideStringYesSide
    -buy=Buy order
    -sell=Sell order
    typeStringYesOrder type
    -limit=Limit order
    -market=Market order
    -limit_maker=PostOnly order
    -ioc=IOC order
    clientOrderIdStringNoClient-defined OrderId(A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters)

    Special Parameters for Limit Orders/PostOnly Orders/IOC Orders (type=limit/limit_maker/ioc)

    FieldTypeRequired?Description
    sizeStringYesOrder size
    priceStringYesPrice

    Special Parameters for Market Buy Orders (type=market,side=buy)

    FieldTypeRequired?Description
    notionalStringYesRequired for placing orders by amount

    Special Parameters for Market Sell Orders (type=market,side=sell)

    FieldTypeRequired?Description
    sizeStringYesRequired for placing orders by quantity

    Instruction

    Buy-limit-maker

    Sell-limit-maker

    Buy-ioc,Sell-ioc

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"f7f74924-14da-42a6-b7f2-d3799dd9a612","data":{"order_id":1223181}}
    FieldTypeDescription
    order_idLongOrder ID
    The request is successful only when order_id is returned.

    Query Order By Id (v4) (SIGNED)

    Query a single order by orderId

    Request URL

    POST https://api-cloud.bitmart.com/spot/v4/query/order

    Request Limit

    Refer toRate Limitation Details

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{  "orderId":"118100034543076010",  "queryState":"open",  "recvWindow":5000}'https://api-cloud.bitmart.com/spot/v4/query/order
    FieldTypeRequired?Description
    orderIdStringYesOrder id
    queryStateStringNoQuery Type
    -open=Query order state [new, partially_filled]
    -history=QUery order state [filled, canceled, partially_canceled])
    recvWindowLongNoTrade time limit, allowed range (0,60000], default: 5000 milliseconds
    Note

    Response Details

    Response

    {"code":1000,"message":"success","data":{"orderId":"118100034543076010","clientOrderId":"118100034543076010","symbol":"BTC_USDT","side":"buy","orderMode":"spot","type":"limit","state":"filled","cancelSource":"","stpMode":"cancel_maker","price":"48800.00","priceAvg":"39999.00","size":"0.10000","filledSize":"0.10000","notional":"4880.00000","filledNotional":"3999.90000","createTime":1681701557927,"updateTime":1681701559408},"trace":"8aab576e50024648ae45e3cfaf90f9cf.60.16817015721880197"}
    FieldTypeDescription
    orderIdStringOrder ID
    clientOrderIdStringUser-defined ID
    symbolStringTrading pair (e.g. BTC_USDT)
    sideStringOrder side
    -buy=buy
    -sell=sell
    orderModeStringOrder mode
    -spot=spot
    -iso_margin=isolated margin
    typeStringOrder type
    -limit=limit order
    -market=market order
    -limit_maker=PostOnly order
    -ioc=IOC order
    stateStringOrder status
    -new=The order has been accepted by the engine.
    -partially_filled=A part of the order has been filled.
    -filled=The order has been completed.
    -canceled=The order has been canceled.
    -partially_canceled=A part of the order has been filled , and the order has been canceled.
    cancelSourceStringOrder cancellation reason(Return value only if the order state iscanceled orpartially_canceled, otherwise it will return an empty string)
    -user=User manually canceled.
    -system=System automatically canceled.
    -stp=Stp Cancelled.
    stpModeStringSelf transaction protection type
    -none=none
    -cancel_maker=cancel_maker
    -cancel_taker=cancel_taker
    -cancel_both=cancel_both
    priceStringOrder price
    priceAvgStringAverage execution price of the order
    sizeStringOrder quantity
    filledSizeStringActual execution quantity
    notionalStringOrder amount
    filledNotionalStringActual execution amount
    createTimeLongOrder creation time in milliseconds, e.g. 1681701557927
    updateTimeLongLast update time in milliseconds, e.g. 1681701557927

    Query Order By clientOrderId(v4) (SIGNED)

    Query a single order by clientOrderId.

    Request URL

    POST https://api-cloud.bitmart.com/spot/v4/query/client-order

    Request Limit

    Refer toRate Limitation Details

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{  "clientOrderId":"118100034543076010",  "queryState":"open",  "recvWindow":5000}'https://api-cloud.bitmart.com/spot/v4/query/client-order
    FieldTypeRequired?Description
    clientOrderIdStringYesUser-defined order id
    queryStateStringNoQuery Type
    -open=Query order state [new, partially_filled]
    -history=Query order state [filled, canceled, partially_canceled])
    recvWindowLongNoTrade time limit, allowed range (0,60000], default: 5000 milliseconds
    Note

    Response Details

    Response

    {"code":1000,"message":"success","data":{"orderId":"118100034543076010","clientOrderId":"118100034543076010","symbol":"BTC_USDT","side":"buy","orderMode":"spot","type":"limit","state":"filled","cancelSource":"","stpMode":"cancel_maker","price":"48800.00","priceAvg":"39999.00","size":"0.10000","filledSize":"0.10000","notional":"4880.00000","filledNotional":"3999.90000","createTime":1681701557927,"updateTime":1681701559408},"trace":"8aab576e50024648ae45e3cfaf90f9cf.60.16817015721880197"}
    FieldTypeDescription
    orderIdStringOrder ID
    clientOrderIdStringUser-defined ID
    symbolStringTrading pair (e.g. BTC_USDT)
    sideStringOrder side
    -buy=buy
    -sell=sell
    orderModeStringOrder mode
    -spot=spot
    -iso_margin=isolated margin
    typeStringOrder type
    -limit=limit order
    -market=market order
    -limit_maker=PostOnly order
    -ioc=IOC order
    stateStringOrder status
    -new=The order has been accepted by the engine.
    -partially_filled=A part of the order has been filled.
    -filled=The order has been completed.
    -canceled=The order has been canceled.
    -partially_canceled=A part of the order has been filled , and the order has been canceled.
    cancelSourceStringOrder cancellation reason(Return value only if the order state iscanceled orpartially_canceled, otherwise it will return an empty string)
    -user=User manually canceled.
    -system=System automatically canceled.
    -stp=Stp Cancelled.
    stpModeStringSelf transaction protection type
    -none=none
    -cancel_maker=cancel_maker
    -cancel_taker=cancel_taker
    -cancel_both=cancel_both
    priceStringOrder price
    priceAvgStringAverage execution price of the order
    sizeStringOrder quantity
    filledSizeStringActual execution quantity
    notionalStringOrder amount
    filledNotionalStringActual execution amount
    createTimeLongOrder creation time in milliseconds, e.g. 1681701557927
    updateTimeLongLast update time in milliseconds, e.g. 1681701557927

    Current Open Orders(v4) (SIGNED)

    Query the current opening order list of the account, only including state=[new, partially_filled] orders

    Request URL

    POST https://api-cloud.bitmart.com/spot/v4/query/open-orders

    Request Limit

    Refer toRate Limitation Details

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{  "symbol":"BTC_USDT",  "orderMode":"spot",  "startTime":1682239652931,  "endTime":1682239657931,  "limit":10,  "recvWindow":5000}'https://api-cloud.bitmart.com/spot/v4/query/open-orders
    FieldTypeRequired?Description
    symbolStringNoTrading pair (e.g. BTC_USDT)
    orderModeStringNoOrder mode
    -spot=spot trade
    -iso_margin=isolated margin trade
    startTimeLongNoStart time in milliseconds, (e.g. 1681701557927)
    endTimeLongNoEnd time in milliseconds, (e.g. 1681701557927)
    limitIntNoNumber of queries, allowed range [1,200], default 200
    recvWindowLongNoTrade time limit, allowed range (0,60000], default: 5000 milliseconds
    Note

    Response Details

    Response

    {"code":1000,"message":"success","data":[{"orderId":"125213058731346056","clientOrderId":"125213058731346056","symbol":"BTC_USDT","side":"buy","orderMode":"spot","type":"limit","state":"new","cancelSource":"","stpMode":"cancel_maker","price":"800.00","priceAvg":"0.00","size":"0.10000","filledSize":"0.00000","notional":"80.00000000","filledNotional":"0.00000000","createTime":1681892198608,"updateTime":1681892198946}],"trace":"5e1c9f98d761443ea559c7af71ca57fa.60.16818922069220005"}
    FieldTypeDescription
    orderIdStringOrder ID
    clientOrderIdStringUser-defined ID
    symbolStringTrading pair (e.g. BTC_USDT)
    sideStringOrder side
    -buy=buy
    -sell=sell
    orderModeStringOrder mode
    -spot=spot
    -iso_margin=isolated margin
    typeStringOrder type
    -limit=limit order
    -market=market order
    -limit_maker=PostOnly order
    -ioc=IOC order
    stateStringOrder status
    -new=The order has been accepted by the engine.
    -partially_filled=a part of the order has been filled.
    cancelSourceStringOrder cancellation reason(Return value only if the order state iscanceled orpartially_canceled, otherwise it will return an empty string)
    -user=User manually canceled.
    -system=System automatically canceled.
    stpModeString自成交保护类型
    -none=不使用
    -cancel_maker=撤销maker
    -cancel_taker=撤销taker
    -cancel_both=全部撤销
    priceStringOrder price
    priceAvgStringAverage execution price of the order
    sizeStringOrder quantity
    filledSizeStringActual execution quantity
    notionalStringOrder amount
    filledNotionalStringActual execution amount
    createTimeLongOrder creation time in milliseconds, e.g. 1681701557927
    updateTimeLongLast update time in milliseconds, e.g. 1681701557927

    Account Orders(v4) (SIGNED)

    Query the account history order list, only including state=[filled, canceled, partially_canceled] orders

    Request URL

    POST https://api-cloud.bitmart.com/spot/v4/query/history-orders

    Request Limit

    Refer toRate Limitation Details

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{  "symbol":"BTC_USDT",  "orderMode":"spot",  "startTime":1682239502394,  "endTime":1682239507394,  "limit":10,  "recvWindow":5000}'https://api-cloud.bitmart.com/spot/v4/query/history-orders
    FieldTypeRequired?Description
    symbolStringNoTrading pair (e.g. BTC_USDT)
    orderModeStringNoOrder mode
    -spot=spot trade
    -iso_margin=isolated margin trade
    startTimeLongNoStart time in milliseconds, (e.g. 1681701557927)
    endTimeLongNoEnd time in milliseconds, (e.g. 1681701557927)
    limitIntNoNumber of queries, allowed range [1,200], default 200
    recvWindowLongNoTrade time limit, allowed range (0,60000], default: 5000 milliseconds
    Note

    Response Details

    Response

    {"code":1000,"message":"success","data":[{"orderId":"118100034543076010","clientOrderId":"118100034543076010","symbol":"BTC_USDT","side":"buy","orderMode":"spot","type":"limit","state":"filled","cancelSource":"","stpMode":"cancel_maker","price":"48800.00","priceAvg":"39999.00","size":"0.10000","filledSize":"0.10000","notional":"4880.00000000","filledNotional":"3999.90000000","createTime":1681701557927,"updateTime":1681701559408}],"trace":"acc282ba9e434cc1a90bf6326de9e119.64.16818913787390001"}
    FieldTypeDescription
    orderIdStringOrder ID
    clientOrderIdStringUser-defined ID
    symbolStringTrading pair (e.g. BTC_USDT)
    sideStringOrder side
    -buy=buy
    -sell=sell
    orderModeStringOrder mode
    -spot=spot
    -iso_margin=isolated margin
    typeStringOrder type
    -limit=limit order
    -market=market order
    -limit_maker=PostOnly order
    -ioc=IOC order
    stateStringOrder status
    -filled=The order has been completed.
    -canceled=The order has been canceled.
    -partially_canceled=A part of the order has been filled , and the order has been canceled.
    cancelSourceStringOrder cancellation reason(Return value only if the order state iscanceled orpartially_canceled, otherwise it will return an empty string)
    -user=User manually canceled.
    -system=System automatically canceled.
    -stp=Stp Cancelled.
    stpModeStringSelf transaction protection type
    -none=none
    -cancel_maker=cancel_maker
    -cancel_taker=cancel_taker
    -cancel_both=cancel_both
    priceStringOrder price
    priceAvgStringAverage execution price of the order
    sizeStringOrder quantity
    filledSizeStringActual execution quantity
    notionalStringOrder amount
    filledNotionalStringActual execution amount
    createTimeLongOrder creation time in milliseconds, e.g. 1681701557927
    updateTimeLongLast update time in milliseconds, e.g. 1681701557927

    Account Trade List(v4) (SIGNED)

    Query all transaction records of the account

    Request URL

    POST https://api-cloud.bitmart.com/spot/v4/query/trades

    Request Limit

    Refer toRate Limitation Details

    Request Parameter

    Request

     curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{  "symbol":"BTC_USDT",  "orderMode":"spot",  "startTime":1682239845952,  "endTime":1682239850952,  "limit":10,  "recvWindow":5000}'https://api-cloud.bitmart.com/spot/v4/query/trades
    FieldTypeRequired?Description
    symbolStringNoTrading pair (e.g. BTC_USDT)
    orderModeStringNoOrder mode
    -spot=spot trade
    -iso_margin=isolated margin trade
    startTimeLongNoStart time in milliseconds, (e.g. 1681701557927)
    endTimeLongNoEnd time in milliseconds, (e.g. 1681701557927)
    limitIntNoNumber of queries, allowed range [1,200], default 200
    recvWindowLongNoTrade time limit, allowed range (0,60000], default: 5000 milliseconds
    Note

    Response Details

    Response

    {"code":1000,"message":"success","data":[{"tradeId":"125277182593091639","orderId":"125213058731346053","clientOrderId":"125213058731346053","symbol":"BTC_USDT","side":"buy","orderMode":"spot","type":"limit","stpMode":"cancel_maker","price":"39999.00","size":"0.10000","notional":"3999.90000000","fee":"9.99975000","feeCoinName":"USDT","tradeRole":"taker","createTime":1681891896569,"updateTime":1681891896569}],"trace":"5e1c9f98d761443ea559c7af71ca57fa.61.16819603026240455"}
    FieldTypeDescription
    tradeIdStringTrade id
    orderIdStringOrder ID
    clientOrderIdStringUser-defined ID
    symbolStringTrading pair (e.g. BTC_USDT)
    sideStringOrder side
    -buy=buy
    -sell=sell
    orderModeStringOrder mode
    -spot=spot
    -iso_margin=isolated margin
    typeStringOrder type
    -limit=limit order
    -market=market order
    -limit_maker=PostOnly order
    -ioc=IOC order
    stpModeStringSelf transaction protection type
    -none=none
    -cancel_maker=cancel_maker
    -cancel_taker=cancel_taker
    -cancel_both=cancel_both
    priceStringTransaction price
    sizeStringTransaction quantity
    notionalStringTransaction amount
    feeStringFee amount
    feeCoinNameStringFee coin name
    tradeRoleStringTrade role
    -taker=Take orders, take the initiative to deal
    -maker=Pending order, passive transaction
    createTimeLongOrder creation time in milliseconds, e.g. 1681701557927
    updateTimeLongLast update time in milliseconds, e.g. 1681701557927

    Order Trade List(v4) (SIGNED)

    Query all transaction records of a single order

    Request URL

    POST https://api-cloud.bitmart.com/spot/v4/query/order-trades

    Request Limit

    Refer toRate Limitation Details

    Request Parameter

    Request

     curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{  "orderId":"118100034543076010",  "recvWindow":5000}'https://api-cloud.bitmart.com/spot/v4/query/order-trades
    FieldTypeRequired?Description
    orderIdStringYesOrder id
    recvWindowLongNoTrade time limit, allowed range (0,60000], default: 5000 milliseconds
    Note

    Response Details

    Response

    {"code":1000,"message":"success","data":[{"tradeId":"122177405911172002","orderId":"118100034543076010","clientOrderId":"118100034543076010","symbol":"BTC_USDT","side":"buy","orderMode":"spot","type":"limit","stpMode":"cancel_maker","price":"39999.00","size":"0.10000","notional":"3999.90000000","fee":"9.99975000","feeCoinName":"USDT","tradeRole":"taker","createTime":1681701559210,"updateTime":1681701559210}],"trace":"5e1c9f98d761443ea559c7af71ca57fa.62.16818934219090007"}
    FieldTypeDescription
    tradeIdStringTrade id
    orderIdStringOrder ID
    clientOrderIdStringUser-defined ID
    symbolStringTrading pair (e.g. BTC_USDT)
    sideStringOrder side
    -buy=buy
    -sell=sell
    orderModeStringOrder mode
    -spot=spot
    -iso_margin=isolated margin
    typeStringOrder type
    -limit=limit order
    -market=market order
    -limit_maker=PostOnly order
    -ioc=IOC order
    stpModeStringSelf transaction protection type
    -none=none
    -cancel_maker=cancel_maker
    -cancel_taker=cancel_taker
    -cancel_both=cancel_both
    priceStringTransaction price
    sizeStringTransaction quantity
    notionalStringTransaction amount
    feeStringFee amount
    feeCoinNameStringFee coin name
    tradeRoleStringTrade role
    -taker=Take orders, take the initiative to deal
    -maker=Pending order, passive transaction
    createTimeLongOrder creation time in milliseconds, e.g. 1681701557927
    updateTimeLongLast update time in milliseconds, e.g. 1681701557927

    Margin Loan

    Margin Borrow (Isolated) (SIGNED)

    Applicable to isolated margin account borrowing operations

    Request URL

    POST https://api-cloud.bitmart.com/spot/v1/margin/isolated/borrow

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{    "symbol":"BTC_USDT",    "currency":"BTC",    "amount":"1"}'https://api-cloud.bitmart.com/spot/v1/margin/isolated/borrow
    FieldTypeRequired?Description
    symbolStringYesTrading pair (e.g. BMX_USDT)
    currencyStringYesBorrowing currency, selected according to the borrowing trading pair(like BTC or USDT)
    amountStringYesAmount of borrowing (precision: 8 decimal places)

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"f7f74924-14da-42a6-b7f2-d3799dd9a612","data":{"borrow_id":"113896"}}
    FieldTypeDescription
    borrow_idStringBorrowing order ID, only successful borrowing will be returned

    Margin Repay (Isolated) (SIGNED)

    Applicable to isolated margin account repayment operations

    Request URL

    POST https://api-cloud.bitmart.com/spot/v1/margin/isolated/repay

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{    "symbol":"BTC_USDT",    "currency":"BTC",    "amount":"1"}'https://api-cloud.bitmart.com/spot/v1/margin/isolated/repay
    FieldTypeRequired?Description
    symbolStringYesTrading pair (e.g. BMX_USDT)
    currencyStringYesRepayment currency, selected according to the borrowing trading pair(like BTC or USDT)
    amountStringYesAmount of repayments (precision: 8 decimal places)

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"f7f74924-14da-42a6-b7f2-d3799dd9a612","data":{"repay_id":"123165"}}
    FieldTypeDescription
    repay_idStringRepayment order ID, only successful repayment will be returned

    Get Borrow Record(Isolated) (KEYED)

    Applicable to the inquiry of borrowing records of an isolated margin account

    Request URL

    GET https://api-cloud.bitmart.com/spot/v1/margin/isolated/borrow_record

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}' https://api-cloud.bitmart.com/spot/v1/margin/isolated/borrow_record?symbol=BTC_USDT
    FieldTypeRequired?Description
    symbolStringYesTrading pair (e.g. BMX_USDT)
    borrow_idStringNoBorrow order id
    start_timeLongNoQuery start time: Timestamp
    end_timeLongNoQuery end time: Timestamp
    NIntNoQuery record size, allowed range[1-100]. Default is 50

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"f7f74924-14da-42a6-b7f2-d3799dd9a612","data":{"records":[{"borrow_id":"133425","symbol":"BTC_USDT","currency":"BTC","borrow_amount":"1.23854339","daily_interest":"0.05","hourly_interest":"0.00208334","interest_amount":"0.02398474","create_time":1655345808},...]}}
    FieldTypeDescription
    borrow_idStringBorrow order id
    symbolStringTrading pair
    currencyStringCurrency
    borrow_amountStringThe total principal amount borrowed (precision: 8 decimal places)
    daily_interestStringDaily interest
    hourly_interestStringHourly interest
    interest_amountStringTotal interest (precision: 8 decimal places)
    create_timeLongOrder creation time

    Get Repayment Record(Isolated) (KEYED)

    Applicable to the inquiry of repayment records of isolated margin account

    Request URL

    GET https://api-cloud.bitmart.com/spot/v1/margin/isolated/repay_record

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'https://api-cloud.bitmart.com/spot/v1/margin/isolated/repay_record?symbol=BTC_USDT
    FieldTypeRequired?Description
    symbolStringYesTrading pair (e.g. BMX_USDT)
    repay_idStringNoRepayment ID
    currencyStringNoCurrency
    start_timeLongNoQuery start time: Timestamp
    end_timeLongNoQuery end time: Timestamp
    NIntNoQuery record size, allowed range[1-100]. Default is 50

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"f7f74924-14da-42a6-b7f2-d3799dd9a612","data":{"records":[{"repay_id":"118723","repay_time":1655345808,"symbol":"BTC_USDT","currency":"BTC","repaid_amount":"1.1","repaid_principal":"1","repaid_interest":"0.1"},...]}}
    FieldTypeDescription
    repay_idStringRepayment ID
    repay_timeLongRepayment Timestamp
    symbolStringRepayment trading pairs(like BTC_USDT)
    currencyStringRepayment currency
    repaid_amountStringRepayment amount
    repaid_principalStringThe principal amount returned by this repayment
    repaid_interestStringInterest returned by this repayment

    Get Trading Pair Borrowing Rate and Amount (KEYED)

    Applicable for checking the borrowing rate and borrowing amount of trading pairs

    Request URL

    GET https://api-cloud.bitmart.com/spot/v1/margin/isolated/pairs

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'https://api-cloud.bitmart.com/spot/v1/margin/isolated/pairs?symbol=BTC_USDT
    FieldTypeRequired?Description
    symbolStringNoIt can be multiple-choice; if not filled in, then return all, like BTC_USDT, ETH_USDT

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"f7f74924-14da-42a6-b7f2-d3799dd9a612","data":{"symbols":[{"symbol":"BTC_USDT","max_leverage":"10","symbol_enabled":true,"base":{"currency":"BTC","daily_interest":"0.05","hourly_interest":"0.00208334","max_borrow_amount":"1000.00000000","min_borrow_amount":"1.00000000","borrowable_amount":"955.90221219"},"quote":{"currency":"USDT","daily_interest":"0.05","hourly_interest":"0.00208334","max_borrow_amount":"12000.00000000","min_borrow_amount":"0.01000000","borrowable_amount":"12000.00000000"}},...]}}
    FieldTypeDescription
    symbolStringTrading pair
    max_leverageStringLeverage multiplier
    symbol_enabledBooleanWhether the trading pair is enabled
    currencyStringCurrency
    daily_interestStringDaily interest
    hourly_interestStringHourly interest
    max_borrow_amountStringThe maximum amount of borrowing (precision: 8 decimal places)
    min_borrow_amountStringThe minimum amount of borrowing (precision: 8 decimal places)
    borrowable_amountStringThe current available amount of borrowing (precision: 8 decimal places)

    Sub-Account

    Sub-Account interface function is currently open to institutional users only, and will be opened gradually

    Sub-Account to Main-Account (For Main Account) (SIGNED)

    Sub-account spot asset transfer to Main-account (For Main Account)

    Request URL

    POST https://api-cloud.bitmart.com/account/sub-account/main/v1/sub-to-main

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{    "requestNo":"4e2adcff-2122-1ce7-2557-4f65d2ce1ca2",    "amount":"1",    "currency":"BTC",    "subAccount":"[email protected]"}'https://api-cloud.bitmart.com/account/sub-account/main/v1/sub-to-main
    FieldTypeRequired?Description
    requestNoStringYesUUID,unique identifier, max length 64
    amountStringYesTransfer amount
    currencyStringYesCurrency
    subAccountStringYesSub-Account username

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1","message":"OK","data":{}}

    If code value is 1000,it means the transfer is successful.

    Sub-Account to Main-Account (For Sub-Account) (SIGNED)

    Sub-Account spot asset transfer to Main-Account spot asset (For Sub-Account)

    Request URL

    POST https://api-cloud.bitmart.com/account/sub-account/sub/v1/sub-to-main

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{    "requestNo":"4e2adcff-2122-1ce7-2557-4f65d2ce1ca2",    "amount":"1",    "currency":"BTC"}'https://api-cloud.bitmart.com/account/sub-account/sub/v1/sub-to-main
    FieldTypeRequired?Description
    requestNoStringYesUUID,unique identifier, max length 64
    amountStringYesTransfer amount
    currencyStringYesCurrency

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1","message":"OK","data":{}}

    If code value is 1000,it means the transfer is successful.

    Main-Account to Sub-Account (For Main Account) (SIGNED)

    Main-account spot asset transfer to Sub-account spot asset (For Main Account)

    Request URL

    POST https://api-cloud.bitmart.com/account/sub-account/main/v1/main-to-sub

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{    "requestNo":"4e2adcff-2122-1ce7-2557-4f65d2ce1ca2",    "amount":"1",    "currency":"BTC",    "subAccount":"[email protected]"}'https://api-cloud.bitmart.com/account/sub-account/main/v1/main-to-sub
    FieldTypeRequired?Description
    requestNoStringYesUUID,unique identifier, max length 64
    amountStringYesTransfer amount
    currencyStringYesCurrency
    subAccountStringYesSub-Account username

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1","message":"OK","data":{}}

    If code value is 1000,it means the transfer is successful.

    Sub-Account to Sub-Account (For Main Account) (SIGNED)

    Sub-Account spot asset transfer to Sub-Account spot asset (For Main Account)

    Request URL

    POST https://api-cloud.bitmart.com/account/sub-account/main/v1/sub-to-sub

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'-H'X-BM-TIMESTAMP:{{currentTime}}'-H'X-BM-SIGN:{{SIGN}}'-X POST-d'{    "requestNo":"4e2adcff-2122-1ce7-2557-4f65d2ce1ca2",    "amount":"1",    "currency":"BTC",    "fromAccount":"[email protected]",    "toAccount":"[email protected]"}'https://api-cloud.bitmart.com/account/sub-account/main/v1/sub-to-sub
    FieldTypeRequired?Description
    requestNoStringYesUUID,unique identifier, max length 64
    amountStringYesTransfer amount
    currencyStringYesCurrency
    fromAccountStringYesTransfer out Sub-Account username
    toAccountStringYesTransfer to Sub-Account username

    Response Data

    Response

    {"code":1000,"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1","message":"OK","data":{}}

    If code value is 1000,it means the transfer is successful.

    Get Sub-Account Transfer History (For Main Account) (KEYED)

    Query Sub-Account Spot Asset Transfer History (For Main Account)

    Request URL

    GET https://api-cloud.bitmart.com/account/sub-account/main/v1/transfer-list

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'https://api-cloud.bitmart.com/account/sub-account/main/v1/transfer-list?moveType=spot to spot
    FieldTypeRequired?Description
    moveTypeStringYestype
    -spot to spot=Spot wallet transfer to spot wallet
    accountNameStringNoSub-Account username (default: all sub-accounts will be queried)
    NIntYesRecent N records, allowed range[1,100]

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"282fd16e-73ee-464f-adb7-7241345929f6","data":{"total":2,"historyList":[{"fromAccount":"[email protected]","fromWalletType":"spot","toAccount":"[email protected]","toWalletType":"spot","currency":"BTC","amount":"1","submissionTime":1648471522},{"fromAccount":"[email protected]","fromWalletType":"spot","toAccount":"[email protected]","toWalletType":"spot","currency":"BTC","amount":"30","submissionTime":1648466178}]}}
    FieldTypeDescription
    fromAccountStringTransfer out Sub-Account username
    fromWalletTypeStringTransfer out wallet type
    -spot=spot wallet
    toAccountStringTransfer to Sub-Account username
    toWalletTypeStringTransfer to wallet type
    -spot=spot wallet
    currencyStringcurrency
    amountStringTransfer amount
    submissionTimeLongThe request timestamp is accurate to seconds(UTC-0)
    Note: Only the data for the last 3 months can be queried

    Get Account Spot Asset Transfer History (For Main/Sub Account) (KEYED)

    Get account spot asset transfer history (For Main/Sub Account)

    Request URL

    GET https://api-cloud.bitmart.com/account/sub-account/v1/transfer-history

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'https://api-cloud.bitmart.com/account/sub-account/v1/transfer-history?moveType=spot to spot
    FieldTypeRequired?Description
    moveTypeStringYestype
    -spot to spot=Spot wallet transfer to spot wallet
    NIntYesRecent N records, allowed range[1,100]

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"282fd16e-73ee-464f-adb7-7241345929f6","data":{"total":2,"historyList":[{"fromAccount":"[email protected]","fromWalletType":"spot","toAccount":"[email protected]","toWalletType":"spot","currency":"BTC","amount":"1","submissionTime":1648471522},{"fromAccount":"[email protected]","fromWalletType":"spot","toAccount":"[email protected]","toWalletType":"spot","currency":"BTC","amount":"30","submissionTime":1648466178}]}}
    FieldTypeDescription
    fromAccountStringTransfer out Sub-Account username
    fromWalletTypeStringTransfer out wallet type
    -spot=spot wallet
    toAccountStringTransfer to Sub-Account username
    toWalletTypeStringTransfer to wallet type
    -spot=spot wallet
    currencyStringcurrency
    amountStringTransfer amount
    submissionTimeLongThe request timestamp is accurate to seconds(UTC-0)
    Note: Only the data for the last 3 months can be queried

    Get Sub-Account Spot Wallet Balance (For Main Account) (KEYED)

    Get Sub-Account spot wallet balance (For Main Account)

    Request URL

    GET https://api-cloud.bitmart.com/account/sub-account/main/v1/wallet

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'https://api-cloud.bitmart.com/account/sub-account/main/v1/wallet?subAccount=[email protected]
    FieldTypeRequired?Description
    subAccountStringYesSub-Account username
    currencyStringNocurrency

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"ef834248-51d3-4223-9481-f862aa9dd39f","data":{"wallet":[{"currency":"USDT","name":"Tether USD","available":"1000.00000000","frozen":"0.00000000"},{"currency":"BTC","name":"Bitcoin","available":"10000.00000000","frozen":"10.00000000"}]}}
    FieldTypeDescription
    currencyStringToken symbol, e.g., 'BTC'
    nameStringToken name, e.g., 'Bitcoin'
    availableStringAvailable Balance
    frozenStringFrozen Balance
    The return list contains only assets with a balance greater than 0.

    Get Sub-Account List (For Main Account) (KEYED)

    Get Sub-Account list (For Main Account)

    Request URL

    GET https://api-cloud.bitmart.com/account/sub-account/main/v1/subaccount-list

    Request Limit

    SeeDetailed Rate Limit

    Request Parameter

    Request

    curl-H'X-BM-KEY:{{AccessKey}}'https://api-cloud.bitmart.com/account/sub-account/main/v1/subaccount-list

    Response Data

    Response

    {"message":"OK","code":1000,"trace":"c03c22c3-75db-4aaa-9500-6dcd63dd9ccf","data":{"subAccountList":[{"accountName":"[email protected]","status":1},{"accountName":"[email protected]","status":1}]}}
    FieldTypeDescription
    accountNameStringSub-Account username
    statusIntAccount Status
    -0=disabled in background
    -1=normal
    -2=frozen by main account

    WebSocket Subscription

    Overview

    Server URL

    Public Channel:wss://ws-manager-compress.bitmart.com/api?protocol=1.1

    Private Channel:wss://ws-manager-compress.bitmart.com/user?protocol=1.1

    Format

    The message format sent by the client to the BitMart server.

    {"op":"<operation>", "args":["<topic1>","<topic2>"]}

    Explain:

    Example:


    Successful Response Format

    The format of the success message returned by the BitMart server to the client.

    The returned field not containserrorCode

    Successful Response Format

    Whenop=login:{"event":"<operation>"}Whenop=unsubscribe:{"event":"<operation>","topic":"<topic>"}Whenop=subscribe:{"table":"<topic1>","data":"[{"<value1>","<value2>"}]"}{"table":"<topic2>","data":"[{"<value1>","<value2>"}]"}

    Example:


    Failed Response Format

    The format of the failed message returned by the BitMart server to the client.

    If the returned field containserrorCode, it means failure. For the reason of failure, please refer to:WebSocket Error Code

    Failed Response Format

    {"event":"<operation>","errorMessage":"<error_message>","errorCode":"<error_code>"}

    Stay Connected And Limit

    * If there is a network problem, the connection will be automatically disconnected, please set up the reconnection mechanism

    How Stay Connected

    WebSocket uses the Ping/Pong mechanism to maintain the connection. Once the connection is opened, a text 'ping' is sent every N seconds, and the remote endpoint will return a text 'pong' to keep responding. This is an approach to stay active. It helps to keep the connection open, especially if there is a short timeout proxy on an inactive connection.

    If no data is returned after connecting to WebSocket, the link will be automatically disconnected after 20s. It is recommended that the user do the following:

    1. After each message is received, the user sets a timer for N seconds (N<20).
    2. If the timer is triggered (no new message is received within N seconds), send a text string 'ping'.(Ping frames are not supported)
    3. Expect for a text string 'pong' as a response. If not received within N seconds, please issue an error or reconnect.
    4. We do not actively disconnect when there is a continuous message interaction between the two parties.

    The following is the data format of ping: (Example in Java pseudocode)

    • Ping Text

    ws.send(new TextWebSocketFrame("ping");

    Connection Limit(Public Channel)

    • Each IP can maintain up to 20 connections with the BitMart public channel server
    • Once connected, allows clients to subscribe to up to 115 channels per connection.
    • Send message rate limit:
      1. Initiate connection: Clients can initiate a maximum of 30 requests to connect to the BitMart server within 1 minute.
      2. Once connected: Clients can sending a maximum of 100 subscription messages within 10 seconds, message includes: PING text, JSON format messages (subscription and unsubscription).
      3. Once connected: A maximum of 20 messages arrays can be sent by clients for a single subscription.
    • If the user sends more messages than the limit, the connection will be disconnected. IPs that are repeatedly disconnected will be blocked by the server.

    Connection Limit(Private Channel)

    • Each IP can maintain up to 10 connections with the BitMart private channel server.
    • Once connected, allows clients to subscribe to up to 100 channels per connection.
    • Send message rate limit:
      1. Initiate connection: Clients can initiate a maximum of 30 requests to connect to the BitMart server within 1 minute.
      2. Once connected: Clients can sending a maximum of 100 subscription messages within 10 seconds, message includes: PING text, JSON format messages (subscription and unsubscription).
      3. Once connected: A maximum of 20 messages arrays can be sent by clients for a single subscription.
    • If the user sends more messages than the limit, the connection will be disconnected. IPs that are repeatedly disconnected will be blocked by the server.

    How to subscribe to more than 1000 Public channels?

    Create 20 connectors and 1 receiving function in your code, and each connector subscribes to 100 channels, so that you can easily subscribe to 2000 channels.

    Need to pay attention to?
    • Subscribe to fewer channels and respond faster. It is recommended that you only subscribe to the channels you want
    • If the number of messages sent exceeds the limit, the connection will be disconnected. IPs that are repeatedly disconnected will be blocked by the server
    • The connection limits for private channels and public channels are calculated separately, which means that a single IP is allowed to maintain 10 private channel connections and 20 public channel connections at the same time

    Lifeless connection

    Connection that do not send task subscription data within 5 minutes will be considered lifeless and the server will close the connection.

    Data Compression

    Only when the market data is returned after subscription, the remote service will compress the data and return it to the client. The remote service returns data in two formats, Binary format and Text format. When the binary format is returned, the data has been compressed by the remote service and the client needs to decompress it.

    Compression Introduction

    zlib is a library for data compression, developed by Jean-loup Gailly and Mark Adler. The first version (v0.9) was published on May 1, 1995. zlib uses the abstract DEFLATE algorithm, originally written for the libpng library, and later generally used by many software. This library is free.Official link http://zlib.net/

    Decompression Example

    For more and more complete programming codes, please refer to theQuick Start API

    Python

    importzlibdefinflate(data):decompress=zlib.decompressobj(-zlib.MAX_WBITS)inflated=decompress.decompress(data)inflated+=decompress.flush()returninflated.decode('UTF-8')

    Nodejs

    constzlib=require('zlib');zlib.inflateRawSync(data);

    Golang

    import("compress/flate")funczipDecode(in[]byte)([]byte,error){reader:=flate.NewReader(bytes.NewReader(in))deferreader.Close()returnioutil.ReadAll(reader)}string(zipDecode(data))

    php

    @link https://php.net/manual/en/function.gzinflate.phpgzinflate($data)

    Java

    importjava.util.zip.*;publicclassStringCompressUtil{privatestaticStringuncompress(ByteBufbuf){try{byte[]temp=newbyte[buf.readableBytes()];ByteBufInputStreambis=newByteBufInputStream(buf);bis.read(temp);bis.close();Inflaterdecompresser=newInflater(true);decompresser.setInput(temp,0,temp.length);StringBuildersb=newStringBuilder();byte[]result=newbyte[1024];while(!decompresser.finished()){intresultLength=decompresser.inflate(result);sb.append(newString(result,0,resultLength,"UTF-8"));}decompresser.end();returnsb.toString();}catch(Exceptione){e.printStackTrace();}return"";}publicstaticStringdecode(ByteBufcontent){byte[]bytes=newbyte[content.readableBytes()];content.readBytes(bytes);ByteBufbyteBuf=Unpooled.wrappedBuffer(bytes);Stringstr=uncompress(byteBuf);returnstr;}}StringCompressUtil.decode(data)

    Subscribe

    Users can subscribe to one or more channels, and the total length of multiple channels cannot exceed 4096 bytes

    subscribe

    {"op":"subscribe","args":["<topic>"]}

    Parameter Instructions

    Example

    Subscribe Request

    {"op":"subscribe","args":["spot/ticker:BTC_USDT"]}

    Subscription successful

    {"event":"subscribe","topic":"spot/ticker:BTC_USDT"}

    After successful subscription, push data

    {"table":"spot/ticker:BTC_USDT","data":[]}

    Unsubscribe

    Cancel subscription to one or more channels

    unsubscribe

    {"op":"unsubscribe","args":["<topic>"]}

    Parameter Instruction

    Example

    Unsubscribe Request

    {"op":"unsubscribe","args":["spot/ticker:BTC_USDT","spot/ticker:ETH_USDT"]}

    Unsubscribe successful

    {"event":"unsubscribe","topic":"spot/ticker:BTC_USDT"}{"event":"unsubscribe","topic":"spot/ticker:ETH_USDT"}

    【Public】Ticker Channel

    Get the latest price, bid price, ask price and 24-hour trading volume

    Pushing Rules

    1. No user login required
    2. After subscribing, the current data will be returned directly, and the latest price, bid price, ask price will be pushed only after they change.
    3. Push frequency: The fastest is 500ms once

    Subscribe Request

    Subscribe Request

    {"op":"subscribe","args":["spot/ticker:BTC_USDT"]}

    Message Format:

    {"op": "subscribe", "args": ["spot/ticker:<symbol>"]}

    Subscription successful

    Subscription successful

    {"event":"subscribe","topic":"spot/ticker:BTC_USDT"}

    {"event":"subscribe","topic":"spot/ticker:<symbol>"}

    After successful subscription, push data

    Push data

    {"data":[{"ask_px":"36000","ask_sz":"1.021","base_volume_24h":"2.02000","bid_px":"35000","bid_sz":"11","fluctuation":"-0.0001","high_24h":"35003.04","last_price":"35000.00","low_24h":"35000.00","ms_t":1709024652967,"open_24h":"35003.03","quote_volume_24h":"70700.00","s_t":1709024652,"symbol":"BTC_USDT"}],"table":"spot/ticker"}

    Return data description:

    FieldTypeDescription
    symbolStringTrading pair,BTC_USDT
    last_priceStringLast trading price
    high_24hString24-hour highest price
    low_24hString24-hour lowest price
    open_24hString24-hour open price
    base_volume_24hString24-hour traded volume in base currency
    quote_volume_24hString24-hour traded volume in quote currency
    s_tLongCreate Time (timestamp in seconds) (The field will be removed, please use the ms_t field)
    ms_tLongData push Timestamp (timestamp in millisecond)
    fluctuationString24-hour Price change
    bid_pxStringBest bid price
    bid_szStringBest bid quantity
    ask_pxStringBest ask price
    ask_szStringBest bid quantity

    【Public】KLine Channel

    Get the spot K-line data

    Pushing Rules

    1. No user login required
    2. After subscribing, the current data will be returned directly, and then the changes will be pushed
    3. Push frequency: The fastest is 500ms once

    Subscribe Request

    Subscribe Request

    {"op":"subscribe","args":["spot/kline1m:BTC_USDT"]}

    Message Format:

    {"op": "subscribe", "args": ["<channel>:<symbol>"]}

    Parameters Channel Name List

    Channel NameDescription
    spot/kline1m1-min KLine Channel
    spot/kline5m5-min KLine Channel
    spot/kline15m15-min KLine Channel
    spot/kline30m30-min KLine Channel
    spot/kline1H1-hour KLine Channel
    spot/kline2H2-hour KLine Channel
    spot/kline4H4-hour KLine Channel
    spot/kline1D1-day KLine Channel
    spot/kline1W1-week KLine Channel
    spot/kline1M1-month KLine Channel

    Subscription successful

    Subscription successful

    {"topic":"spot/kline1m:BTC_USDT","event":"subscribe"}

    {"event":"subscribe","topic":"<channel>:<symbol>"}

    After successful subscription, push data

    Push data

    {"data":[{"candle":[1709025360,"162.01","162.02","162.03","162.04","336.452694"],"symbol":"BTC_USDT"}],"table":"spot/kline1m"}

    Return data description:

    FieldTypeDescription
    symbolStringTrading pair,BTC_USDT
    candleListKLine data
    An example of returned KLine values: [1709025360, "162.01", "162.02", "162.03", "162.04", "336.452694"]. Open time (in seconds), opening price, highest price, lowest price, closing price, trading volume.

    【Public】Depth-All Channel

    Return depth data, each push is the full data

    Pushing Rules

    1. No user login required
    2. After subscribing, the current data will be returned directly, and then the changes will be pushed
    3. Push frequency: The fastest is 500ms once

    Subscribe Request

    Subscribe Request

    {"op":"subscribe","args":["spot/depth5:BTC_USDT"]}

    Message Format:

    {"op": "subscribe", "args": ["<channel>:<symbol>"]}

    • channel: Channel name, such asspot/depth5
    • symbol: Trading pair, such asBTC_USDT

    Parameters Channel Name List

    Channel NameDescription
    spot/depth55 Level Depth Channel
    spot/depth2020 Level Depth Channel
    spot/depth5050 Level Depth Channel

    Subscription successful

    Subscription successful

    {"topic":"spot/depth5:BTC_USDT","event":"subscribe"}

    {"event":"subscribe","topic":"<channel>:<symbol>"}

    After successful subscription, push data

    Push data

    {"table":"spot/depth5","data":[{"asks":[["161.96","7.37567"]],"bids":[["161.94","4.552355"]],"symbol":"ETH_USDT","ms_t":1542337219120}]}

    Return data description:

    FieldTypeDescription
    symbolStringTrading pair,BTC_USDT
    asksListAsk depth
    bidsListBid depth
    ms_tLongData push Timestamp (Timestamp in millisecond)
    An example of the array of asks and bids values: ["161.96","7.37567"], 161.96 is the price, and 7.37567 is the quantity.

    【Public】Depth-Increase Channel

    Return depth data, support the creation of a local full depth cache data

    Pushing Rules

    1. No user login required
    2. After subscribing, the current data will be returned directly, and then the changes will be pushed
    3. Push frequency: The fastest is 100ms once

    Subscribe Request

    Subscribe Request

    {"op":"subscribe","args":["spot/depth/increase100:BTC_USDT"]}

    Full depth snapshot data Request

    {"op":"request","args":["spot/depth/increase100:BTC_USDT"]}

    Message Format:

    {"op": "<op>", "args": ["spot/depth/increase100:<symbol>"]}

    • op:subscribe=Subscribe, You will receive a message that the subscription is successful, and then you will receive incremental depth data pushed in real time.request=Single request for the latest depth snapshot, You will receive a full depth of data immediately.
    • channel: Channel name, fixed valuespot/depth/increase100, Support 100 levels
    • symbol: Trading pair, such asBTC_USDT

    Subscription successful

    Subscription successful

    {"topic":"spot/depth/increase100:BTC_USDT","event":"subscribe"}

    {"event":"subscribe","topic":"spot/depth/increase100:<symbol>"}

    Response

    Full depth snapshot data

    {"data":[{"asks":[["23200","0.69959"],["28000.00","0.20000"]],"bids":[["23105","1.80114"]],"ms_t":1698292343610,"symbol":"BTC_USDT","type":"snapshot","version":4}],"table":"spot/depth/increase100"}

    Incremental depth data

    {"data":[{"asks":[["23200","0.59959"]],"bids":[],"ms_t":1698292358292,"symbol":"BTC_USDT","type":"update","version":5}],"table":"spot/depth/increase100"}

    Return data description:

    FieldTypeDescription
    symbolStringTrading pair,BTC_USDT
    asksListAsk depth
    bidsListBid depth
    ms_tLongData push Timestamp (Timestamp in millisecond)
    versionLongdata version
    typeStringdata type
    -snapshot=Full depth snapshot data
    -update=Incremental depth data
    An example of the array of asks and bids values: ["411.8","10"]. 411.8 is the price, and 10 is the quantity.

    How to correctly maintain a copy of OrderBook locally:

    1. First, the client send a subscription request{"op": "subscribe", "args": ["spot/depth/increase100:<symbol>"] }
    2. After successful subscription, you will receive two types of messages,type=snapshot (full data) andtype=update (update)
    3. If a type=snapshot type message is received, update the deep snapshot content to thelocal cache. If there is nolocal cache, create one.
    4. If a type=update message is received, update the data in the deep snapshot tolocal cache. The update rules are as follows:
      • 4.1 If the field version number in the received new message is less than or equal to the version in the local cache(new version<=local version), this data can be discarded.
      • 4.2 If the field version number in the new message received is equal to the version in the local cache plus 1(new version==local version+1), the quantity of the corresponding price will beupdated to the local cache.
      • 4.3 If the field version number in the new message received is greater than the version in the local cache plus 1(new version>local version+1), please obtain the latest depth snapshot from step 7 and overwrite thelocal cache.
    5. The pending order volume in each returned message represents theabsolute value of the current pending order volume at this price, rather than the relative change.
    6. How to update local cache? Under the premise of 4.2:
      • 6.1 New: If the same price is not already in the local cache, it means that it is a new pending order and needs to be added to the cache.
      • 6.2 Modify or Remove: If the same price is already in the local cache, it means that the quantity has changed. If the quantity is 0, it will be directly removed from the cache. Otherwise, just change the quantity.
    7. Request through request{"op": "request", "args": ["spot/depth/increase100:<symbol>"] }to obtain the latest depth snapshot (type=snapshot in the message), and add the depth The content in the snapshot is overwritten to thelocal cache, and then the logic continues from step 2.
    • Abnormal Situation:
      1. If there is no deep update for a period of time, an empty message 'asks': [], 'bids': [] will be sent to notify the user that the connection is normal. The pushed version is the same as the previous message. The empty message version=local cache version. can be discarded directly
      2. Because the depth snapshot has a limit on the number of price tiers, price tiers outside the initial snapshot and without quantity changes will not appear in the incremental depth update information. Therefore, even if all updates from the incremental depth are applied, these price brackets will not be visible in the local order book, so there may be some differences between the local order book and the real order book.

    Flow Chart

    PNG

    【Public】Trade Channel

    Get the latest real-time transaction data

    Pushing Rules

    1. No user login required
    2. After successful subscription, incremental trade messages will be pushed(Taker trade message)
    3. Push frequency: Push when changes

    Subscribe Request

    Subscribe Request

    {"op":"subscribe","args":["spot/trade:BTC_USDT"]}

    Message Format:

    {"op": "subscribe", "args": ["spot/trade:<symbol>"]}

    • symbol: Trading pair, such asBTC_USDT

    Subscription successful

    Subscription successful

    {"event":"subscribe","topic":"spot/trade:BTC_USDT"}

    {"event":"subscribe","topic":"spot/trade:<symbol>"}

    After successful subscription, push data

    Push data

    {"table":"spot/trade","data":[{"symbol":"ETH_USDT","price":"162.12","side":"buy","size":"11.085","s_t":1542337219,"ms_t":1542337219120}]}

    Return data description:

    FieldTypeDescription
    symbolStringTrading pair,BTC_USDT
    sideStringSide of trade for taker order(buy orsell
    priceStringTrade price for taker order
    sizeStringTrade quantity for taker order
    s_tLongOrder execution time (Timestamp in seconds) (The field will be removed, please use the ms_t field)
    ms_tLongOrder execution time (Timestamp in millisecond)

    【Private】Login

    Login Subscription Format

    Request Format

    {"op":"login","args":["<YOUR_API_KEY>","<timestamp>","<sign>"]}
    • API_KEY: The user's API key
    • timestamp: Timestamp, the unit is milliseconds, it will expire after 60 seconds
    • sign: Signature, sign=CryptoJS.HmacSHA256(timestamp + "#" + api_memo + "#" + "bitmart.WebSocket", secret)

    Example

    Login Example

    {"op":"login","args":["80618e45710812162b04892c7ee5ead4a3cc3e56","1589267764859","3ceeb7e1b8cb165a975e28a2e2dfaca4d30b358873c0351c1a071d8c83314556"]}

    Response

    {"event":"login"}

    Assume that the values of the API requested by the user is as follows:

    • timestamp=1589267764859
    • API_KEY = "80618e45710812162b04892c7ee5ead4a3cc3e56"
    • API_SECRET = "6c6c98544461bbe71db2bca4c6d7fd0021e0ba9efc215f9c6ad41852df9d9df9"
    • API_MEMO = "test001";

    Ues Javascript create paramsign:sign =CryptoJS.HmacSHA256(1589267764859 + "#" + test001 + "#" + "bitmart.WebSocket", '6c6c98544461bbe71db2bca4c6d7fd0021e0ba9efc215f9c6ad41852df9d9df9') = 3ceeb7e1b8cb165a975e28a2e2dfaca4d30b358873c0351c1a071d8c83314556

    Ues Shell create paramsign:sign =echo -n '1589267764859#test001#bitmart.WebSocket' | openssl dgst -sha256 -hmac "6c6c98544461bbe71db2bca4c6d7fd0021e0ba9efc215f9c6ad41852df9d9df9" (stdin)= 3ceeb7e1b8cb165a975e28a2e2dfaca4d30b358873c0351c1a071d8c83314556

    The final login parameters are:

    {"op": "login", "args": ["80618e45710812162b04892c7ee5ead4a3cc3e56", "1589267764859", "3ceeb7e1b8cb165a975e28a2e2dfaca4d30b358873c0351c1a071d8c83314556"]}

    Note

    1. If return data does not contain the error_code field, it indicates success
    2. If the login fails, the link will be automatically disconnected

    【Private】Order Progress

    Subscribe to the order execution progress of a single trading pair, or you can subscribe to the order execution progress of all trading pairs at once.

    Pushing Rules

    1. User login required
    2. Qualified orders will be pushed (Successfully placed an order, Partially filled, Fully filled, Canceled)
    3. Push frequency: Push when changes

    Subscribe Request

    Order transaction progress subscription request for a single trading pair

    {"op":"subscribe","args":["spot/user/order:BTC_USDT"]}

    Order transaction progress subscription request for all trading pairs

    {"op":"subscribe","args":["spot/user/orders:ALL_SYMBOLS"]}

    Message Format:

    1.The order transaction progress subscription of a single trading pair:

    {"op": "subscribe", "args": ["spot/user/order:<symbol>"]}

    • channel: Channel name, such asspot/user/order
    • symbol: Trading pair, such asBTC_USDT

    2.The order transaction progress of all trading pairs:

    • channel: Channel name, such asspot/user/orders
    • symbol: All Trading pair, fixed value:ALL_SYMBOLS

    Note: The channel names subscribed to for a single trading pair and all trading pairs are different

    Subscription successful

    Single trading pair subscription successful

    {"event":"subscribe","topic":"spot/user/order:BTC_USDT"}

    1.The order transaction progress subscription of a single trading pair was successfully subscribed.

    {"event":"subscribe","topic":"spot/user/order:<symbol>"}

    All trading pairs subscription successful

    {"event":"subscribe","topic":"spot/user/orders:ALL_SYMBOLS"}

    2.The order transaction progress of all trading pairs has been successfully subscribed.

    {"event":"subscribe","topic":"spot/user/orders:ALL_SYMBOLS"}

    After successful subscription, push data

    Push data

    {"data":[{"symbol":"BTC_USDT","side":"buy","type":"market","notional":"","size":"1.0000000000","ms_t":"1609926028000","price":"46100.0000000000","filled_notional":"46100.0000000000","filled_size":"1.0000000000","margin_trading":"0","state":"4","order_id":"2147857398","order_type":"0","last_fill_time":"1609926039226","last_fill_price":"46100.00000","last_fill_count":"1.00000","exec_type":"M","detail_id":"256348632","client_order_id":"order4872191","create_time":"1609926028000","update_time":"1609926044000","order_mode":"0","entrust_type":"normal","order_state":"partially_filled","dealFee":"10.00","deal_fee_coin_name":"BMX"}],"table":"spot/user/order"}

    Return data description:

    FieldTypeDescription
    symbolstringTrading pair,BTC_USDT
    order_idstringOrder ID
    pricestringOrder price
    sizestringOrder quantity
    notionalstringThe purchase amount, returned when buying at market price; otherwise, an empty string is returned
    sidestringSide
    -buy
    -sell
    typestringType
    -limit
    -market
    ms_tstringOrder Create Timestamp (in milliseconds)
    filled_sizestringFilled size (Base currency)
    filled_notionalstringFilled notional amount (Quote currency)
    margin_tradingstring0:Spot order (The field will be removed, please use the order_mode field)
    order_typestringOrder type (The field will be removed, please use the entrust_type field)
    -0=Regular
    -1=Maker only(Post only)
    -2=Fill or kill(FOK)
    -3=Immediate or Cancel(IOC)
    statestringOrder state (The field will be removed, please use the order_state field)
    -4=Order success, Pending for fulfilment
    -5=Partially filled
    -6=Fully filled
    -8=Canceled
    -12=Canceled after Partially filled
    last_fill_pricestringLatest trade price(0 if not filled)
    last_fill_countstringLatest trade quantity(0 if not filled)
    last_fill_timestringLatest trade time(0 if not filled) millisecond
    exec_typestringWhether the trade was created by a maker or a taker.
    -M=Maker
    -T=Taker
    detail_idstringTrade id
    client_order_idstringClient-defined OrderId
    create_timeStringOrder Create Timestamp (in milliseconds)
    update_timeStringOrder Update Timestamp (in milliseconds)
    order_modeStringOrder mode
    -spot=spot
    -iso_margin=margin
    entrust_typeStringOrder Type
    -NORMAL=Normal trade order(Limit Order or Market Order)
    -LIMIT_MAKER=PostOnly Order
    -IOC=IOC Order
    order_stateStringOrder State
    -new=The order has been accepted by the engine.
    -partially_filled=A part of the order has been filled.
    -filled=The order has been completed.
    -canceled=The order has been canceled by the user.
    -partially_canceled=A part of the order has been filled , and the order has been canceled.
    dealFeeStringFee
    deal_fee_coin_nameStringFee coin name

    Notice:This data is displayed after decompression,Refer to Data Compression for details

    【Private】Balance Change

    Balance change push

    Pushing Rules

    1. User login required
    2. Qualified balance changes (recharge, withdrawal, transfer, transaction, BMX handling fee deduction)
    3. Push frequency: Push when changes

    Subscribe Request

    Subscribe Request

    {"op":"subscribe","args":["spot/user/balance:BALANCE_UPDATE"]}

    Message Format:

    {"op": "subscribe", "args": ["spot/user/balance:BALANCE_UPDATE"]}

    Subscription successful

    Subscription successful

    {"event":"subscribe","topic":"spot/user/balance:BALANCE_UPDATE"}

    {"event": "subscribe","topic": "spot/user/balance:BALANCE_UPDATE"}

    After successful subscription, push data

    Push data

    {"data":[{"event_type":"TRANSACTION_COMPLETED  ","event_time":"1693364237000","balance_details":[{"ccy":"BTC","av_bal":"123.22","fz_bal":"12.56"}]}],"table":"spot/user/balance"}

    Return data description:

    FieldTypeDescription
    event_typestringType for change
    -TRANSACTION_COMPLETED=Trade
    -ACCOUNT_RECHARGE=Recharge
    -ACCOUNT_WITHDRAWAL=Withdraw
    -ACCOUNT_TRANSFER=Transfer
    -BMX_DEDUCTION=BMX handling fee deduction
    event_timestringCreate time
    balance_detailsstringDetail
    >ccystringChanging Balance Currency
    >av_balstringAvailable balance after change
    >fz_balstringFreeze balance after change

    Notice:This data is displayed after decompression,Refer to Data Compression for details

    Error Code

    Restful Error Code

    List of global HTTP return codes

    HTTPDescription
    404Not Found-The requested interface could not be found
    403Forbidden-No permission to access the resource (KEY may not have permission, or it may be IP restrictions)
    401Unauthorized-Authentication failed (there are problems with the 3 header parameters, failed)
    500Internal Server Error-Server exception, BitMart service problem

    Authentication Error Code

    Example: httpStatus:200, body:{"code": 1000, "message": "OK", "trace": "12323-3243242-34334534-4353","data":{}}

    error messagecode error codehttp status code
    Not found30000404
    Header X-BM-KEY is empty30001401
    Header X-BM-KEY not found30002401
    Header X-BM-KEY has frozen30003401
    Header X-BM-SIGN is empty30004401
    Header X-BM-SIGN is wrong30005401
    Header X-BM-TIMESTAMP is empty30006401
    Header X-BM-TIMESTAMP must be long type30006401
    Header X-BM-TIMESTAMP range. Within a minute30007401
    Header X-BM-TIMESTAMP range. Timestamp for this request is outside of the recvWindow.30007401
    Param recvWindow must be long type30007401
    Param recvWindow must be less than 60000 and greater than 030007401
    Header X-BM-TIMESTAMP invalid format30008401
    IP is forbidden. We recommend enabling IP whitelist for API trading. After that reauth your account30010403
    Header X-BM-KEY over expire time30011403
    Header X-BM-KEY is forbidden to request it30012403
    Request too many requests30013429
    Service unavailable30014503
    Service maintenance, the function is temporarily unavailable30016200
    Your account request is temporarily rejected due to violation of current limiting rules, please contact customer service30017418
    Request Body requires JSON format30018503
    You do not have the permissions to perform this operation. Please contact customer service or BD for assistance30019200
    Futures V1 API has been deprecated. Please use Futures V2 API. You can view the change logs for upgrade30030200
    This endpoint has been deprecated. You can view the change logs for upgrade30031200

    Funding Account&Sub-Account API Error Code

    Example: httpStatus:200, body:{"code": 1000,"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1","message": "OK","data": {}}

    error messagecode error codehttp status code
    OK1000200
    Invalid request (maybe the body is empty, or the int parameter passes string data)60000400
    Asset account type does not exist60001400
    currency does not exist60002400
    Currency has been closed recharge channel, if there is any problem, please consult customer service60003400
    Currency has been closed withdraw channel, if there is any problem, please consult customer service60004400
    Minimum amount is %s60005400
    Maximum withdraw precision is %d60006400
    Only withdrawals from added addresses are allowed60007400
    Balance not enough60008400
    Beyond the limit60009400
    Withdraw id or deposit id not found60010400
    Address is not valid60011400
    This action is not supported in this currency(If IOTA, HLX recharge and withdraw calls are prohibited)60012400
    The withdrawal amount must be an integral multiple of %s60013400
    Please check your memo60014400
    This address is not verified. Please add and verify this address on the client60015400
    Your account is not allowed to recharge60020403
    Your account is not allowed to withdraw60021403
    No withdrawals for 24 hours60022403
    Sub-account does not have permission to operate60026403
    Only supports sub-account calls60027403
    Account status is unavailable60028403
    The account is frozen by the master account, please contact the master account to unfreeze the account60029403
    Method Not Allowed60030405
    Unsupported Media Type60031415
    User account not found60050500
    Internal Server Error60051500
    Exception60052400
    please check The Email/PhoneNumber/BitMart ID And try again60053403
    Sub-account does not support withdraw60054403
    This currency is not support60055403
    This currency withdrawal is suspended60056403
    User status is not available60057403
    Monitor that the withdrawal will cause the overall spot wallet to fall below the Margin call risk rate. Please revise the withdrawal amount as appropriate60058403
    internal Withdraw forbidden60059403
    Invalid request60060403
    Unsupported operation60061403
    Forbidden60062403
    Account is frozen due to security policies. Please contact customer service60063403
    Exceed daily withdrawal quota, for your safety, please wait 24 hours and try again60064403
    The withdrawal user and the target user cannot be the same60065403
    Please notice the default startTime and endTime to make sure that time interval is within 0-90 days60066400
    If both startTime and endTimeare sent, time between startTimeand endTimemust be less than 90 days.60067400
    Parameter Error60000400
    Amount must be greater than 061000400
    Insufficient balance61001400
    ToAccount not found61002400
    The specified sub-account could not be found61003400
    Duplicate requests (such as using an existing requestNo)61004400
    Asset transfer between accounts is not available61005403
    The sub-account api only supports organization accounts61006403
    Please complete your institution verification to enable withdrawal function.61007403
    Suspend transfer out61008403

    Spot Public Mark API Error Code

    error messagecode error codehttp status code
    OK1000200
    no data70000200
    request param can not be null70001200
    symbol is invalid70002200
    after is invalid71001200
    before is invalid71002200
    request after or before is invalid71003200
    request kline count limit71004200
    request step error71005200

    Spot&Margin API Error Code

    Example: httpStatus:200, body:{"code": 1000,"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1","message": "OK","data": {}}

    error messagecode error codehttp status code
    OK1000200
    Bad Request50000400
    Symbol not found50001400
    From Or To format error50002400
    Step format error50003400
    Kline size over 50050004400
    Order Id not found50005400
    Minimum size is %s50006400
    Maximum size is %s50007400
    Minimum price is %s50008400
    Minimum count*price is %s50009400
    RequestParam size is required50010400
    RequestParam price is required50011400
    RequestParam notional is required50012400
    Maximum limit*offset is %d50013400
    RequestParam limit is required50014400
    Minimum limit is 150015400
    Maximum limit is %d50016400
    RequestParam offset is required50017400
    Minimum offset is 150018400
    Invalid status. validate status is [1=Failed, 2=Success, 3=Frozen Failed, 4=Frozen Success, 5=Partially Filled, 6=Fully Fulled, 7=Canceling, 8=Canceled50019400
    Balance not enough50020400
    Invalid %s50021400
    Service unavailable50022400
    This Symbol can't place order by api50023400
    Order book size over 20050024400
    Maximum price is %s50025400
    The buy order price cannot be higher than the open price50026400
    The sell order price cannot be lower than the open price50027400
    Missing parameters50028400
    The parameters do not match50029400
    Order is already canceled50030400
    Order is already completed50031400
    The order was matched or cancelled50032400
    The order quantity should be greater than 0 and less than or equal to 1050033400
    The price is high and there is no matching depth50034400
    The price is low and there is no matching depth50035400
    Cancel failed, order is not revocable status50036400
    The maximum length of clientOrderId cannot exceed 3250037400
    ClientOrderId only allows a combination of numbers and letters50038400
    Order_id and clientOrderId cannot be empty at the same time50039400
    Symbol Not Available50040400
    Out of query time range50041400
    clientOrderId is duplicate50042400
    Currency not found51000400
    Margin Account not Opened51001400
    Margin Account Not Available51002400
    Account Limit51003400
    Exceed the maximum number of borrows available51004400
    Less than the minimum borrowable amount51005400
    Exceeds the amount to be repaid51006400
    order_mode not found51007400
    Operation is limited, please try again later51008400
    Parameter mismatch: limit order/market order quantity should be greater than the minimum number of should buy/sell51009400
    Parameter mismatch: limit order price should be greater than the minimum buy price51010400
    Parameter mismatch: Limit order quantity * price should be greater than the minimum transaction amount51011400
    Participation mismatch: the number of market order buy orders should be greater than the minimum buyable amount51012400
    Parameter mismatch: the price of market order buy order placed is too small51013400
    Parameter mismatch: the amount of market order sell orders placed is too small51014400
    Quantity is too small51015400
    There is no Margin Borrowing51024400
    Unsupported OrderMode Type52000400
    Unsupported Trade Type52001400
    Unsupported Side Type52002400
    Unsupported Query State Type52003400
    End time must be greater than or equal to Start time52004400
    Your account is frozen due to security policies. Please contact customer service53000403
    Your kyc country is restricted. Please contact customer service.53001403
    Your account has not yet completed the kyc advanced certification, please complete first53002403
    No permission, please contact the main account53003403
    This trading pair is not available to trade in your region53004403
    Don't have permission to access the interface53005403
    Please complete your personal verification(Starter)53006403
    Please complete your personal verification(Advanced)53007403
    Services is not available in your countries and areas53008403
    Your account has not yet completed the qr code certification, please complete first53009403
    This account is restricted from borrowing53010403
    Your account type is prohibited from using this feature53011403
    Method Not Allowed57001405
    Unsupported Media Type58001415
    User account not found59001400
    Internal Server Error59002500
    Spot wallet call fail59003500
    Margin wallet service call exception59004500
    Margin wallet service restricted59005500
    Transfer fail59006500
    Get symbol risk data fail59007500
    Trading order failure59008500
    Loan success,but trading order failure59009500
    Insufficient loan amount.59010500
    The Get Wallet Balance service call fail, please try again later59011500

    WebSocket Error Code

    Error Code Format

    {"event":"<operation>","errorMessage":"","errorCode":""}

    Error Code

    Error MessageError Code
    Invalid message format90001
    Invalid op param90002
    Invalid args param90003
    Invalid channel param90004
    Topic quantity in single subscription exceeds limit90005
    Subscribed total topic quantity exceeds limit90006
    Subscribed message frequency exceeds limit, please try later90007
    Duplicate subscription90008
    Invalid subscription90009
    API KEY is empty91001
    API KEY not found91002
    API KEY has frozen91003
    API KEY over expire time91004
    Already logged in91005
    User not logged in / User must be logged in91006
    Param sign is empty91010
    Param sign is wrong91011
    Param timestamp is empty91021
    Param timestamp range. Within a minute91022
    Param timestamp invalid format91023
    Invalid symbol param92001
    Frequently reestablishing connections in a short period of time94001
    The number of connections established between a single IP and the server exceeds the upper limit94002
    Internal system error95000

    Disclaimer

    For ease of reference, this statement collectively refers to our platform as "We." Any individual or entity accessing our platform is considered a user, hereafter referred to as "You." We would like to inform you of the following risks associated with using third-party SDKs (Software Development Kits):

    1. Your use of any third-party SDKs through our platform is entirely voluntary and at your discretion; we neither recommend nor endorse any third-party SDKs.
    2. We are not responsible for reviewing third-party SDKs and make no warranties or representations concerning the validity, accuracy, reliability, quality, stability, completeness, or timeliness of the technology and information provided by these services.
    3. You assume full responsibility for any risks associated with your use of third-party SDKs services.
    4. Any issues arising from the use of third-party SDKs, including but not limited to legal disputes, contractual obligations, or financial losses, must be resolved directly between you and the third-party provider. We disclaim any liability in such matters.

    By clicking "Next", you confirm that you have read and agree to all terms of this Disclaimer.

    免责声明

    为了本声明表述之方便,本平台在声明中合称使用“我们”。只要登录本平台的自然人或其他主体均为本平台的用户,以下使用“您”。我们在此特向您提醒第三方SDK(Software Development Kit)风险如下:

    1. 您通过本平台而使用任何第三方SDK的行为,均为您个人的自由选择行为,我们并不向您推荐或建议使用;
    2. 我们不对任何第三方SDK负有审核责任,也不对其服务所涉及的技术及信息的有效性、准确性、正确性、可靠性、质量、稳定性、完整性和及时性作出任何承诺和保证;
    3. 您自行承担使用第三方SDK服务产生的全部责任;
    4. 您因使用第三方SDK而涉及的包括但不限于法律问题、合同责任问题、经济损失问题等,均由您与第三方SDK自行解决,我们不对此承担责任。

    点击“下一步”即表示您已阅读并同意本免责声明的所有条款。


    [8]ページ先頭

    ©2009-2025 Movatter.jp