NAV
Example

Update Plan

Change Log

2026-04-14

REST API

Introduction

API Key Create

PNG

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

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

PNG

Read-Only Permissions:
API Name Authentication Type Description
/account/v1/wallet KEYED Query account assets
/account/v1/deposit/address KEYED Query deposit addresses for each currency
/account/v1/withdraw/address/list KEYED Query withdraw address list
/account/v2/deposit-withdraw/history KEYED Query deposit and withdrawal history
/account/v1/deposit-withdraw/detail KEYED Query deposit and withdrawal details
/spot/v1/wallet KEYED Query wallet balance for all currencies
/spot/v4/query/order SIGNED Query order by id (v4)
/spot/v4/query/client-order SIGNED Query order by client order id (v4)
/spot/v4/query/open-orders SIGNED Current open orders (v4)
/spot/v4/query/history-orders SIGNED Account orders (v4)
/spot/v4/query/trades SIGNED Account trade list (v4)
/spot/v4/query/order-trades SIGNED Order trade list(v4)
/spot/v4/query/algo/order SIGNED Query algo order by id (v4)
/spot/v4/query/algo/client-order SIGNED Query algo order by client order id (v4)
/spot/v4/query/algo/open-orders SIGNED Current algo open orders (v4)
/spot/v4/query/algo/history-orders SIGNED Account algo orders (v4)
/spot/v1/user_fee KEYED Query basic fee rate for current user
/spot/v1/trade_fee KEYED Query fee rate for a specific trading pair for current user
/spot/v1/margin/isolated/pairs KEYED Query loan interest rate and limit for a trading pair
/spot/v1/margin/isolated/account KEYED Query isolated margin account information
/spot/v1/margin/isolated/borrow_record KEYED Query isolated margin borrowing record
/spot/v1/margin/isolated/repay_record KEYED Query isolated margin repayment record
/contract/private/get-open-orders KEYED Query Contract All Open Orders
/contract/private/order KEYED Query contract order details
/contract/private/trade-fee-rate KEYED Query Trade Fee Rate
/contract/private/order-history KEYED Query contract order history
/contract/private/trades KEYED Query contract trade details
/contract/private/transaction-history KEYED Get Contract Transaction History
/contract/private/assets-detail KEYED Query contract asset details
/contract/private/position KEYED Query position details
/contract/private/position-v2 KEYED Query position details V2
/contract/private/current-plan-order KEYED Query Current Plan Orders
/contract/private/position-risk KEYED Query Position Risk Details
/contract/private/get-position-mode KEYED Get position mode
/newearn/cloud/v1/saving/product KEYED Get flexible savings product list
/newearn/cloud/v1/saving/earn KEYED Get earn positions
/newearn/cloud/v1/saving/record KEYED Get history records
Withdraw Permissions:
API Name Authentication Type Description
/account/v1/withdraw/charge KEYED Query withdrawal limits
/account/v1/withdraw/apply SIGNED Apply for withdrawal
Spot-Trade Permissions:
API Name Authentication Type Description
/spot/v1/submit_order SIGNED Place an order
/spot/v2/submit_order SIGNED Place an order
/spot/v1/batch_orders SIGNED Place multiple orders
/spot/v2/batch_orders SIGNED Place multiple orders
/spot/v4/batch_orders SIGNED Place multiple orders
/spot/v1/cancel_order SIGNED Cancel an unfinished order
/spot/v3/cancel_order SIGNED Cancel an unfinished order
/spot/v1/cancel_orders SIGNED Cancel multiple orders
/spot/v4/cancel_orders SIGNED Cancel multiple orders
/spot/v4/algo/submit_order SIGNED Place an algo order
/spot/v4/algo/cancel_order SIGNED Cancel an algo order
/spot/v4/algo/cancel_all SIGNED Cancel all algo orders
Margin-Trade Permissions:
API Name Authentication Type Description
/spot/v1/margin/submit_order SIGNED Margin order placement
/spot/v1/margin/isolated/transfer SIGNED Transfer funds between margin and spot accounts
/spot/v1/margin/isolated/borrow SIGNED Isolated margin borrowing
/spot/v1/margin/isolated/repay SIGNED Repay isolated margin debt
Future-Trade Permissions:
API Name Authentication Type Description
/contract/private/submit-order SIGNED Place an order for a futures contract
/contract/private/cancel-order SIGNED Cancel a single futures order
/contract/private/cancel-orders SIGNED Batch cancel futures orders
/contract/private/submit-plan-order SIGNED Place a plan order for futures contracts
/contract/private/cancel-plan-order SIGNED Cancel futures plan orders
/account/v1/transfer-contract SIGNED Future account transfer
/account/v1/transfer-contract-list SIGNED Get Future account transfer list
/contract/private/submit-tp-sl-order SIGNED Place a tp or sl order for a futures contract
/contract/private/modify-plan-order SIGNED Modify a plan order for a futures contract
/contract/private/modify-preset-plan-order SIGNED Modify a preset plan order for a futures contract
/contract/private/modify-tp-sl-order SIGNED Modify a tp or sl order for a futures contract
/contract/private/submit-trail-order SIGNED Place a trail order for futures contracts
/contract/private/cancel-trail-order SIGNED Cancel futures trail order
/contract/private/modify-limit-order SIGNED Modify futures limit order
/contract/private/cancel-all-after SIGNED Timed cancel all open orders
/contract/private/set-position-mode SIGNED Set position mode
/contract/private/interest SIGNED Interest Record
/contract/private/auto_repayment SIGNED Auto Repayment Record
Finance Permissions:
API Name Authentication Type Description
/newearn/cloud/v1/saving/subscribe SIGNED Earn savings subscribe to savings product
/newearn/cloud/v1/saving/redeem SIGNED Earn savings redeem from savings product
Sub-Account Permissions:

You need to enter Institution Verification to use the sub-account endpoints.

After the creation is successful, the sub-account has Read-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 Name Authentication Type Description
/account/sub-account/main/v1/sub-to-main SIGNED Sub-Account Transfer to Main-Account (For Main Account, use spot account)
/account/sub-account/sub/v1/sub-to-main SIGNED Sub-Account Transfer to Main-Account (For Sub-Account, use spot account)
/account/sub-account/main/v1/main-to-sub SIGNED Main-Account Transfer to Sub-Account (For Main Account, use spot account)
/account/sub-account/main/v1/sub-to-sub SIGNED Sub-Account Transfer to Sub-Account (For Main Account, use spot account)
/account/sub-account/main/v1/transfer-list KEYED Get Sub-Account Transfer History (For Main Account, use spot account)
/account/sub-account/v1/transfer-history KEYED Get Account Spot Asset Transfer History (For Main/Sub Account, use spot account)
/account/sub-account/main/v1/wallet KEYED Get Sub-Account Spot Wallet Balance (For Main Account, use spot account)
/account/sub-account/main/v1/subaccount-list KEYED Get Sub-Account List (For Main Account, use spot account)
/account/contract/sub-account/main/v1/sub-to-main SIGNED Sub-Account Transfer to Main-Account (For Main Account, use futures account)
/account/contract/sub-account/main/v1/main-to-sub SIGNED Main-Account Transfer to Sub-Account (For Main Account, use futures account)
/account/contract/sub-account/sub/v1/sub-to-main SIGNED Sub-Account Transfer to Main-Account (For Sub-Account, use futures account)
/account/contract/sub-account/main/v1/wallet KEYED Get Sub-Account Futures Wallet Balance (For Main Account, use futures account)
/account/contract/sub-account/v1/transfer-history KEYED Get Account Futures Asset Transfer History (For Main/Sub Account, use futures account)
/account/contract/sub-account/main/v1/transfer-list KEYED Get Sub-Account Transfer History (For Main Account, use futures account)
Contract Agent Permissions:
API Name Authentication Type Description
/contract/private/affiliate/rebate-list KEYED Get Futures Rebate List
/contract/private/affiliate/rebate-api KEYED Get API Rebate Data
/contract/private/affiliate/rebate-user KEYED Get User Rebate Data
/contract/private/affiliate/trade-list KEYED Get Futures Trade List
/contract/private/affiliate/deposit-withdrawal-list KEYED Get User Deposit Withdrawal List
/contract/private/affiliate/rebate-inviteUser KEYED Get Invited Customer List

API Library

In order to facilitate access, we provide SDK in some languages for reference. For more programming codes, please refer to the Quick 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?

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

Q3. How is the HTTP status code 429 created?

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

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

Q6. Where is the location of BitMart servers?

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

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

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 to Error Code List

Signature

The authentication type of each API endpoint will be indicated. If it is marked as SIGNED,it means that the endpoint requires a signature to access. If it is marked as KEYED, 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

// Java
System.currentTimeMillis();

// Python
int(time.time() * 1000) 

// Golang
time.Now().UnixNano() / int64(time.Millisecond)

// Nodejs & TypeScript
Date.now();

// Javascript
Date.now();

// PHP
round(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 or Quick Start API below to implement

Earn Savings

Get Product List (KEYED)

Query flexible savings product list

Request URL

GET https://api-cloud.bitmart.com/newearn/cloud/v1/saving/product

Request Limit

Based on UID, 10 times/2s

Request Parameter

Request

curl -H 'X-BM-KEY:{{AccessKey}}'
"https://api-cloud.bitmart.com/newearn/cloud/v1/saving/product?currentPage=1&sizePage=10"
Field Type Required? Description
coinName String No Coin name
currentPage Int Yes Current page number, default 1
sizePage Int Yes Page size, default 1, maximum: 100

Response Data

Response

{
    "message": "OK",
    "code": 1000,
    "trace": "0e6fbc21-e3a0-4465-8acf-8d4e52504bbd",
    "data": {
        "total": 10,
        "list": [
            {
                "productId": "1001",
                "coinName": "USDT",
                "productTag": "[\"HOT\"]",
                "apy": "5.00%",
                "minPurchaseAmount": "1",
                "maxPurchaseAmount": "100000",
                "additionalApy": "1.00%",
                "hasTierRate": true,
                "tierRate": [
                    {
                        "minPurchaseAmount": "1",
                        "maxPurchaseAmount": "10000",
                        "apy": "5.00%"
                    },
                    {
                        "minPurchaseAmount": "10000",
                        "maxPurchaseAmount": "100000",
                        "apy": "4.00%"
                    }
                ]
            }
        ]
    }
}
Field Type Description
total Long Total records
productId String Product ID
coinName String Coin name
productTag String Product tag
apy String Annual percentage yield
minPurchaseAmount String Minimum purchase amount
maxPurchaseAmount String Maximum purchase amount
additionalApy String Additional APY
hasTierRate Boolean Has tiered rate
minPurchaseAmount String Tiered rate min amount
maxPurchaseAmount String Tiered rate max amount
apy String Tiered rate APY

Subscribe (SIGNED)

Subscribe to flexible savings product

Request URL

POST https://api-cloud.bitmart.com/newearn/cloud/v1/saving/subscribe

Request Limit

Based on UID, 10 times/2s

Request Parameter

Request

curl -X POST -H 'X-BM-KEY:{{AccessKey}}' \
     -H 'X-BM-SIGN:{{Signature}}' \
     -H 'X-BM-TIMESTAMP:{{Timestamp}}' \
     -H 'Content-Type: application/json' \
     -d '{"productId":"1001","amount":"100","requestNo":"unique-request-id-001"}' \
     "https://api-cloud.bitmart.com/newearn/cloud/v1/saving/subscribe"
Field Type Required? Description
productId String Yes Product ID
amount String Yes Amount
requestNo String Yes Unique request key, length 20, only digits 0-9 allowed, e.g., 20000009000000300000

Response Data

Response

{
    "message": "OK",
    "code": 1000,
    "trace": "0e6fbc21-e3a0-4465-8acf-8d4e52504bbd",
    "data": true
}
Field Type Description
data Boolean Success

Redeem (SIGNED)

Redeem from flexible savings product

Request URL

POST https://api-cloud.bitmart.com/newearn/cloud/v1/saving/redeem

Request Limit

Based on UID, 10 times/2s

Request Parameter

Request

curl -X POST -H 'X-BM-KEY:{{AccessKey}}' \
     -H 'X-BM-SIGN:{{Signature}}' \
     -H 'X-BM-TIMESTAMP:{{Timestamp}}' \
     -H 'Content-Type: application/json' \
     -d '{"earnId":"200001","amount":"50","requestNo":"unique-request-id-002"}' \
     "https://api-cloud.bitmart.com/newearn/cloud/v1/saving/redeem"
Field Type Required? Description
earnId String Yes Earn order ID
amount String Yes Amount
requestNo String Yes Unique request key, length 20, only digits 0-9 allowed, e.g., 20000009000000300000

Response Data

Response

{
    "message": "OK",
    "code": 1000,
    "trace": "0e6fbc21-e3a0-4465-8acf-8d4e52504bbd",
    "data": true
}
Field Type Description
data Boolean Success

Get Earn Positions (KEYED)

Query flexible savings positions

Request URL

GET https://api-cloud.bitmart.com/newearn/cloud/v1/saving/earn

Request Limit

Based on UID, 10 times/2s

Request Parameter

Request

curl -H 'X-BM-KEY:{{AccessKey}}'
"https://api-cloud.bitmart.com/newearn/cloud/v1/saving/earn?currentPage=1&sizePage=10"
Field Type Required? Description
coinName String No Coin name
productId String No Product ID
currentPage Int Yes Current page number, default 1
sizePage Int Yes Page size, default 1, maximum: 100

Response Data

Response

{
    "message": "OK",
    "code": 1000,
    "trace": "0e6fbc21-e3a0-4465-8acf-8d4e52504bbd",
    "data": {
        "total": 5,
        "list": [
            {
                "earnId": "200001",
                "productId": "1001",
                "coinId": 1,
                "coinName": "USDT",
                "productTag": "[\"HOT\"]",
                "apy": "5.00%",
                "totalProfit": "10",
                "autoSubscribe": true,
                "additionalApy": "1.00%",
                "hasTierRate": true,
                "tierRate": [
                    {
                        "minPurchaseAmount": "1",
                        "maxPurchaseAmount": "10000",
                        "apy": "5.00%"
                    }
                ]
            }
        ]
    }
}
Field Type Description
total Long Total records
earnId String Earn order ID
productId String Product ID
coinId Int Coin ID
coinName String Coin name
productTag String Product tag
apy String Annual percentage yield
totalProfit String Total profit
autoSubscribe Boolean Auto-subscribe status
additionalApy String Additional APY
hasTierRate Boolean Has tiered rate
minPurchaseAmount String Tiered rate min amount
maxPurchaseAmount String Tiered rate max amount
apy String Tiered rate APY

Get History Records (KEYED)

Query flexible savings history records (subscribe/redeem/interest)

Request URL

GET https://api-cloud.bitmart.com/newearn/cloud/v1/saving/record

Request Limit

Based on UID, 10 times/2s

Request Parameter

Request

curl -H 'X-BM-KEY:{{AccessKey}}'
"https://api-cloud.bitmart.com/newearn/cloud/v1/saving/record?type=subscribe&currentPage=1&sizePage=10"
Field Type Required? Description
type String Yes Type: subscribe (subscription records), redeem (redemption records), interest (interest records)
startTime Long No Start time in milliseconds, e.g., 1681701557927
endTime Long No End time in milliseconds, e.g., 1681701557927
coinName String No Coin name
currentPage Int Yes Current page number, default 1
sizePage Int Yes Page size, default 1, maximum: 100

Response Data

Response

{
    "message": "OK",
    "code": 1000,
    "trace": "0e6fbc21-e3a0-4465-8acf-8d4e52504bbd",
    "data": {
        "total": 20,
        "list": [
            {
                "type": "subscribe",
                "recordId": "300001",
                "productId": "1001",
                "coinName": "USDT",
                "amount": "100",
                "productTag": "[\"HOT\"]",
                "time": 1681701557927,
                "subscribeType": "NORMAL"
            }
        ]
    }
}
Field Type Description
total Long Total records
type String Record type
recordId String Record ID
productId String Product ID
coinName String Coin name
amount String Amount
productTag String Product tag
time Long Timestamp in milliseconds, e.g., 1681701557927
subscribeType String Subscribe type, AUTO for auto subscribe, NORMAL for normal subscribe

Error Code

Restful Error Code

Earn API Error Code

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

error message code error code http status code
OK 1000 200
Invalid request (maybe the body is empty, or the int parameter passes string data) 80000 400
Product does not exist 80001 400
Insufficient balance 80002 400
Order amount error, such as precision exception 80003 400
Insufficient product quota 80004 400
Orders are not processed in this time period 80005 400
User cumulative subscription exceeds the limit 80006 400
User cumulative subscription limit should be less than total issuance and greater than minimum subscription amount 80007 400
Risk control restriction, no permission to subscribe 80008 400
Risk control restriction, no permission to redeem 80009 400
Product sales time limit, end time is less than start time 80010 400
Product sales have been stopped 80011 400
Parameter error 80012 400
Idempotent request 80013 400
Institutional users cannot subscribe 80014 400
Invalid kyc level, kyc level 2 verification required 80015 400
System error 80016 400
Earn invalid country, service unavailable 80017 400
Product sub-type error 80018 400
Risk control restriction, no permission to operate for this business type 80019 400
No such asset 80020 400
Subscription amount should be greater than the minimum order amount 80021 400
Type parameter error 80022 400