English
NAV
console

Welcome

Welcome to Bitget ApiDoc! Click here for quick start

Update Log

Aug 15, 2024

Endpoints Old rate limit New rate limit
/api/margin/v1/isolated/order/placeOrder 10 req/sec/UID 5 req/sec/UID
/api/margin/v1/isolated/order/batchPlaceOrder 10 req/sec/UID 5 req/sec/UID
/api/margin/v1/isolated/order/cancelOrder 10 req/sec/UID 5 req/sec/UID
/api/margin/v1/isolated/order/batchCancelOrder 10 req/sec/UID 5 req/sec/UID

Aug 11, 2023

08/08/2023

11/04/2023

28/03/2023

Introduction

API Introduction

Welcome to Bitget developer documentation!

This document is the only official document of Bitget API. The capabilities provided by Bitget API will be continuously updated here. Please pay attention to it in time.

You can switch to access different business APIs by clicking the upper menu, and you can switch the document language by clicking the language button on the upper right.

On the right side of the document is an example of request parameters and response results.

Update follow-up

Regarding API additions, updates, and offline information, Bitget will issue announcements in advance. It is recommended that users follow and subscribe to our announcements to obtain relevant information in a timely manner.

You can click here to subscribe to the announcement.

Contact us

If you have any questions or suggestions, feel free to contact us:

Quick start

Prepare to integrate

If you need to use the API, please log in to the web page, then apply the API key and complete the permission configuration, and then develop and trade according to the details of this document.

You can click here to create the API Key after login.

Each user can create 10 sets of Api Keys, and each Api Key can set permissions for reading and trading.

The permissions are described as follows:

After successfully created the API Key, please remember the following information:

SDK/Code Example

SDK(Recommended)

Java | Python | GoLang | NodeJs | PHP

PostMan Demo

PostMan

You should first try to config the APIKey, Secretkey and Passphrase in the Environments tab on left of the PostMan

Interface Type

This chapter is consist of the following two aspects for the interface types:

Public interface

The public interface can be used to obtain configuration information and market data. Public requests can be called without authentication.

Private interface

The private interface can be used for order management and account management. Every private request must be Signatured.

The private interface will be verified from server side with your APIKey.

Access restriction

This chapter mainly focuses on access restrictions:

Rest API

If a valid APIKey is passed with the request, We will use APIKey to limit the frequency; if not, the public IP Address will be used to limit the frequency.

Frequency limit rules: There are separate instructions on each interface. If there is no specific instruction, the frequency limit of general interface is 10 times per second.

Special note: When place orders in batches, 10 orders per currency pair will be counted as one request. For example, a batch order like: 1 order with ETHUSDT, 10 order with BTCUSDT, then the rate-limit will count this batch order as 2 requests.

API domain

You can use different domain as below Rest API.

Domain REST API Recommend to use
Domain1 https://api.bitget.com Main Domain
Domain2 https://capi.bitget.com Old domain

API Public parameters

side

String Description
sell Sell
buy Buy
liquidation-buy liquidation buy
liquidation-sell liquidation sell
systemRepay-buy systemRepay buy
systemRepay-sell systemRepay sell

orderType

String Description
limit Limit Order
market Market Order

loanType

String Description
normal Normal
autoLoan Auto loan place order
autoRepay Auto repay place order
autoLoanAndRepay Auto loan and repay

force

String Description
gtc Good till cancel
post_only Maker Only
fok Fill Or Kill(FOK)
ioc Immediate-Or-Cancel(IOC)

status(订单状态)

String Description
init initial, inserted into DB
new Unfilled, pending in orderbook
partial_fill Partially filled
full_fill Fully filled
cancelled Cancelled

marginType

String Description
transfer_in transfer in margin account
transfer_out transfer out margin account
borrow borrow
repay repay
liquidation_fee loiquidation fee
compensate Risk fund liquidation compensation
deal_in Transaction credited (buy)
deal_out transaction out (sell)
confiscated Wearout deduction
exchange_in Exchange income, disbursed from the system account
exchange_out Exchange expenses received from the system account
sys_exchange_in The system account exchange income occurs simultaneously with the exchange expense
sys_exchange_out The system account exchange expense occurs simultaneously with the exchange income

source

String Description
WEB web client
IOS ios client
ANDROID android client
API api client
SYS system

Flash repay status

String Description
BEGIN begin flash repay
REPAYING flash repay in progress
FINISH finish flash repay

API Verification

Initiating request

The header of all REST requests must contain the following keys:

//Java
System.currentTimeMillis();
//python
import time
time.time_ns() / 1000000
//Golang
import (
  "time"
)
int64(time.Now().UnixNano()/1000000)
//Javascript
Math.round(new Date())
//PHP
microtime(true) * 1000;

Signature

The request header of ACCESS-SIGN is obtained by encrypting timestamp + method.toUpperCase() + requestPath + "?" + queryString + body **string (+ means string concat) encrypt by **HMAC SHA256 **algorithm, and encode the encrypted result through **BASE64.

Description for each parameter of the signature

When queryString is empty, the signature format

timestamp + method.toUpperCase() + requestPath + body

 

When queryString is not empty, the signature format

timestamp + method.toUpperCase() + requestPath + "?" + queryString + body

For example

GET max transfer out amount, take USDT as an example:

Generate the string to be signed:

'1591089508404GET/api/margin/v1/cross/account/maxTransferOutAmount?coin=USDT'

Borrow,take USDT as an example:

Generate the string to be signed:

'1561022985382POST/api/margin/v1/cross/account/borrow{"coin":"USDT","borrowAmount":"1"}'

 

Steps to generate the final signature

HMAC

Step 1. Use the private key secretkey to encrypt the string to be signed with hmac sha256

String payload = hmac_sha256(secretkey, Message);

 

Step 2. Base64 encoding for Signature.

String signature = base64.encode(payload);

RSA

Step 1. Use the RSA privateKey privateKey to encrypt the string to be signed with SHA-256

Step 2. Base64 encoding for Signature.

HMAC Signature Demo Code

Java

public static String generate(String timestamp, String method, String requestPath,
                                  String queryString, String body, String secretKey)
            throws CloneNotSupportedException, InvalidKeyException, UnsupportedEncodingException {

        method = method.toUpperCase();
        body = StringUtils.defaultIfBlank(body, StringUtils.EMPTY);
        queryString = StringUtils.isBlank(queryString) ? StringUtils.EMPTY : "?" + queryString;

        String preHash = timestamp + method + requestPath + queryString + body;
        System.out.println(preHash);
        byte[] secretKeyBytes = secretKey.getBytes(SignatureUtils.CHARSET);
        SecretKeySpec secretKeySpec = new SecretKeySpec(secretKeyBytes, SignatureUtils.HMAC_SHA256);
        Mac mac = (Mac) SignatureUtils.MAC.clone();
        mac.init(secretKeySpec);
        return Base64.getEncoder().encodeToString(mac.doFinal(preHash.getBytes(SignatureUtils.CHARSET)));
    }


public static void main(String[] args) throws Exception {
      String msg=generate("1659927638003","POST","/api/spot/v1/trade/orders" ,null,"{"symbol":"TRXUSDT_SPBL","side":"buy","orderType":"limit","force":"normal","price":"0.046317","quantity":"1212"}","");
      System.out.println(msg);
    }

Python

def sign(message, secret_key):
    mac = hmac.new(bytes(secret_key, encoding='utf8'), bytes(message, encoding='utf-8'), digestmod='sha256')
    d = mac.digest()
    return base64.b64encode(d)


def pre_hash(timestamp, method, request_path, body):
    return str(timestamp) + str.upper(method) + request_path + body



if __name__ == '__main__':
    signStr = sign(pre_hash('1659927638003', 'POST', '/api/margin/v1/cross/account/borrow', str('{"coin":"USDT","borrowAmount":"1"}')), '')
    print(signStr)

For more demo code on other languages, please refer to SDK/Code Example

RSA Signature Demo Code

Java

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.management.RuntimeErrorException;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
import org.springframework.util.Base64Utils;

@Slf4j
public class CheckSign {

    public static void main(String[] args) throws Exception {
        //GET sign example
//        String timestamp = "1684814440729";
//        String queryString = "symbol=btcusdt_umcbl&marginCoin=usdt";
//        String signContent = timestamp + "GET" + "/api/mix/v1/account/account?" + queryString;
//        String sign = generate(signContent);
//        log.info("sign:{}",sign);


        //POST sign example
        String timestamp = "1684814440729";
        String preContent = timestamp + "POST" + "/api/spot/v1/trade/orders";
        String body = "{\"symbol\":\"btcusdt_spbl\",\"quantity\":\"8\",\"side\":\"buy\",\"price\":\"1\",\"orderType\":\"limit\",\"clientOrderId\":\"bitget1233456\"}";
        String signContent = preContent + body;
        String sign = generate(signContent);
        log.info("sign:{}",sign);
    }



  /**
   *
   * @param content: the string to be signed
   * @return
   */
  private String generate(String content) {
    String privateKey = "-----BEGIN PRIVATE KEY-----\n" +
            "xxxxxxxxxxxxxxxxxxxx9w0BAQEFAASCBKgwggSkAgEAAoIBAQD5C1iP01MC9fh5\n" +
            "43mGx8WgJRAp3Xz9Tcqfz6HzoSg+zd8HVxKXRTXBwMDBfLxfQXobptz1tDlPUs+g\n" +
            "YI38X8XEBZi5U4EBaZ5qHxArBTimyNXX6WNL6hTw0MI238cGKiW0WvWd9v6Z6/LX\n" +
            "i6uFUiUEsZiiuHXcO7EKGuvBrVIRl57FzvOPD5QKfhVxcHr63NfEViAEQfQH4IN2\n" +
            "+mu+L8epkWkmbua4jILUP+LXvHN7ZMiWP9bouw3r4l6v0NJ4XyucSYJL9fJ81rsI\n" +
            "iUoD1S7xlSboujR4RSsFZKFyurE1c8XiU2aZ2qq+6vjby0ncE4dKVu5x/iJZ4gsL\n" +
            "bneZujBLAgMBAAECggEAD6cF5uw6QGpjNo30emMd6aXKsUbpbyYvgQHUxPIxDFl2\n" +
            "FgkD8xv3d/j8ZGzJjhcYbJp9MrgkDfc/c23+HomKbXqIkcVMy2DvAu523q1SVTE0\n" +
            "N4DEq+XHcSc9vaMs6BdIDWDWJRp8AAKTXba6jgOOrg/Xbwq25aOeyerNPHv/N3m3\n" +
            "VImJZVV+ZcetUZ82UdX7NkvV4qmRi8se47OXUT9aypzpvGbSukkqXuE4GtKGoybR\n" +
            "R1sJtU10ap3QvyVNshn2QJnRd3GN2UENDvZS3ZvSY6f/Cq7K/EAmrsstOdUB2Ihn\n" +
            "POnI9/MrghWFq/n3ekuArWc54bDai0deKFl9KvI2oQKBgQD9ekRFMB6ueRCCeoyg\n" +
            "TOGvvW3d7X7G90XKL1xKhrg6mYh65hfQaxbihfOcrneFOoc3BgZwnbAZpF+hlq9J\n" +
            "klu69adhYlMxP2nF3PGj5vPln9/rd6/gcFFE9o7zZhI166PsmlxQ7/N0SCnlao7y\n" +
            "HZQoeeFJ1xuvCHVlNsTR+XZ88QKBgQD7hckVvGxIftcZsHChP8TFcDAn1IsaVbyt\n" +
            "i1UZ5JPznSLTcdb8YPtFr9afiCJ4b2NqRe8gCpUCUi+urnoMMsqMxTUMopiLPh2S\n" +
            "SYaBgpQYUIDLpt+Wx06krbOOyXVZ8RtgYLMpMhFCsRyzovqe8/LZQfQKWfQGTAXS\n" +
            "qL5vdyiw+wKBgQC7DMDYdbwOcFRYlOq1WEarExTCUoHdfZfIrc5jSKsmwynN14H3\n" +
            "US9gFg1BsBWPATPKzO1vqU3Mfln7umC73/9FJgZQfOh7TRpW4saGduXAq4voDTiC\n" +
            "XR/7zh6LSuVhWPRsozRAnfF/+8i+/TVjQaSVgetYPB63uXw4JoRzlq1zYQKBgQDJ\n" +
            "7ASb25G+vX1n1TsGaNBKhR9TypEFylDXreTbDaMtTzg3Mcwa/qyarGiL2Fl8AEh6\n" +
            "d7xaJ8SqgVpgTRgUFO6BBozpINt/5ZUN7NL7w92qi25qkAQt4sGi+QQOnHMGisak\n" +
            "n90VNGmg9dkJ6cxzsXqDqiwF52M9bui5zthbWfkj4wKBgEFVT+jf235aihaS88Oj\n" +
            "MbR078tvsFiRBICHlYCIef7/a+gt7N1u9sEGlPspY3HuPamA39201BuItD9X83VR\n" +
            "Vg+HjkeQIIrxmfvZn1O8/l+ItSNUzQhX6T0cSdCo6KtmZLBQ6Zaw7r63GcdvSdR2\n" +
            "xxxxxxxxxxxxxxxxxxxxxxx\n" +
            "-----END PRIVATE KEY-----\n";
    try {
      String parsedPem = privateKey.replace("\n", "").trim();
      parsedPem = parsedPem
              .replace("-----BEGIN PRIVATE KEY-----", "")
              .replace("-----END PRIVATE KEY-----", "");
      PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec(Base64Utils.decodeFromString(parsedPem));
      KeyFactory keyFactory = KeyFactory.getInstance("RSA");
      PrivateKey priKey = keyFactory.generatePrivate(priPKCS8);
      Signature signature = Signature.getInstance("SHA256WithRSA");
      signature.initSign(priKey);
      signature.update(content.getBytes(StandardCharsets.UTF_8));
      String sign = Base64Utils.encodeToString(signature.sign());
      return sign;
    } catch (Exception ex) {
      throw new RuntimeException("create sign  failed", ex);
    }
  }

}

Python

import base64
import json
import time
import base64
from Crypto.Hash import SHA256
from Crypto.Signature import PKCS1_v1_5
from Crypto.PublicKey import RSA



def get_timestamp():
    return int(time.time() * 1000)


def rsa_sign(message, private_key):
  pri_key = RSA.importKey(private_key)
  encoded_param = SHA256.new(bytes(message, encoding='utf-8'))
  sign_str = PKCS1_v1_5.new(pri_key).sign(encoded_param)
  return base64.b64encode(sign_str).decode()


def pre_hash(timestamp, method, request_path, body):
    return str(timestamp) + str.upper(method) + request_path + body


def parse_params_to_str(params):
    url = '?'
    for key, value in params.items():
        url = url + str(key) + '=' + str(value) + '&'

    return url[0:-1]


if __name__ == '__main__':
    private_key = '''-----BEGIN PRIVATE KEY-----
XXXXXXXXXXANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCdTR5gmwGH77wE
e0ljABC58EVhiw7fPXWhMh7gZwurQQ8M/I9/VA8lDjwwoGuuJ6enurdfwhpZxeZH
P3wdmwvD7XLESEXVuxJv5hdpI9m6ydInK9SA8IbaF4yYWp0l4N2mA44MzadA7QZq
bQtQPlyPZHeia5q/NZHFWCrCbW2lGAAWwrhQq9LceVIW75e213xtnps0pGlII7Ye
xLkoazuhC1X8YNSxlCdLOiz1GvOeVSeiSZx31o/O+rj7tDFpSgZJEXRmtGRoJkJy
10EGSrvUMezCVSOcb1hCExg4osK6rBKnDjFjwQvwvNNZq0JG+CkfH8eHAa7gSK50
In51go29AgMBAAECggEAEvYk30hQGu7PH0stQX3UhlVsR6HXnRlvgIrmJe7F/VLO
WaZoNdUQLktU/heYY1nsX8+mIyjmvEOayqPgdkEmXevVlcuQf38Zbduynr3vlRCX
AJnL9+8GkmucSxFBODuu/EAZc3mm27C2wUV7w6SAy9g0g6Os97ehZsSGAwHl4aye
i6KtB07LAA10Eh5Ptq4YAfCYiUO7j10pQ+DJKqN9N1eyjyw5eixEgCpudcbpCc9X
+EK6zxk8Ynr0ANX8/LwvokqgYBK1UIL6ear0dtKmeFU+KwrmkKZfXk8/Amr/O8Ot
iHTTr1SLyQKRzq3La149LMmNkUYxaMSV/KGTEV7ukQKBgQDQl/fA3mxXtQg2IjTB
cvDBGhB4c3haECWcP7TQWJDb30vxOKeq1k9YPUfegZga5zlyV28PAZnb0m5x07+0
OY4862brT+pje9OhQxfkAY6AtJaiIqhCcw5ew8Go/Ja1ML0jZESWG1MWBJtCcFTm
d3+n9yU1fB1Ze0adilYmyu7zwwKBgQDBDPJZgSj7YssPyRmo3bO0MjknfYBqXvwi
6TxV11mJRe5BJ9Rc2WXGfEm3DEn7TO/Wv0t7Yqm6/sXg5HzriN/PHlaVtE6wlXe7
3gpYKjlm99KO7KKWYqP812mASl6ydLX9QWozlOXjVhWMuSGqMWjut4J3P8jlkOJ6
pNq9c8/gfwKBgQCxwvAl8ubNj78hsuDWgsddKIMkwvKrfdsvXrMOYouAdLjZJvjs
A5q2jfKzUil3s9km8g/479pYlOn+Iv/Z7Lqke8/HdOFASoQ9h1nSuujgEgXUwkg1
6Ks0Ywqkoi0k2BY3FPnGGh8iQma1pdkUVn35fAq/m7e/S+kP1JY6lPIx1QKBgQCS
jxul67KLNrNmpot+ceGt2bseSd8l4jqU3nDZ0oW8+4Qnnu9QFhN4Hn9wIjpAOGaU
p+HMKFknB6h+Vbior98JxMSDHsHmuXKPA8DishumGlqV+vxsIzLQD1Ge/dbqsERB
olnYEyB7+KyfiyUNqjk5kcPQeHIyJk5qQaF21udoTQKBgDOMbtM0Nq7cd/SAHISR
VYIGGXRFNqAjLJW7DRJGxw3AEwxKG+nxNLeG7GsQDyPCvZSKwRpdpXRTh+6mzXqe
pQ6+33v2gOtez8Cwo6tgyKRi6QPObQk00vbrKEBTihP30m81rwBPzjwj7iKXxWgA
DJoVsaqGOaIf4qXXXXXXXXXX
-----END PRIVATE KEY-----'''


    timestamp = get_timestamp()
    request_path = "/api/mix/v1/order/placeOrder"
    # POST
    params = {"symbol": "TRXUSDT_UMCBL", "marginCoin": "USDT", "price": 0.0555, "size": 551, "side": "open_long", "orderType": "limit", "timeInForceValue": "normal"}
    body = json.dumps(params)
    sign = rsa_sign(pre_hash(timestamp, "POST", request_path, str(body)), private_key)
    print(sign)


    # GET
    body = ""
    request_path = "/api/mix/v1/account/account"
    params = {"symbol": "TRXUSDT_UMCBL", "marginCoin": "USDT"}
    request_path = request_path + parse_params_to_str(params)
    sign = rsa_sign(pre_hash(timestamp, "GET", request_path, str(body)), private_key)
    print(sign)

NodeJs

export function sign() {

    const private_key = '-----BEGIN PRIVATE KEY-----\n' +
        'XXXXXXXXXXANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCdTR5gmwGH77wE\n' +
        'e0ljABC58EVhiw7fPXWhMh7gZwurQQ8M/I9/VA8lDjwwoGuuJ6enurdfwhpZxeZH\n' +
        'P3wdmwvD7XLESEXVuxJv5hdpI9m6ydInK9SA8IbaF4yYWp0l4N2mA44MzadA7QZq\n' +
        'bQtQPlyPZHeia5q/NZHFWCrCbW2lGAAWwrhQq9LceVIW75e213xtnps0pGlII7Ye\n' +
        'xLkoazuhC1X8YNSxlCdLOiz1GvOeVSeiSZx31o/O+rj7tDFpSgZJEXRmtGRoJkJy\n' +
        '10EGSrvUMezCVSOcb1hCExg4osK6rBKnDjFjwQvwvNNZq0JG+CkfH8eHAa7gSK50\n' +
        'In51go29AgMBAAECggEAEvYk30hQGu7PH0stQX3UhlVsR6HXnRlvgIrmJe7F/VLO\n' +
        'WaZoNdUQLktU/heYY1nsX8+mIyjmvEOayqPgdkEmXevVlcuQf38Zbduynr3vlRCX\n' +
        'AJnL9+8GkmucSxFBODuu/EAZc3mm27C2wUV7w6SAy9g0g6Os97ehZsSGAwHl4aye\n' +
        'i6KtB07LAA10Eh5Ptq4YAfCYiUO7j10pQ+DJKqN9N1eyjyw5eixEgCpudcbpCc9X\n' +
        '+EK6zxk8Ynr0ANX8/LwvokqgYBK1UIL6ear0dtKmeFU+KwrmkKZfXk8/Amr/O8Ot\n' +
        'iHTTr1SLyQKRzq3La149LMmNkUYxaMSV/KGTEV7ukQKBgQDQl/fA3mxXtQg2IjTB\n' +
        'cvDBGhB4c3haECWcP7TQWJDb30vxOKeq1k9YPUfegZga5zlyV28PAZnb0m5x07+0\n' +
        'OY4862brT+pje9OhQxfkAY6AtJaiIqhCcw5ew8Go/Ja1ML0jZESWG1MWBJtCcFTm\n' +
        'd3+n9yU1fB1Ze0adilYmyu7zwwKBgQDBDPJZgSj7YssPyRmo3bO0MjknfYBqXvwi\n' +
        '6TxV11mJRe5BJ9Rc2WXGfEm3DEn7TO/Wv0t7Yqm6/sXg5HzriN/PHlaVtE6wlXe7\n' +
        '3gpYKjlm99KO7KKWYqP812mASl6ydLX9QWozlOXjVhWMuSGqMWjut4J3P8jlkOJ6\n' +
        'pNq9c8/gfwKBgQCxwvAl8ubNj78hsuDWgsddKIMkwvKrfdsvXrMOYouAdLjZJvjs\n' +
        'A5q2jfKzUil3s9km8g/479pYlOn+Iv/Z7Lqke8/HdOFASoQ9h1nSuujgEgXUwkg1\n' +
        '6Ks0Ywqkoi0k2BY3FPnGGh8iQma1pdkUVn35fAq/m7e/S+kP1JY6lPIx1QKBgQCS\n' +
        'jxul67KLNrNmpot+ceGt2bseSd8l4jqU3nDZ0oW8+4Qnnu9QFhN4Hn9wIjpAOGaU\n' +
        'p+HMKFknB6h+Vbior98JxMSDHsHmuXKPA8DishumGlqV+vxsIzLQD1Ge/dbqsERB\n' +
        'olnYEyB7+KyfiyUNqjk5kcPQeHIyJk5qQaF21udoTQKBgDOMbtM0Nq7cd/SAHISR\n' +
        'VYIGGXRFNqAjLJW7DRJGxw3AEwxKG+nxNLeG7GsQDyPCvZSKwRpdpXRTh+6mzXqe\n' +
        'pQ6+33v2gOtez8Cwo6tgyKRi6QPObQk00vbrKEBTihP30m81rwBPzjwj7iKXxWgA\n' +
        'DJoVsaqGOaIf4qXXXXXXXXXX\n' +
        '-----END PRIVATE KEY-----\n'

    const ts = Date.now();
    const NodeRSA = require('node-rsa')
    const pri_key = new NodeRSA(private_key)

    //GET
    const ts = Date.now();
    const params = 'coin=USDT&startTime=1687744761000&endTime=1690336761929'
    const endpoint = '/api/spot/v1/wallet/withdrawal-list'
    const method = "GET"
    const pre_hash = String(ts) + method + endpoint + '?' + params
    const sign = pri_key.sign(pre_hash, 'base64', 'UTF-8')

    //POST
    const endpoint_post = '/api/spot/v1/trade/open-orders'
    const params_post = '{"symbol": "BTCUSDT_SPBL"}'
    const method_post = "POST"
    const pre_hash_post = String(ts) + method_post + endpoint_post + params_post
    const sign_post = pri_key.sign(pre_hash_post, 'base64', 'UTF-8')

    return sign
}

Request interaction

All requests are based on the Https protocol, and the Content-Type in the request header information needs to be standardized as:'application/json'.

Request interaction description

Success

HTTP status code 200 indicates a successful response and may contain content. If the response contains content, it will be displayed in the corresponding return content.

Common error codes

Standard Specification

Timestamp

The unit of ACCESS-TIMESTAMP in the request signature is milliseconds. The timestamp of the request must be within 30 seconds of the API service time, otherwise the request will be considered expired and rejected. If there is a large deviation between the local server time and the API server time, we recommend that you update the timestamp by query and compare the time difference between API server time and the time in your code.

Frequency limiting rules

If the request is too frequent, the system will automatically limit the request and return the “429 too many requests” status code in the http header.

· Public interface: For the market information interfaces, the global rate limit is 2 seconds with max. 20 requests.

· Authorization interface: restrict the call of the authorization interface through apikey, refer to the frequency limitation rule of each interface for frequency limitation.

Request format

There are currently only two supported request methods: GET and POST

RestAPI

Public

Get cross margin interest rate and borrowable

Rate Limit: 10 times/1s (IP)

HTTP Request

Cross margin interest rate and max borrowable amount

Request Parameter

Parameter type Required description
coin String YES coin name

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/public/interestRateAndLimit?coin=USDT"

Response

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1679382680927,
    "data": [
        {
            "coin": "USDT",
            "leverage": "3.00000000",
            "transferInAble": true,
            "borrowAble": true,
            "dailyInterestRate": "0.01000000",
            "yearlyInterestRate": "0.07300000",
            "maxBorrowableAmount": "143000.00000000",
            "vips": [
                {
                    "level": "0",
                    "dailyInterestRate": "0.01000000",
                    "yearlyInterestRate": "0.07300000",
                    "discountRate": "1.00000000"
                },
                {
                    "level": "1",
                    "dailyInterestRate": "0.00940000",
                    "yearlyInterestRate": "0.07080000",
                    "discountRate": "0.97000000"
                }
            ]
        }
    ]
}

Response Parameters

Parameter Description
coin Coin name
leverage Leverage, default 3
transferInAble whther allow to transferIn
borrowAble borrowable
dailyInterestRate Non VIP daily interest rate
yearlyInterestRate Non VIP yearly interest rate
maxBorrowableAmount max borrowable amount
vips vip config array
> level VIP level
> dailyInterestRate daily interest rate
> yearlyInterestRate yearly interest Rate
> discountRate discount rate, 1 means no discount

GET isolated margin interest rate and max borrowable amount

Rate Limit: 10 times/1s (IP)

HTTP Request

Isolated margin interest rate and max borrowable amount

Request Parameter

Parameter type Required description
symbol String YES symbol ID, like 'BTCUSDT'

Request Example

curl "https://api.bitget.com/api/margin/v1/isolated/public/interestRateAndLimit?symbol=BTCUSDT"

Response

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1679383100800,
    "data": [
        {
            "symbol": "BTCUSDT",
            "leverage": "10.00000000",
            "baseCoin": "BTC",
            "baseTransferInAble": true,
            "baseBorrowAble": true,
            "baseDailyInterestRate": "0.00004900",
            "baseYearlyInterestRate": "0.01788500",
            "baseMaxBorrowableAmount": "35.00000000",
            "baseVips": [
                {
                    "level": "0",
                    "dailyInterestRate": "0.00004900",
                    "yearlyInterestRate": "0.01788500",
                    "discountRate": "1.00000000"
                }
            ],
            "quoteCoin": "USDT",
            "quoteTransferInAble": true,
            "quoteBorrowAble": true,
            "quoteDailyInterestRate": "0.00004900",
            "quoteYearlyInterestRate": "0.01788500",
            "quoteMaxBorrowableAmount": "200000.00000000",
            "quoteVips": [
                {
                    "level": "0",
                    "dailyInterestRate": "0.00004900",
                    "yearlyInterestRate": "0.01788500",
                    "discountRate": "1.00000000"
                }
            ]
        }
    ]
}

Response Parameter

Parameter Description
symbol Symbol ID
baseCoin base coin
leverage Leverage, default 10
baseTransferInAble base coin whether supported to transferIn
baseBorrowAble base coin borrowable
baseDailyInterestRate base coin non VIP daily Interest Rate
baseYearlyInterestRate base coin non VIP yearly Interest Rate
baseMaxBorrowableAmount base coin non VIP max borrowable amount
baseVips base vips config array
> level VIP level
> dailyInterestRate daily Interest Rate
> yearlyInterestRate yearly Interest Rate
> discountRate discount rate
quoteCoin quote coin
quoteTransferInAble quote transferIn able
quoteBorrowAble quote borrowable
quoteDailyInterestRate quote daily Interest rate
quoteYearlyInterestRate quote yearly Interest rate
quoteMaxBorrowableAmount quote max borrow able amount
quoteVips quote vips config array
> level VIP level
> dailyInterestRate daily Interest Rate
> yearlyInterestRate yearly Interest Rate
> discountRate discount rate

GET cross tier data

Rate Limit: 10 times/1s (IP)

HTTP Request

cross tier data

Request parameter

Parameter name Parameter type Required Description
coin String Yes coin name

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/public/tierData?coin=USDT"

Response

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1679383262245,
    "data": [
        {
            "tier": "1",
            "leverage": "3.00000000",
            "coin": "USDT",
            "maxBorrowableAmount": "143000.00000000",
            "maintainMarginRate": "0.10000000"
        }
    ]
}

Response Parameter

Parameter Description
tier tier
leverage Leverage, default 3
coin coin name
maxBorrowableAmount max borrowable amount
maintainMarginRate maintain margin rate(mmr)

Get isolated tier data

Rate Limit: 10 times/1s (IP)

HTTP Request

Request parameter

Parameter name Parameter type Required Description
symbol String Yes Symbol ID, like 'BTCUSDT'

Request Example

curl "https://api.bitget.com/api/margin/v1/isolated/public/tierData?symbol=BTCUSDT"

Response

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1679383385514,
    "data": [
        {
            "tier": "1",
            "symbol": "BTCUSDT",
            "leverage": "10.00000000",
            "baseCoin": "BTC",
            "quoteCoin": "USDT",
            "baseMaxBorrowableAmount": "3.00000000",
            "quoteMaxBorrowableAmount": "20000.00000000",
            "maintainMarginRate": "0.05000000",
            "initRate": "0.11110000"
        }
    ]
}

Response Parameter

Parameter Description
tier tier
symbol symbol ID: 'BTCUSDT'
leverage Leverage, default 10
baseCoin base coin
quoteCoin quote coin
baseMaxBorrowableAmount base max borrowable amount
quoteMaxBorrowableAmount quote max borrowable amount
maintainMarginRate maintain margin rate(mmr)
initRate initial margin rate

Get support currencies

Rate Limit: 20 times/1s (IP)

HTTP Request

Request Example

curl "https://api.bitget.com/api/margin/v1/public/currencies"

Response

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1679383565084,
    "data": [
        {
            "symbol": "ETHUSDT",
            "baseCoin": "ETH",
            "quoteCoin": "USDT",
            "maxCrossLeverage": "3",
            "maxIsolatedLeverage": "10",
            "warningRiskRatio": "0.80000000",
            "liquidationRiskRatio": "1.00000000",
            "minTradeAmount": "0.00010000",
            "maxTradeAmount": "10000.00000000",
            "takerFeeRate": "0.00100000",
            "makerFeeRate": "0.00100000",
            "priceScale": "4",
            "quantityScale": "4",
            "minTradeUSDT": "5.00000000",
            "isBorrowable": true,
            "userMinBorrow": "0.00000001",
            "status": "1"
        }
    ]
}

Response Parameter

Parameter Description
symbol symbol ID
baseCoin base coin
quoteCoin quote coin
maxCrossLeverage cross max leverage, 0 means not support cross margin trade
maxIsolatedLeverage isolated max leverage, 0 means not support isolated margin trade
warningRiskRatio warning risk ratio
liquidationRiskRatio force liquidation(bust) risk ratio
minTradeAmount mix trade amount
maxTradeAmount max trade amount
takerFeeRate taker fee rate
makerFeeRate maker fee rate
priceScale price scale
quantityScale quantity scale
minTradeUSDT min trade usdt
isBorrowable is borrowable
userMinBorrow min borrow amount
status status, 0: offline; 1: normal; 2: maintenance

account

Get Cross assets

Rate Limit: 10 times/1s (IP)

HTTP Request

Request parameter

Parameter name Parameter type Required Description
coin String No coin name

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/account/assets?coin=USDT"

Response

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1679383872196,
    "data": [
        {
            "coin": "USDT",
            "totalAmount": "96245.92605537",
            "available": "90745.92605537",
            "frozen": "5500.00000000",
            "borrow": "0.00001153",
            "interest": "0.00028974",
            "net": "96245.92575410",
            "ctime": "1673342905288"
        }
    ]
}

Response Parameter

Parameter Description
coin coin name
totalAmount total amount
available available amount
frozen frozen amount
borrow borrow amount
interest interest
net net assets (net = available + frozen - borrow - interest)
ctime created time, ms

Get isolated assets

Rate Limit: 10 times/1s (IP)

HTTP Request

isolated assets

Request parameter

Parameter name Parameter type Required Description
symbol String No Symbol Id: 'BTCUSDT'

Request Example

curl "https://api.bitget.com/api/margin/v1/isolated/account/assets?symbol=BTCUSDT"

Response

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1679384019309,
    "data": [
        {
            "symbol": "BTCUSDT",
            "coin": "BTC",
            "totalAmount": "0.80089820",
            "available": "0.80089820",
            "frozen": "0.00000000",
            "borrow": "0.00000000",
            "interest": "0.00000000",
            "net": "0.80089820",
            "ctime": "1673341108446"
        }
    ]
}

Response Parameter

Parameter Description
coin coin name
symbol symbol ID
totalAmount total amount
available available amount
frozen frozen amount
borrow borrow amount
interest interest
net net assets (net = available + frozen - borrow - interest)
ctime created time, ms

cross borrow

Rate Limit:10/sec (uid)

HTTP Request

Request Parameter

Parameter type Required description
coin String YES coin name
borrowAmount String YES borrow amount

Request Example

curl -X POST "/api/margin/v1/cross/account/borrow" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"coin": "USDT","borrowAmount": "1"}'

Response:

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1679384172820,
    "data": {
        "clientOid": null,
        "coin": "USDT",
        "borrowAmount": "1.00000000"
    }
}

Response Description

Parameter Description
clientOid clientOid (now not support)
coin coin name
borrowAmount borrow amount

isolated borrow

Rate Limit:10/sec (uid)

HTTP Request

Request Parameter

Parameter type Required description
coin String YES coin name
borrowAmount String YES borrow amount
symbol String YES symbol ID, 'BTCUSDT'

Request Example

curl -X POST "/api/margin/v1/isolated/account/borrow" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"coin": "USDT","borrowAmount": "1","symbol": "BTCUSDT"}'

Response:

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1679384491703,
    "data": {
        "clientOid": null,
        "symbol": "BTCUSDT",
        "coin": "USDT",
        "borrowAmount": "1.00000000"
    }
}

Response Description

Parameter Description
clientOid clientOid (now not support)
coin coin name
borrowAmount borrow amount
symbol symbol ID

cross repay

Rate Limit:10/sec (uid)

HTTP Request

Request Parameter

Parameter type Required description
coin String YES coin name
repayAmount String YES repay amount, should be greater or equals than the interest

Request Example

curl -X POST "/api/margin/v1/isolated/account/repay" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"coin": "USDT","repayAmount": "1"}'

Response:

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1679384677925,
    "data": {
        "remainDebtAmount": "0.08363461",
        "clientOid": null,
        "coin": "USDT",
        "repayAmount": "1.00000000"
    }
}

Response Description

Parameter Description
remainDebtAmount remain debt amount
clientOid clientOid (now not support)
coin coin name
repayAmount repay amount

isolated repay

Rate Limit:10/sec (uid)

HTTP Request

Request Parameter

Parameter type Required description
coin String YES coin name
repayAmount String YES repay amount
symbol String YES symbol ID: 'BTCUSDT'

Request Example

curl -X POST "/api/margin/v1/isolated/account/repay" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"coin": "USDT","repayAmount": "1","symbol":"BTCUSDT"}'

Response:

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1679384795979,
    "data": {
        "remainDebtAmount": "0.00001658",
        "clientOid": null,
        "symbol": "BTCUSDT",
        "coin": "USDT",
        "repayAmount": "1.00000000"
    }
}

Response Description

Parameter Description
remainDebtAmount remain debt amount
clientOid clientOid (now not support)
symbol symbol ID
coin coin name
repayAmount repay amount

Get cross risk rate

Rate Limit: 10 times/1s (IP)

HTTP Request

isolated risk rate

Request parameter

Parameter name Parameter type Required Description
coin String Yes coin name

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/account/riskRate?coin=BTC"
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \

Response

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1679385025143,
    "data": {
        "riskRate": "0.00000000"
    }
}

Response Parameter

Parameter Description
riskRate risk rate: cross total assets/cross total debt

isolated riskRate

Rate Limit:10/sec (uid)

HTTP Request

Request Parameter

Parameter type Required description
symbol String YES symbol ID: 'BTCUSDT'
pageNum String NO page num
pageSize String NO page size

Request Example

curl -X POST "https://api.bitget.com/api/margin/v1/isolated/account/riskRate" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"symbol": "BTCUSDT"}'

Response:

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1679385103180,
    "data": [
        {
            "symbol": "BTCUSDT",
            "riskRate": "0.00000000"
        }
    ]
}

Response Description

Parameter Description
symbol symbol ID
riskRate risk rate: isolated assets/isolated debt

cross max borrowable amount

Rate Limit:10/sec (uid)

HTTP Request

Request Parameter

Parameter type Required description
coin String YES coin name

Request Example

curl -X POST "https://api.bitget.com/api/margin/v1/cross/account/maxBorrowableAmount" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"coin": "USDT"}'

Response:

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1679385348895,
    "data": {
        "maxBorrowableAmount": "142999.91636538",
        "coin": "USDT"
    }
}

Response Description

Parameter Description
maxBorrowableAmount max borrowable amount
coin coin name

isolated max borrowable amount

Rate Limit:10/sec (uid)

HTTP Request

Request Parameter

Parameter type Required description
coin String YES coin name
symbol String YES symbol ID: 'BTCUSDT'

Request Example

curl -X POST "https://api.bitget.com/api/margin/v1/isolated/account/maxBorrowableAmount" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{"coin": "USDT","symbol":"BTCUSDT"}'

Response:

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1679385484178,
    "data": {
        "symbol": "BTCUSDT",
        "coin": "USDT",
        "maxBorrowableAmount": "199999.99998342"
    }
}

Response Description

Parameter Description
symbol symbol ID
coin coin name
maxBorrowableAmount max borrowable amount

Get cross max transfer out amount

Rate Limit: 10 times/1s (IP)

HTTP Request

cross max transfer out amount

Request parameter

Parameter name Parameter type Required Description
coin String Yes coin name

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/account/maxTransferOutAmount?coin=USDT" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1679385546229,
    "data": {
        "coin": "USDT",
        "maxTransferOutAmount": "90745.92605537"
    }
}

Response Parameter

Parameter Description
coin coin name
maxTransferOutAmount max transfer out amount

Get isolated max transfer out amount

Rate Limit: 10 times/1s (IP)

HTTP Request

isolated max transfer out amount

Request parameter

Parameter name Parameter type Required Description
coin String Yes coin name
symbol String Yes symbol ID: 'BTCUSDT'

Request Example

curl "https://api.bitget.com/api/margin/v1/isolated/account/maxTransferOutAmount?coin=USDT&symbol=BTCUSDT" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response

{
    "code": "00000",
    "msg": "success",
    "requestTime": 1679385605021,
    "data": {
        "coin": "USDT",
        "symbol": "BTCUSDT",
        "maxTransferOutAmount": "85665.92083922"
    }
}

Response Parameter

Parameter Description
coin coin name
symbol symbol ID
maxTransferOutAmount max transfer out amount

 

 

 

 

 

 

 

 

 

 

Isolated Flash Repay

Rate Limit: 10 times/sec (uid)

HTTP Request

Request Example

curl "https://api.bitget.com/api/margin/v1/isolated/account/flashRepay" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
 -d \'{
    "symbols": ["BTCUSDT", "ETHUSDT"]
}'

Request Body

Parameter name Parameter type Required Description
symbols List no Isolated Symbol List (max lenth 100), empty is to repay all

Response


{
  "code":"00000",
  "msg":"success",
  "requestTime":163123213132,
  "data": [
    {
      "id":"3423423",
      "symbol":"BTCUSDT",
      "code": "success"
    },
    {
      "id":"3423423",
      "symbol":"ETHUSDT",
      "code": "success"
    }
  ]

}

Response Parameter

Parameter Description
id Flash repay id
symbol Margin Symbol
code success means request flashRepay success

 

 

 

 

 

 

 

 

 

 

Query Isolated Flash Repay Status

Rate Limit: 10 times/sec (uid)

HTTP Request

Request Example

curl "https://api.bitget.com/api/margin/v1/isolated/account/queryFlashRepayStatus" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
 -d \'{
    "idList": ["13423423", "36278902"]
}'

Request Body

Parameter name Parameter type Required Description
idList List yes Flash repay ID Collection (max lenth 100)

Response


{
  "code":"00000",
  "msg":"success",
  "requestTime":163123213132,
  "data": [
    {
      "id":"13423423",
      "status":"FINISH"

    },
    {
      "id":"36278902",
      "status":"FINISH"
    }
  ]
}

Response Parameter

Parameter Description
id Flash Repay ID
status Status

 

 

 

 

 

 

 

 

 

 

Cross Flash Repay

Rate Limit: 10 times/sec (uid)

HTTP Request

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/account/flashRepay" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
 -d \'{
    "coin": "BTC"
}'

Request Body

Parameter name Parameter type Required Description
coin String no Coin, empty is to repay all

Response

{
  "code":"00000",
  "msg":"success",
  "requestTime":163123213132,
  "data": {
    "id":"23423423423432",
    "coin":"BTC"
  }
}

Response Parameter

Parameter Description
id Flash Repay ID
coin Repay coin, if repay all, this parameter will be empty

 

 

 

 

 

 

 

 

 

 

Query Cross Flash Repay Status

Rate Limit: 10 times/sec (uid)

HTTP Request

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/account/queryFlashRepayStatus" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
 -d \'{
    "idList": ["13423423", "36278902"]
}'

Request Body

Parameter name Parameter type Required Description
idList List yes Flash repay ID Collection (max lenth 100)

Response ```Json

{ "code":"00000", "msg":"success", "requestTime":163123213132, "data": [ { "id":"13423423", "status":"FINISH"

}, { "id":"36278902", "status":"FINISH" } ] } ```

Response Parameter

Parameter Description
id Flash Repay ID
status Status

isolated margin orders and trades

isolated place order

Limit rule 5 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol
orderType String Yes limit/market orderType
price String No Price
loanType String Yes Margin Order Type loanType
timeInForce String Yes force force
baseQuantity String No limit order is required, market order and sell is required, Base quantity, base coin
quoteAmount String No market order and buy is required, Quote quantity, quote Coin
clientOid String No Custom id, max length: 40
side String Yes Trade side: buy or sell side

Request Example

curl "https://api.bitget.com/api/margin/v1/isolated/order/placeOrder" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{
    "symbol": "BTCUSDT",
    "side": "buy",
    "price":"15100",
    "orderType": "limit",
    "timeInForce": "gtc",
    "baseQuantity": "0.1",
    "clientOid":"clientOid001",
    "loanType":"normal"
}

'

Response Data

{
  "code":"00000",
  "msg":"success",
  "requestTime":163123213132,
  "data":{
    "orderId":"1001",
    "clientOid":"clientOid001"
  }
}

Response Description

Parameter Description
orderId Order ID
clientOid Custom ID

isolated batch order

Limit rule 5 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol
orderList array Yes Order List

orderList

Parameter Name Parameter Type Required Description
orderType String Yes limit/market
price String No Price
loanType String Yes Margin Order Type loanType
timeInForce String Yes force force
baseQuantity String No limit order is required, market order and sell is required, Base quantity, base coin
quoteAmount String No market order and buy is required, Quote quantity, quote Coin
clientOid String No Custom id, max length: 40
side String Yes Trade side: buy or sell side

Request Example

curl "https://api.bitget.com/api/margin/v1/isolated/order/batchPlaceOrder" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
 -d \'{
    "symbol": "BTCUSDT",
    "orderList": [
        {
            "side": "buy",
            "price":"23100",
            "orderType": "limit",
            "timeInForce": "gtc",
            "baseQuantity": "0.1",
            "loanType":"normal"
        }
    ]
}'

Response Data

{
  "code": "00000",
  "msg": "success",
  "requestTime": 1666336231317,
  "data": {
    "resultList": [
      {
        "orderId": "96724974842718610",
        "clientOid": "qqq#1044sdf1343"
      }
    ],
    "failure": [
      {
        "clientOid": "qqq#1666185450114",
        "errorMsg": "clientOid duplicate"
      }
    ]
  }
}

Response Description

Parameter Description
resultList success order array
> orderId order ID
> clientOid custom ID
failure failure order array
> clientOid custom ID
> errorMsg error reason

isolated cancel order

Limit rule 5 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol(example:BTCUSDT)
orderId String No order ID, 'orderId' and 'clientOid' must have one
clientOid String No custom ID, 'orderId' and 'clientOid' must have one

Request Example

curl "https://api.bitget.com/api/margin/v1/isolated/order/cancelOrder" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
 -d \'{
    "symbol": "BTCUSDT",
    "orderId": "3242384623846284238",
    "clientOid": "",
}'

Response Data

{
  "code": "00000",
  "msg": "success",
  "requestTime": 1666336231317,
  "data": {
    "resultList": [
      {
        "orderId": "96724974842718610",
        "clientOid": "qqq#1044sdf1343"
      }
    ],
    "failure": [
      {
        "clientOid": "qqq#1666185450114",
        "errorMsg": "clientOid duplicate"
      }
    ]
  }
}

Response Description

Parameter Description
resultList success cancel orders array
> orderId order ID
> clientOid custom ID
failure failure cancel orders array
> orderId order ID
> clientOid custom ID
> errorMsg error message

isolated batch cancel orders

Limit rule 5 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol (example:BTCUSDT)
orderIds String No order ID arrays, 'orderIds' and 'clientOids' must have one
clientOids String No custom ID arrays, 'orderIds' and 'clientOids' must have one

Request Example

curl "https://api.bitget.com/api/margin/v1/isolated/order/batchCancelOrder" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
 -d \'{
    "symbol": "BTCUSDT",
    "orderIds": ["3242384623846284238"],
    "clientOids": [],
}'

Response Data

{
  "code": "00000",
  "msg": "success",
  "requestTime": 1666336231317,
  "data": {
    "resultList": [
      {
        "orderId": "96724974842718610",
        "clientOid": "qqq#1044sdf1343"
      }
    ],
    "failure": [
      {
        "clientOid": "qqq#1666185450114",
        "errorMsg": "clientOid duplicate"
      }
    ]
  }
}

Response Description

Parameter Description
resultList success cancel orders array
> orderId order ID
> clientOid custom ID
failure failure cancel orders array
> orderId order ID
> clientOid custom ID
> errorMsg error message

isolated open orders

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol (example:BTCUSDT)
orderId String No Order ID
clientOid String No custom ID
startTime String No start time, ms, value should be within 90 days
endTime String No end time, ms, value should be within 90 days
pageSize String No Page Size

Request Example

curl "https://api.bitget.com/api/margin/v1/isolated/order/openOrders?symbol=BTCUSDT_UMCBL&startTime=1659403328000&endTime=1659410528000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response Data

{
  "code":"00000",
  "message":"success",
  "data":{
    "orderList":[{
      "symbol":"btcusdt",
      "orderType":"limit", 
      "source":"API",
      "orderId":"2222222",
      "clientOid":"xxxxxxx",
      "price":"17000",
      "loanType":"autoLoan",
      "timeInForce":"gtc",
      "side":"buy",
      "status":"new",
      "baseQuantity":"1",
      "quoteAmount":"17000",
      "fillPrice":"17000",
      "fillQuantity":"1", 
      "fillTotalAmount":"17000",  
      "cTime":"1622697148000" 
    }],
    "maxId":"2222222",
    "minId":"2222222"
  }
}

Response Description

Parameter Description
symbol Symbol
orderId order ID
clientOid custom ID
fillQuantity Transaction quantity
fillPrice Transaction price
fillTotalAmount Total transaction volume
timeInForce force
price Order price
source source
status Order status
side Trade side
baseQuantity base coin quantity
quoteAmount quote coin amount
orderType orderType
cTime Create time
loanType loanType

Get isolated order history

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol
orderId String No Order ID
source String No source
clientOid String No custom ID
startTime String Yes start time, ms, value should be within 90 days
endTime String No end time, ms
pageSize String No Page Size
minId String No minId (The minId returned from the previous query, will return data with 'orderId' less than the given 'minId')

Request Example

curl "https://api.bitget.com/api/margin/v1/isolated/order/history?symbol=BTCUSDT&startTime=1659403328000&endTime=1659410528000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response Data

{
  "code":"00000",
  "message":"success",
  "data":{
    "orderList":[{
      "symbol":"btcusdt",
      "orderType":"limit", 
      "source":"API",
      "orderId":"2222222",
      "clientOid":"xxxxxxx",
      "price":"17000",
      "loanType":"autoLoan",
      "timeInForce":"gtc",
      "side":"buy",
      "status":"new",
      "baseQuantity":"1",
      "quoteAmount":"17000",
      "fillPrice":"17000",
      "fillQuantity":"1", 
      "fillTotalAmount":"17000",  
      "cTime":"1622697148000" 
    }],
    "maxId":"2222222",
    "minId":"2222222"
  }
}

Response Description

Parameter Description
symbol Symbol
orderId order ID
clientOid custom ID
fillQuantity Transaction quantity
fillPrice Transaction price
fillTotalAmount Total transaction volume
timeInForce force
price Order price
source source
status Order status
side side
baseQuantity base coin quantity
quoteAmount quote coin amount
orderType orderType
cTime Create time, ms
loanType loanType

Get isolated transaction details

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol
orderId String No Order ID
lastFillId String No lastFillId(please provide 'minId' from last query, will return data with 'fillId' less than the given value)
startTime String Yes start time, ms
endTime String No end time, ms
pageSize String No Page Size

Request Example

curl "https://api.bitget.com/api/margin/v1/isolated/order/fills?symbol=BTCUSDT&startTime=1659403328000&endTime=1659410528000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response Data

{
  "code":"00000",
  "message":"success",
  "requestTime":"1622697148000",
  "data":{
    "resultList":[
      {
        "orderId":"100021",
        "fillId":"102211",
        "orderType":"limit",
        "side":"buy",
        "fillPrice":"38293.12",
        "fillQuantity":"1",
        "fillTotalAmount":"38293.12",
        "cTime":"1622697148000",
        "feeCcy":"btc",
        "fees":"0.0001"
      }
    ],
    "maxId":"102211",
    "minId":"102211"
  }
}

Response Description

Parameter Description
symbol Symbol
orderId Order ID
fillId ID
fillQuantity order filled quantity
fillPrice order filled price
fillTotalAmount order filled total amount
side Side
feeCcy fee currency
orderType orderType: (limit/market )
cTime create time, ms
fees fees

Get isolated loan records

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol, 'BTCUSDT'
loanId String No ID
coin String No coin
startTime String Yes start time, ms
endTime String No end time, ms
pageSize String No Page Size
pageId String No minId (The minId returned from the previous query, will return data with an loanId less than the given value)

Request Example

curl "https://api.bitget.com/api/margin/v1/isolated/loan/list?symbol=BTCUSDT&startTime=1659403328000&endTime=1659410528000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response Data

{
  "code":"00000",
  "message":"success",
  "data":{
    "resultList":[
      {
        "loanId":"34234234234324",
        "symbol":"BTCUSDT",
        "coin":"BTC",
        "cTime":"102211213000",
        "amount":"22.22", 
        "type":"autoLoan" 
      }
    ],
    "maxId":"34234234234324",
    "minId":"34234234234324"
  }
}

Response Description

Parameter Description
symbol Symbol
loanId ID
coin Coin
amount loan amount
type loan type, 'autoLoan': Auto loan; 'manualLoan': manual loan
cTime create time, ms

Get isolated repay history

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol, 'BTCUSDT'
repayId String No ID
coin String No Coin
startTime String Yes start time, ms
endTime String No end time, ms
pageSize String No Page Size
pageId String No minId (The minId returned from the previous query, will return data with 'repayId' less than the given value)

Request Example

curl "https://api.bitget.com/api/margin/v1/isolated/repay/list?symbol=BTCUSDT&startTime=1659403328000&endTime=1659410528000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response Data

{
  "code":"00000",
  "message":"success",
  "data":{
    "resultList":[
      {
        "repayId":"32423423423",
        "symbol":"BTCUSDT",
        "coin":"BTC",
        "cTime":"162211242000",
        "totalAmount":"22.22", 
        "type":"autoRepay",
        "interest": "0.22",
        "amount": "22"
      }
    ],
    "maxId":"32423423423",
    "minId":"32423423423"
  }
}

Response Description

Parameter Description
symbol Symbol
repayId ID
coin Coin
amount repay amount
totalAmount total repay amount
interest interest
type repay type
cTime create time

Get isolated interest records

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol, 'BTCUSDT'
coin String No Coin
startTime String Yes start time, ms
pageSize String No Page Size
pageId String No minId (The minId returned from the previous query, will return data with 'interestId' less than the given value)

Request Example

curl "https://api.bitget.com/api/margin/v1/isolated/interest/list?symbol=BTCUSDT&startTime=1659403328000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response Data

{
  "code":"00000",
  "message":"success",
  "data":{
    "resultList":[
      {
        "interestId":"34523523",
        "symbol":"BTCUSDT",
        "cTime":"16588502211",
        "amount":"22.22", 
        "type": "first",
        "interestCoin": "BTC", 
        "loanCoin": "BTC",   
        "interestRate":"0.00001"  
      }
    ],
    "maxId":"34523523",
    "minId":"34523523"
  }
}

Response Description

Parameter Description
symbol Symbol
interestId ID
interestCoin interest coin
amount interest amunt
interestRate daily interest
loanCoin loan coin
type interest type: 'first', loan initial interest; 'scheduled': scheduled interest
cTime create time

Get isolated liquidation records

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Symbol
startTime String start time
endTime String end time
pageSize String page Size
pageId String minId (The minId returned from the previous query, will return data with 'liqId' less than the given value)

Request Example

curl "https://api.bitget.com/api/margin/v1/isolated/liquidation/list?symbol=BTCUSDT&startTime=1659403328000&endTime=1659410528000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response Data

{
  "code":"00000",
  "message":"success",
  "data":[
    {
      "liqId":"123",
      "symbol":"BTCUSDT",
      "liqStartTime": "1653453245342",
      "liqEndTime": "16312423423432",
      "liqRisk":"1.01", 
      "totalAssets": "1242.34",  
      "totalDebt": "1100", 
      "LiqFee":"1.2",
      "cTime":"1653453245342"
    }
  ],
  "maxId":"123",
  "minId":"123"
}

Response Description

Parameter Description
symbol Symbol
liqId ID
liqStartTime liquidation start time, ms
liqEndTime liquidation end time, ms
liqRisk liquidation risk rate
totalAssets total Assets
totalDebt total debt
LiqFee liquidation fee
cTime create time, ms

Get isolated finance history

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol
marginType String No Margin Type marginType
coin String No Coin
startTime String Yes start time, ms
endTime String No end time, ms
pageSize String No Page Size
pageId String No minId (The minId returned from the previous query, will return data with 'marginId' less than the given value)

Request Example

curl "https://api.bitget.com/api/margin/v1/isolated/fin/list?symbol=BTCUSDT&startTime=1659403328000&endTime=1659410528000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response Data

{
  "code":"00000",
  "message":"success",
  "data":{
    "resultList":[
      {
        "marginId":"12868683",
        "symbol":"BTCUSDT",
        "coin":"USDT",
        "marginType": "transferIn",
        "amount":"1400",
        "fee":"1.01",
        "balance": "1242.34", 
        "cTime":"1653453245342"
      }
    ],
    "maxId":"123",
    "minId":"123"
  }
}

Response Description

Parameter Description
symbol Symbol
marginId ID
coin Coin
marginType marginType
amount amount
fee fee
balance account balance
cTime create time

cross margin orders and trades

cross place order

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol, 'BTCUSDT'
orderType String Yes orderType:limit/market
price String No Price
loanType String Yes loanType
timeInForce String Yes force
baseQuantity String No limit order is required, market order and sell is required, base coin quantity
quoteAmount String No market order and buy is required, quote coin amount
clientOid String No Custom id, max length: 40
side String Yes Trade side: buy or sell

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/order/placeOrder" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
  -d \'{
    "symbol": "BTCUSDT",
    "side": "buy",
    "price":"15100",
    "orderType": "limit",
    "timeInForce": "gtc",
    "baseQuantity": "0.1",
    "clientOid":"clientOid001",
    "loanType":"normal"
}

'

Response Data

{
  "code":"00000",
  "msg":"success",
  "requestTime":163123213132,
  "data":{
    "orderId":"1001",
    "clientOid":"clientOid001"
  }
}

Response Description

Parameter Description
orderId Order ID
clientOid Custom ID

cross batch order

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol
orderList array Yes Order List

orderList

Parameter Name Parameter Type Required Description
orderType String Yes orderType: limit/market
price String No Price
loanType String Yes Margin loanType
timeInForce String Yes force
baseQuantity String No limit order is required, market order and sell is required, base coin quantity
quoteAmount String No market order and buy is required, quote coin amount
clientOid String No Custom id, max length: 40
side String Yes Trade side: buy or sell

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/order/batchPlaceOrder" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
 -d \'{
    "symbol": "BTCUSDT",
    "orderList": [
        {
            "side": "buy",
            "price":"23100",
            "orderType": "limit",
            "timeInForce": "gtc",
            "baseQuantity": "0.1",
            "loanType":"normal"
        }
    ]
}'

Response Data

{
  "code": "00000",
  "msg": "success",
  "requestTime": 1666336231317,
  "data": {
    "resultList": [
      {
        "orderId": "96724974842718610",
        "clientOid": "qqq#1044sdf1343"
      }
    ],
    "failure": [
      {
        "clientOid": "qqq#1666185450114",
        "errorMsg": "clientOid duplicate"
      }
    ]
  }
}

Response Description

Parameter Description
resultList success order array
> orderId order ID
> clientOid custom ID
failure failure order array
> clientOid custom ID
> errorMsg error reason

cross cancel order

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol, 'BTCUSDT'
orderId String No order ID, 'orderId' or 'clientOid' must provide one
clientOid String No custom ID, 'orderId' or 'clientOid' must provide one

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/order/cancelOrder" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
 -d \'{
    "symbol": "BTCUSDT",
    "orderId": "3242384623846284238",
    "clientOid": "",
}'

Response Data

{
  "code": "00000",
  "msg": "success",
  "requestTime": 1666336231317,
  "data": {
    "resultList": [
      {
        "orderId": "96724974842718610",
        "clientOid": "qqq#1044sdf1343"
      }
    ],
    "failure": [
      {
        "clientOid": "qqq#1666185450114",
        "errorMsg": "clientOid duplicate"
      }
    ]
  }
}

Response Description

Parameter Description
resultList success cancel orders array
> orderId order ID
> clientOid custom ID
failure failure cancel orders array
> clientOid custom ID
> errorMsg error message

cross batch cancel order

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol
orderIds String No order ID arrays, 'orderIds' or 'clientOids' must provide one
clientOids String No custom ID arrays, 'orderIds' or 'clientOids' must provide one

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/order/batchCancelOrder" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json" \
 -d \'{
    "symbol": "BTCUSDT",
    "orderIds": ["3242384623846284238"]
}'

Response Data

{
  "code": "00000",
  "msg": "success",
  "requestTime": 1666336231317,
  "data": {
    "resultList": [
      {
        "orderId": "96724974842718610",
        "clientOid": "qqq#1044sdf1343"
      }
    ],
    "failure": [
      {
        "clientOid": "qqq#1666185450114",
        "errorMsg": "clientOid duplicate"
      }
    ]
  }
}

Response Description

Parameter Description
resultList success cancel orders array
> orderId order ID
> clientOid custom ID
failure failure cancel orders array
> clientOid custom ID
> errorMsg error message

Get cross open orders

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol, 'BTCUSDT'
orderId String No Order ID
clientOid String No custom ID
startTime String No start time, ms, value should be within 90 days
endTime String No end time, ms
pageSize String No Page Size

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/order/openOrders?symbol=BTCUSDT_UMCBL&startTime=1659403328000&endTime=1659410528000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response Data

{
  "code":"00000",
  "message":"success",
  "data":{
    "orderList":[{
      "symbol":"BTCUSDT",
      "orderType":"limit", 
      "source":"API",
      "orderId":"2222222",
      "clientOid":"xxxxxxx",
      "price":"17000",
      "loanType":"autoLoan",
      "timeInForce":"gtc",
      "side":"buy",
      "status":"new",
      "baseQuantity":"1",
      "quoteAmount":"17000",
      "fillPrice":"17000",
      "fillQuantity":"1", 
      "fillTotalAmount":"17000",  
      "cTime":"1622697148000" 
    }],
    "maxId":"2222222",
    "minId":"2222222"
  }
}

Response Description

Parameter Description
symbol Symbol
orderId order ID
clientOid custom ID
fillQuantity Transaction quantity
fillPrice Transaction price
fillTotalAmount Total transaction volume
timeInForce force
price Order price
source source
status Order status
side Trade side
baseQuantity base coin quantity
quoteAmount quote coin amount
orderType orderType
cTime Create time, ms
loanType margin loanType

Get cross order history

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol, 'BTCUSDT'
orderId String No Order ID
source String No source
clientOid String No custom ID
startTime String Yes start time, ms, value should be within 90 days
endTime String No end time, ms
pageSize String No Page Size
minId String No minId (The minId returned from the previous query, will return data with 'orderId' less than the given value)

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/order/history?symbol=BTCUSDT&startTime=1659403328000&endTime=1659410528000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response Data

{
  "code":"00000",
  "message":"success",
  "data":{
    "orderList":[{
      "symbol":"btcusdt",
      "orderType":"limit", 
      "source":"API",
      "orderId":"2222222",
      "clientOid":"xxxxxxx",
      "price":"17000",
      "loanType":"autoLoan",
      "timeInForce":"gtc",
      "side":"buy",
      "status":"new",
      "baseQuantity":"1",
      "quoteAmount":"17000",
      "fillPrice":"17000",
      "fillQuantity":"1", 
      "fillTotalAmount":"17000",  
      "cTime":"1622697148000" 
    }],
    "maxId":"2222222",
    "minId":"2222222"
  }
}

Response Description

Parameter Description
symbol Symbol
orderId order ID
clientOid custom ID
fillQuantity Transaction quantity
fillPrice Transaction price
fillTotalAmount Total transaction volume
timeInForce force force
price Order price
source source
status Order status
side Trade side
baseQuantity base coin quantity
quoteAmount quote coin amount
orderType orderType
cTime Create time, ms
loanType margin loanType

Get cross order fills

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
symbol String Yes Symbol, 'BTCUSDT'
orderId String No Order ID
lastFillId String No lastFillId
startTime String Yes start time, ms
endTime String No end time, ms
pageSize String No Page Size, default 100, max 500

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/order/fills?symbol=BTCUSDT&startTime=1659403328000&endTime=1659410528000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response Data

{
  "code":"00000",
  "message":"success",
  "requestTime":"1622697148000",
  "data":{
    "resultList":[
      {
        "symbol":"BTCUSDT",
        "orderId":"100021",
        "fillId":"102211",
        "orderType":"limit",
        "side":"buy",
        "fillPrice":"38293.12",
        "fillQuantity":"1",
        "fillTotalAmount":"38293.12",
        "cTime":"1622697148000",
        "feeCcy":"btc",
        "fees":"0.0001"
      }
    ],
    "maxId":"102211",
    "minId":"102211"
  }
}

Response Description

Parameter Description
symbol Symbol
orderId Order ID
fillId ID
fillQuantity order filled quantity
fillPrice order filled price
fillTotalAmount order filled total amount
side Trade side
feeCcy fee currency
orderType orderType: (limit/market )
cTime create time, ms
fees fees

Get cross loan records

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
loanId String No ID
coin String No coin
startTime String Yes start time, ms
endTime String No end time, ms
pageSize String No Page Size, default 100, max 500
pageId String No minId (The minId returned from the previous query, will return data with 'loanId' less than the given value)

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/loan/list?startTime=1679350657000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response Data

{
  "code":"00000",
  "message":"success",
  "data":{
    "resultList":[
      {
        "loanId":"34234234234324",
        "coin":"BTC",
        "cTime":"102211213000",
        "amount":"22.22", 
        "type":"autoLoan" 
      }
    ],
    "maxId":"34234234234324",
    "minId":"34234234234324"
  }
}

Response Description

Parameter Description
loanId ID
coin Coin
amount loan amount
type loan type: 'autoLoan' or 'manualLoan'
cTime create time

Get cross repay history

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
repayId String No ID
coin String No Coin
startTime String Yes start time, ms
endTime String No end time, ms
pageSize String No Page Size, default 100, max 500
pageId String No minId (The minId returned from the previous query, will return data with 'repayId' less than the given value)

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/repay/list?startTime=1659403328000&endTime=1659410528000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response Data

{
  "code":"00000",
  "message":"success",
  "data":{
    "resultList":[
      {
        "repayId":"32423423423",
        "coin":"BTC",
        "cTime":"162211242000",
        "totalAmount":"22.22", 
        "type":"autoRepay",
        "interest": "0.22",
        "amount": "22"
      }
    ],
    "maxId":"32423423423",
    "minId":"32423423423"
  }
}

Response Description

Parameter Description
repayId ID
coin Coin
amount repay amount
totalAmount total repay amount
interest repay interest
type repay type: 'autoRepay', 'manualRepay' or 'liqRepay'
cTime create time

Get cross interest records

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
coin String No Coin
startTime String Yes start time, ms
pageSize String No Page Size, default 100, max 500
pageId String No minId (The minId returned from the previous query, will return data with 'interestId' less than the given value)

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/interest/list?startTime=1659403328000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response Data

{
  "code":"00000",
  "message":"success",
  "data":{
    "resultList":[
      {
        "interestId":"34523523",
        "cTime":"16588502211",
        "amount":"22.22", 
        "type": "first",
        "interestCoin": "BTC", 
        "loanCoin": "BTC",   
        "interestRate":"0.00001"  
      }
    ],
    "maxId":"34523523",
    "minId":"34523523"
  }
}

Response Description

Parameter Description
interestId ID
interestCoin interest coin
amount interest amount
interestRate daily interest rate
loanCoin loan coin
type interest type: 'first' or 'scheduled'
cTime create time

Get cross liquidation records

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
startTime String Yes start time, ms
endTime String No end time, ms
pageSize String No page Size, default 100, max 500
pageId String No minId (The minId returned from the previous query, will return data with 'liqId' less than the given value)

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/liquidation/list?startTime=1659403328000&endTime=1659410528000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response Data

{
  "code":"00000",
  "message":"success",
  "data":[
    {
      "liqId":"123",
      "liqStartTime": "1653453245342",
      "liqEndTime": "16312423423432",
      "liqRisk":"1.01", 
      "totalAssets": "1242.34",  
      "totalDebt": "1100", 
      "LiqFee":"1.2",
      "cTime":"1653453245342"
    }
  ],
  "maxId":"123",
  "minId":"123"
}

Response Description

Parameter Description
liqId ID
liqStartTime liquidation start time
liqEndTime liquidation end time
liqRisk liquidation risk
totalAssets total Assets
totalDebt total debt
LiqFee liquidation fee
cTime crteate time

Get cross finance flow history

Limit rule 10 times/1s (uid)

HTTP Request

Request Parameter

Parameter Name Parameter Type Required Description
marginType String No marginType
coin String No Coin
startTime String Yes start time, ms
endTime String No end time, ms
pageSize String No Page Size, default 100, max 500
pageId String No minId (The minId returned from the previous query, will return data with 'marginId' less than the given value)

Request Example

curl "https://api.bitget.com/api/margin/v1/cross/fin/liststartTime=1659403328000&endTime=1659410528000&pageSize=20" \
  -H "ACCESS-KEY:you apiKey" \
  -H "ACCESS-SIGN:*******" \
  -H "ACCESS-PASSPHRASE:*****" \
  -H "ACCESS-TIMESTAMP:1659076670000" \
  -H "locale:en-US" \
  -H "Content-Type: application/json"

Response Data

{
  "code":"00000",
  "message":"success",
  "data":{
    "resultList":[
      {
        "marginId":"12868683",
        "coin":"USDT",
        "marginType": "transferIn",
        "amount":"1400",
        "fee":"1.01",
        "balance": "1242.34", 
        "cTime":"1653453245342"
      }
    ],
    "maxId":"123",
    "minId":"123"
  }
}

Response Description

Parameter Description
marginId ID
coin Coin
marginType margin type marginType
amount amount
fee fee
balance account balance
cTime create time

WebSocketAPI

Overview

WebSocket is a new HTML5 protocol that achieves full-duplex data transmission between the client and server, allowing data to be transferred effectively in both directions. A connection between the client and server can be established with just one handshake. The server will then be able to push data to the client according to preset rules. Its advantages include:

It is strongly recommended that developers use WebSocket API to obtain market information and transaction depth. ​

domain WebSocket API Recommended to use
domain 1 wss://ws.bitget.com/spot/v1/stream internationality

Connect

Connection instructions:

Connection limit: 100 connections per IP

When subscribing to a public channel, no login is required.

When subscribing to a private channel, MUST login before subscribe to any channel(s)

Subscription limit: 240 times per hour

If there’s a network problem, the system will automatically close the connection.

The connection will be closed automatically if the subscription is not established or, no data pushed from server for more than 30 seconds.

Client should keep ping the server in every 30 seconds. Server will close the connections which has no ping over 120 seconds(even when the client is still receiving data from the server)

To keep the connection stable:

  1. Set a timer of N seconds, where N is between 25 and 30.
  2. If the timer is triggered, send the String 'ping'.
  3. Expect a 'pong' as a response. If the response message is not received within N seconds, please raise an error or reconnect.
  4. The Websocket server accepts up to 10 messages per second. The message includes:
  5. PING frame
  6. Messages in JSON format, such as subscribe, unsubscribe.
  7. If the user sends more messages than the limitation, the connection will be disconnected. IPs that are repeatedly disconnected may be blocked by the server;
  8. A single connection can subscribe up to 1000 Streams;
  9. A single IP can create up to 100 connections.

Login

api_key: Unique identification for invoking API. Requires user to apply one manually.

passphrase: APIKey password

timestamp: the Unix Epoch time, the unit is seconds

sign: signature string

method: always 'GET'

requestPath: always '/user/verify'

secretKey: The security key generated when the user applies for APIKey, e.g. : 22582BD0CFF14C41EDBF1AB98506286D

the signature algorithm is as follows:

Concatenate "timestamp", "method", "requestPath", and "body" as string
Encrypt the string using Hmac_SHA256 with secretKey
Base64 encode the Hmac_SHA256 output

Sign example sign=CryptoJS.enc.Base64.Stringify( CryptoJS.HmacSHA256(timestamp +'GET'+'/user/verify', secretKey) )

The request will expire 30 seconds after the timestamp. If your server time differs from the API server time, we recommended using the REST API to query the server time(noted it return milliseconds, while in websocket login you should use seconds) and then set the timestamp.

For the description of the signature method, refer to the verification section in the API overview

Steps to generate the final signature:

Step 1. Use the private key secretkey to encrypt the string to be signed with hmac sha256

Signature = hmac_sha256(secretkey, Message)

The second step is to base64 encode the Signature

Signature = base64.encode(Signature)

If login fails, it will automatically disconnect

Request format description

{
  "op": "login",
  "args": [{
    "apiKey": "<api_key>",
    "passphrase": "<passphrase>",
    "timestamp": "<timestamp>",
    "sign": "<sign>"
  }]
}

Request Example

{
    "op": "login",
    "args": [{
        "apiKey": "bg_573af5eca856acd91c230da294ce2105",
        "passphrase": "123456",
        "timestamp": "1538054050",
        "sign": "8RCOqCJAhhEh4PWcZB/96QojLDqMAg4qNynIixFzS3E="
    }]
} 

Successful Response Example

{
    "event": "login",
    "code": "0",
    "msg": ""
} 

Failure Response Example

{
    "event": "error",
    "code": "30005",
    "msg": "error"
}

Subscribe

Subscription Instructions

Request format description

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

WebSocket channels are divided into two categories: public and private channels.

Public channels -- includes

IndexPrice channel

etc -- do not require log in.

Private channels -- including

Cross Account Channel Isolate_account Channel Cross Orders Channel Isolate Orders Channel

etc -- require login.

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

Request Example

{
    "op": "subscribe",
    "args": [{
        "channel": "indexPrice",
        "instType": "mabl",
        "instId": "default"
    }]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, subscribe
args Array Yes List of subscribe channels
> instType String Yes Instrument typemabl
> channel String Yes Channel name, please refer to each examples below
> instId String Yes Instrument ID (default is full , not support symbol)

Example response

{
    "action": "snapshot",
    "arg": {
        "instType": "mabl",
        "channel": "indexPrice",
        "instId": "default"
    },
    "data": [{
        "baseCoin": "TRX",
        "indexPrice": "0.06362400",
        "key": "TRXUSDT",
        "quoteCoin": "USDT",
        "symbol": "TRXUSDT",
        "timestamp": "1679732272775",
        "version": "1679732272775"
    }]
}

Return parameters

Parameter Type Required Description
action String Yes Event,snapshot
arg Object No Subscribed channel
> instType String No Instrument typemabl
> channel String Yes Channel name, same as request
> instId String No Instrument ID
data Object Yes data
> baseCoin String Yes base coin
> indexPrice String Yes index price
> key String Yes key
> quoteCoin String Yes quote coin
> symbol String Yes symbol ID
> timestamp String Yes time
> version String Yes version
code String No Error code
msg String No Error message

Unsubscribe

Unsubscribe from one or more channels.

Request format description

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

Request Example

{
  "op": "unsubscribe",
  "args": [{
    "instType": "mabl",
    "channel": "indexPrice",
    "instId": "default"
  }]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, unsubscribe
args Array Yes List of channels to unsubscribe from
> instType String Yes Instrument typemabl
> channel String Yes Channel name, please refer to each examples below
> instId String Yes Instrument ID

Example response

{
  "event": "unsubscribe",
  "args": {
    "instType": "mabl",
    "channel": "indexPrice",
    "instId": "default"
  }
} 

Return parameters

Parameter Type Required Description
action String Yes Event,snapshot
arg Object Yes Unsubscribed channel
>instType String No Instrument typemabl
> channel String Yes Channel name
> instId String Yes Instrument ID
code String No Error Code
msg String No Error Message

public

margin index price

Get margin index price

Request Example

{
    "op": "subscribe",
    "args": [{
        "channel": "indexPrice",
        "instType": "mabl",
        "instId": "default"
    }]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, subscribe
args Array Yes List of subscribe channels
> instType String Yes Instrument typemabl
> channel String Yes Channel name, please refer to each examples below
> instId String Yes Instrument ID ('default', not support symbol)

Example response

{
    "action": "snapshot",
    "arg": {
        "instType": "mabl",
        "channel": "indexPrice",
        "instId": "default"
    },
    "data": [{
        "baseCoin": "TRX",
        "indexPrice": "0.06362400",
        "key": "TRXUSDT",
        "quoteCoin": "USDT",
        "symbol": "TRXUSDT",
        "timestamp": "1679732272775",
        "version": "1679732272775"
    }]
}

Return parameters

Parameter Type Required Description
action String Yes Event,snapshot
arg Object No Subscribed channel
> instType String No Instrument typemabl
> channel String Yes Channel name, same as request
> instId String No Instrument ID
data Object Yes data
> baseCoin String Yes base coin
> indexPrice String Yes index price
> key String Yes key
> quoteCoin String Yes quote coin
> symbol String Yes symbol ID
> timestamp String Yes timestamp, ms
> version String Yes version
code String No Error code
msg String No Error message

private

margin cross account assets

Whenever an account balance changes, a push is sent containing assets that may be changed due to events that generate balance changes, as described below.

Push frequency: push if available

Request Example

{
    "op": "subscribe",
    "args": [{
        "channel": "cross_account", 
        "instType": "mabl", 
        "instId": "default"             
    }]
}

Request parameters

Parameter Type Required Description
op String YES Operation, unsubscribe
args Array YES List of channels to subscribe to
> instType String YES Instrument typemabl
> channel String YES Channel name , cross_account
> instId String YES Instrument ID ('default', not support symbol)

Example response

{
    "action": "snapshot",
    "arg": {
        "instType": "mabl",
        "channel": "cross_account",
        "instId": "default"
    },
    "data": [{
        "available": "9628.96000000",
        "borrow": "0.00000000",
        "coin": "USDT",
        "frozen": "381.04000000",
        "id": "1020496190816575488",
        "interest": "0.00000000",
        "key": "1020496190816575488",
        "uTime": "1679728870940",
        "version": "1023369776782827520"
    }]
}

Return parameters

Parameter Type Required Description
action String YES Event,snapshot
arg Object NO Subscribed channel
> instType String YES Instrument typemabl
> channel String YES Channel name
> instId String NO Instrument ID
data Object NO data
> available String YES available amount
> borrow String YES borrow amount
> coin String YES coin name
> frozen String YES frozen amount
> id String YES id
> interest String YES interest
> key String YES key
> uTime String YES update time
> version String YES version
code String NO error code
msg String NO error message

Margin isolated account assets

Whenever an account balance changes, a push is sent containing assets that may be changed due to events that generate balance changes, as described below.

Push frequency: push if available

Request Example

{
    "op": "subscribe",
    "args": [{
        "channel": "isolate_account", 
        "instType": "mabl", 
        "instId": "default"             
    }]
}

Request parameters

Parameter Type Required Description
op String YES Operation, unsubscribe
args Array YES List of channels to unsubscribe from
> instType String YES Instrument typemabl
> channel String YES Channel name , isolate_account
> instId String YES Instrument ID ('default')

Example response

{
    "action": "snapshot",
    "arg": {
        "instType": "mabl",
        "channel": "isolate_account",
        "instId": "default"
    },
    "data": [{
        "available": "9628.96000000",
        "borrow": "0.00000000",
        "symbol": "BTCUSDT_SPBL",
        "coin": "USDT",
        "frozen": "381.04000000",
        "id": "1020496190816575488",
        "interest": "0.00000000",
        "key": "1020496190816575488",
        "uTime": "1679728870940",
        "version": "1023369776782827520"
    }]
}

Return parameters

Parameter Type Required Description
action String YES Event,snapshot
arg Object YES Subscribed channel
> instType String YES Instrument typemabl
> channel String YES Channel name
> instId String YES Instrument ID
data Object YES data
> available String YES available amount
> borrow String YES borrow amount
> symbol String YES symbol ID
> coin String YES coin name
> frozen String YES frozen amount
> id String YES id
> interest String YES interest
> key String YES key
> uTime String YES update time
> version String YES version
code String NO error code
msg String NO error message

First push: Full snapshot.

Incremental push: push incremental changes

cross orders

Subscribe order channel. There will be no data push For the first subscription. Snapshot data will be pushed only when events such as order placement, cancellation, or transaction are triggered.

Request Example

{
    "op": "subscribe",
    "args": [{
        "channel": "cross_orders",
        "instType": "mabl",     
        "instId": "BTCUSDT_SPBL"   
    }]
}

Request parameters

Parameter Type Required Description
op String YES Operation, subscribe
args Array YES List of channels to subscribe to
> instType String YES Instrument typemabl
> channel String YES Channel name , cross_orders
> instId String YES Instrument ID (must be symbol)

Example response

{
    "action": "snapshot",
    "arg": {
        "instType": "mabl",
        "channel": "cross_orders",
        "instId": "BTCUSDT_SPBL"
    },
    "data": [{
        "baseQuantity": "0.010000000",
        "cTime": "1679729291287",
        "clientOid": "70715854a52e4daaa84e2a1e52ddb01d",
        "fillPrice": "19055.000000000",
        "fillQuantity": "0.010000000",
        "fillTotalAmount": "190.550000000",
        "key": "1023424313350610944",
        "loanType": "autoLoan",
        "orderId": "1023424313350610944",
        "orderType": "limit",
        "price": "19055.000000000",
        "quoteAmount": "190.550000000",
        "side": "buy",
        "source": "web",
        "status": "full-fill",
        "symbol": "BTCUSDT",
        "timeInForce": "normal",
        "version": "1023424313640017920"
    }]
}


Return parameters

Parameter Type Required Description
action String YES Event,snapshot
arg Object NO Subscribed channel
> instType String YES Instrument typemabl
> channel String YES Channel name
> instId String NO Instrument ID
data Object NO data
> baseQuantity String YES base quantity
> cTime String YES order time
> clientOid String YES client oid
> fillPrice String YES fill price
> fillQuantity String YES fill quantity
> fillTotalAmount String YES fill total amount
> key String YES key
> loanType String YES loan type loanType
> orderId String YES order ID
> orderType String YES order type orderType
> price String YES order price
> quoteAmount String YES quote amount
> side String YES side (buy,sell) side
> status String YES order status status
> symbol String YES symbol ID
> source String YES source source
> timeInForce String YES normal force
> version String YES version
code String NO error code
msg String NO error message

isolate orders

Subscribe order channel. There will be no data push For the first subscription. Snapshot data will be pushed only when events such as order placement, cancellation, or transaction are triggered.

Request Example

{
    "op": "subscribe",
    "args": [{
        "channel": "isolate_orders",
        "instType": "mabl",     
        "instId": "BTCUSDT_SPBL"   
    }]
}

Request parameters

Parameter Type Required Description
op String YES Operation, unsubscribe
args Array YES List of channels to unsubscribe from
> instType String YES Instrument typemabl
> channel String YES Channel name , isolate_orders
> instId String YES Instrument ID BTCUSDT_SPBL (must be symbol)

Example response

{
    "action": "snapshot",
    "arg": {
        "instType": "mabl",
        "channel": "isolate_orders",
        "instId": "BTCUSDT_SPBL"
    },
    "data": [{
        "baseQuantity": "0.001000000",
        "cTime": "1679729228954",
        "clientOid": "c4c8c920b864415aa8b723d5e470dc5c",
        "fillPrice": "19055.000000000",
        "fillQuantity": "0.001000000",
        "fillTotalAmount": "19.055000000",
        "key": "1023424051902865408",
        "loanType": "autoLoan",
        "orderId": "1023424051902865408",
        "orderType": "limit",
        "price": "19055.000000000",
        "quoteAmount": "19.055000000",
        "side": "buy",
        "source": "web",
        "status": "full-fill",
        "symbol": "BTCUSDT",
        "timeInForce": "normal",
        "version": "1023424052343267328"
    }]
}

Return parameters

Parameter Type Required Description
action String YES Event,snapshot
arg Object NO Subscribed channel
> instType String YES Instrument typemabl
> channel String YES Channel name
> instId String NO Instrument ID
data Object NO data
> baseQuantity String YES base quantity
> cTime String YES order time
> clientOid String YES client oid
> fillPrice String YES fill price
> fillQuantity String YES fill quantity
> fillTotalAmount String YES fill total amount
> key String YES key
> loanType String YES loan type loanType
> orderId String YES order ID
> orderType String YES order type orderType
> price String YES order price
> quoteAmount String YES quote amount
> side String YES side (buy,sell) side
> status String YES order status status
> symbol String YES symbol ID
> source String YES source source
> timeInForce String YES normal force
> version String YES version
code String NO error code
msg String NO error message

RestAPI error code

Error message Error code http status code
00000 success! 400
40001 ACCESS_KEY cannot be empty 400
40002 ACCESS_SIGN cannot be empty 400
40003 Signature cannot be empty 400
40004 Request timestamp expired 400
40005 Invalid ACCESS_TIMESTAMP 400
40006 Invalid ACCESS_KEY 400
40007 Invalid Content_Type 400
40008 Request timestamp expired 400
40009 sign signature error 400
40010 Request timed out 400
40011 ACCESS_PASSPHRASE cannot be empty 400
40012 apikey/password is incorrect 400
40013 User status is abnormal 400
40014 Incorrect permissions, need {0} permissions 400
40015 System is abnormal, please try again later 400
40016 The user must bind the phone or Google 400
40017 Parameter verification failed {0} 400
00171 Parameter verification failed {0}{1} 400
00172 Parameter verification failed 400
40018 Invalid IP 400
40019 Parameter {0} cannot be empty 400
40020 Parameter {0} error 400
40021 User disable withdraw 400
40022 The business of this account has been restricted 400
40023 The business of this account has been restricted 400
40024 Account has been frozen 400
40025 The business of this account has been restricted 400
40026 User is disabled 400
40027 Withdrawals in this account area must be kyc 400
40028 This subUid does not belong to this account 400
40029 This account is not a Broker, please apply to become a Broker first 400
40031 The account has been cancelled and cannot be used again 400
40032 The Max of sub-account created has reached the limit 400
40033 This email has been bound 400
40034 Parameter {0} does not exist 400
50001 coin {0} does not support cross 400
50002 symbol {0} does not support isolated 400
50003 coin {0} does not support isolated 400
50004 symbol {0} does not support cross 400
40035 Judging from your login information, you are required to complete KYC first for compliance reasons. 400
40036 passphrase is error 400
40037 Apikey does not exist 400
40038 The current ip is not in the apikey ip whitelist 400
40039 FD Broker's user signature error 400
40040 user api key permission setting error 400
40041 User's ApiKey does not exist 400
40043 FD Broker does not exist 400
40045 The bound user cannot be an FD broker 400
40047 FD Broker binding related interface call frequency limit 400
40048 The user's ApiKey must be the parent account 400
40049 User related fields decrypt error 400
40051 This account is not a FD Broker, please apply to become a FD Broker first 400
40052 Security settings have been modified for this account. For the safety of your account, withdrawals are prohibited within 24 hours 400
40053 Value range verification failed: {0} should be between {1} 400
40054 The data fetched by {0} is empty 400
40055 subName must be an English letter with a length of 8 400
40056 remark must be length of 1 ~ 20 400
40057 Parameter {0} {1} does not meet specification 400
40058 Parameter {0} Only a maximum of {1} is allowed 400
40059 Parameter {0} should be less than {1} 400
40060 subNames already exists 400
40061 sub-account not allow access 400
40063 API exceeds the maximum limit added 400
40064 Sub-account creation failed, please check if there is a duplicate 400
40065 This subApikey does not exist 400
40066 This subUid does not belong to the account or is not a virtual sub-account 400
40067 sub-account create failed, please check if there is a duplicate 400
40068 Disable subaccount access 400
40069 The maximum number of sub-accounts created has been reached 400
40070 passphrase 8-32 characters with letters and numbers 400
40071 subName exist duplication 400
40072 symbol {0} is Invalid or not supported mix contract trade 400
40102 Symbol does not exist 400
40109 The data of the order cannot be found, please confirm the order number 400
40200 Server upgrade, please try again later 400
40301 Permission has not been obtained yet. If you need to use it, please contact customer service 400
40303 Can only query up to 20,000 data 400
40304 clientOid or clientOrderId length cannot greater than 50 400
40305 clientOid or clientOrderId length cannot greater than 64, and cannot be Martian characters 400
40306 Batch processing orders can only process up to 20 400
40308 The contract is being temporarily maintained 400
40309 The contract has been removed 400
40400 Status check abnormal 400
40401 The operation cannot be performed 400
40402 orderId or clientOId format error 400
40407 The query direction is not the direction entrusted by the plan 400
40408 Range error 400
40409 wrong format 400
40704 Can only check the data of the last three months 400
40705 The start and end time cannot exceed 90 days 400
40706 Wrong order price 400
40707 Start time is greater than end time 400
40708 client_oid duplicate 400
40709 There is no position in this position, and no automatic margin call can be set 400
40710 Abnormal account status 400
40711 Insufficient contract account balance 400
40712 Insufficient margin 400
40713 Cannot exceed the maximum transferable margin amount 400
40714 No direct margin call is allowed 400
40715 delegate count can not high max of open count 400
40716 This trading pair not support Cross Margin mode 400
40717 The number of closed positions cannot exceed the number of sheets held 400
40718 The entrusted price of Pingduo shall not be lower than the bursting price 400
40719 Flat empty entrustment price is not allowed to be higher than explosion price 400
40720 swap hand depth does not exist 400
40721 Market price list is not allowed at present 400
40722 Due to excessive price fluctuations and the insufficient market price entrusted cost, the opening commission is failed. 400
40723 The total number of unexecuted orders is too high 400
40724 Parameter is empty 400
40725 service return an error 400
40726 Cross margin not support Auto Margin Replenishment (AMR) 400
40727 Cross margin not support margin adjustment 400
40728 You’re log in as trader, please close position for current copy trade orders 400
40729 Failed to adjust the position, the current position or order or plan order 400
40730 There is currently a commission or a planned commission, and the leverage cannot be adjusted 400
40731 This product does not support copy trading 400
40732 Not currently a trader 400
40199 Traders are prohibited from calling the API 400
40733 The order closing has been processed 400
40734 Failed to place an order, the minimum number of traders to open a position {0} 400
40735 Long position take profit price should be greater than the average opening price 400
40736 Long position take profit price is greater than the current price 400
40737 The short position take profit price should be less than the average opening price 400
40738 The short position take profit price should be less than the current price 400
40739 The stop loss price of a long position should be less than the average opening price 400
40740 The stop loss price of a long position should be less than the current price 400
40741 The stop loss price of a short position should be greater than the average opening price 400
40742 The stop loss price of the short position should be greater than the current price 400
40743 The order is being closed and cannot be closed again 400
40744 The tracking order status is wrong 400
40745 This order is being commissioned, and liquidation is not supported temporarily 400
40746 The current maximum number of positions that can be closed is {0}, if you exceed the number, please go to the current order to close the position 400
40747 The bonus is not allowed to hold two-way positions 400
40748 The commission price is higher than the highest bid price 400
40749 The commission price is lower than the lowest selling price 400
40750 The plan commission for this contract has reached the upper limit 400
40751 The contract's stop profit and stop loss order has reached the upper limit 400
40752 You are disabled for current business, if you have any questions, please contact customer service 400
40753 The contract transaction business is disabled, if you have any questions, please contact customer service 400
40754 balance not enough 400
40755 Not enough open positions are available. 400
40756 The balance lock is insufficient. 400
40757 Not enough position is available. 400
40758 The position lock is insufficient. 400
40759 No assets 400
40760 Account abnormal status 400
40761 The total number of unfilled orders is too high 400
40762 The order size is greater than the max open size 400
40763 The number of orders cannot exceed the maximum amount of the corresponding gear 400
40764 The remaining amount of the order is less than the current transaction volume 400
40765 The remaining volume of the position is less than the current transaction volume 400
40766 The number of open orders is less than this transaction volume 400
40767 Position does not exist when opening a position 400
40768 Order does not exist 400
40769 Reject order has been completed 400
40770 The settlement or fee currency configuration was not found. 400
40771 When there is a gap, you cannot have a position closing order. 400
40772 The account does not exist 400
40773 Closed positions can only occur in two-way positions. 400
40774 The order type for unilateral position must also be the unilateral position type. 400
40775 The market-making account can only be a unilateral position type. 400
40776 Error creating order. 400
40777 Cancel order error. 400
40778 Coin pair {0} does not support {1} currency as margin 400
40779 Please check that the correct delegateType is used 400
40780 There are multiple risk handling records for the same symbolId at the same time 400
40781 The transfer order was not found 400
40782 Internal transfer error 400
40783 No gear found 400
40784 Need to configure modify depth account 400
40785 Need to configure draw line account 400
40786 Duplicate clientOid 400
40787 The price step does not match 400
40788 Internal batch transfer error 400
40789 The tokenId is duplicated in the configuration item 400
40790 Duplicate symbolCode in configuration item 400
40791 The baseToken or quoteToken of symbolCode does not exist 400
40792 The symbol in the configuration item is duplicated 400
40793 The symbolCode of BusinessSymbol does not exist 400
40794 The supportMarginToken of BusinessSymbol is not configured 400
40795 The transaction is suspended due to settlement or maintenance reasons 400
40796 The adjusted leverage is not within the appropriate range 400
40797 Exceeded the maximum settable leverage 400
40798 Insufficient contract account balance 400
40799 Cannot be less than the minimum transfer amount 400
40800 Insufficient amount of margin 400
40801 Cannot exceed the maximum transferable deposit amount 400
40802 Position is zero and direct margin call is not allowed 400
40803 The leverage is reduced and the amount of margin call is incorrect 400
40804 The number of closed positions cannot exceed the number of positions held 400
40805 Unsupported operation 400
40806 Unsupported currency 400
40807 The account does not exist 400
40808 Parameter verification exception {0} 400
40809 Execution price parameter verification exception 400
40810 Triggered price parameter verification exception 400
40811 The parameter {0} should not be null 400
40812 The condition {0} is not met 400
40813 The parameter {0} must have a value and cannot be empty 400
40814 No change in leverage 400
40815 The order price is higher than the highest bid price 400
40816 The order price is lower than the lowest selling price 400
40817 The current order status cannot be cancelled 400
40818 The current order type cannot be cancelled 400
40819 The order does not exist! 400
40820 The order price for closing a long position is not allowed to be lower than the liquidation price 400
40821 The closing order price cannot be higher than the liquidation price 400
40822 The contract configuration does not exist 400
40823 The transaction or reasonable marked price does not exist 400
40824 Currently, it is not allowed to list market orders 400
40825 Contract opponent depth does not exist 400
40826 Due to excessive price fluctuations, the market order cost is insufficient, and the position opening order failed. 400
40827 The bonus is not allowed to hold two-way positions 400
40828 Special market making accounts cannot manually place orders 400
40829 The take profit price of a long position should be greater than the average open price 400
40830 The take profit price of the long position should be greater than the current price 400
40831 The short position take profit price should be less than the average open price 400
40832 The take profit price of short positions should be less than the current price 400
40833 The stop loss price of a long position should be less than the average opening price 400
40834 The stop loss price of the long position should be less than the current price 400
40835 The stop loss price of the short position should be greater than the average opening price 400
40836 The stop loss price of the short position should be greater than the current price 400
40837 There is no position in this position, so stop-profit and stop-loss orders cannot be made 400
40838 There is no position in this position, and automatic margin call cannot be set 400
40839 The automatic margin call function of this contract has been suspended 400
40840 Duplicate shard market making account 400
40841 Online environment does not allow execution 400
40842 Current configuration does not allow adjustment, please try again later 400
40843 no_datasource_key_exists 400
40844 This contract is under temporary maintenance 400
40845 This contract has been removed 400
40846 Status verification abnormal 400
40847 The operation cannot be performed 400
40848 Cannot open a copy transaction if there is a position 400
40849 This user already has an ongoing copy 400
40850 The copy is in progress, the balance cannot be transferred 400
40851 Account status is wrong, cannot end copying 400
40852 There are unfilled orders, cannot end the copy 400
40853 There is an unexecuted plan order, cannot end the copy 400
40854 This product does not support copy trading 400
40855 The user has ended copying and cannot end copying again 400
40856 Data abnormal 400
40857 Document number error 400
40858 Error tracking order status 400
40859 This order is being closed and cannot be closed again 400
40860 The trader does not exist and cannot be set to follow 400
40861 The trader has been disabled and cannot be set to follow 400
40862 Please cancel the current order 400
40863 Please cancel the current plan 400
40864 Please close the current position with orders 400
40865 This order is being commissioned, and it is not currently supported to close the position 400
40866 You are currently a trader, please close the position under the current order 400
40867 Currently the maximum number of positions that can be closed is {0}, please go to the current order to close the position if the amount exceeds 400
40868 You are currently a trader and currently do not support liquidation through planned orders 400
40869 You are currently a trader and currently do not support modification of leverage 400
40870 You are currently copying an order and currently do not support modifying the leverage 400
40871 The leverage does not meet the configuration, and you cannot become a trader 400
40872 Failed to adjust position, currently holding position or order or plan order 400
40873 The account has a margin and needs to be transferred out 400
40874 Whole position mode does not support automatic margin call 400
40875 Whole position mode does not support margin adjustment 400
40876 Too many tracking orders 400
40877 Too many follow-up orders 400
40878 The contract index data is abnormal. In order to avoid causing your loss, please try again later. 400
40879 The risk is being processed, and the funds cannot be adjusted. 400
40880 The risk is being processed and the leverage cannot be adjusted. 400
40881 There is currently an order, or an order is planned, and the leverage cannot be adjusted. 400
40882 You are currently a trader and you cannot switch to the full position mode 400
40883 When the currencies are mixed, it cannot be adjusted to the warehouse-by-warehouse mode 400
40884 When a one-way position is held, it cannot be adjusted to a position-by-position mode 400
40885 In the case of position by position mode, it cannot be adjusted to one-way position 400
40886 The automatic margin call cannot be adjusted in the full position mode 400
40887 Failed to place the order, the number of single lightning open positions is at most {0} 400
40888 Failed to place the order, the maximum amount of single lightning closing is {0} 400
40889 The plan order of this contract has reached the upper limit 400
40890 The order of stop-profit and stop-loss for this contract has reached the upper limit 400
40891 Insufficient position, can not set take profit or stop loss 400
40892 Failed to place the order, the minimum number of positions opened by the trader is {0} 400
40893 Unable to update the leverage factor of this position, there is not enough margin! 400
40894 The documentary closing has been processed 400
40895 The preset price does not match the order/execution price 400
40896 The default stop profit and stop loss has been partially fulfilled and cannot be modified 400
40897 The system experience gold account does not exist 400
40898 The system experience gold account balance is insufficient 400
40899 The number of stored users exceeds the limit 400
40900 The system experience gold account is inconsistent 400
40901 The contract experience fund balance is insufficient 400
40902 Future time is not allowed 400
40903 Failed to obtain leverage information 400
40904 Failed to collect funds 400
40905 Failed to collect user funds 400
40906 Failed to pay user funds 400
40907 The payment cannot be transferred 400
40908 Concurrent operation failed 400
40909 Transfer processing 400
40910 Operation timed out 400
40911 Request timestamp expired 400
40912 single cancel cannot exceed 50 400
40913 {0} must be passed one 400
40914 Trader the maximum leverage can use is {0} 400
40915 Long position take profit price please > mark price 400
40916 The business of this account has been restricted 400
40917 Stop price for long positions please < mark price {0} 400
40918 Traders open positions with orders too frequently 400
40919 This function is not open yet 400
40920 Position or order exists, the position mode cannot be switched 400
40921 The order size cannot exceed the maximum size of the positionLevel 400
40922 Only work order modifications are allowed 400
40923 Order size and price have not changed 400
40924 orderId and clientOid must have one 400
40925 price or size must be passed in together 400
43013 Take profit price needs> current price 400
43014 Take profit price needs to be <current price 400
43015 Stop loss price needs to be <current price 400
43016 Stop loss price needs to be> current price 400
43017 You are currently a trader and currently do not support liquidation through planned orders 400
43020 Stop profit and stop loss order does not exist 400
43021 The stop-profit and stop-loss order has been closed 400
43022 Failed to trigger the default stop loss 400
43023 Insufficient position, can not set profit or stop loss 400
43024 Take profit/stop loss in an existing order, please change it after canceling all 400
43025 Plan order does not exist 400
43026 The planned order has been closed 400
43027 The minimum order value {0} is not met 400
43028 Please enter an integer multiple of {0} for price 400
43029 The size of the current Order > the maximum number of positions that can be closed 400
43030 Take profit order already existed 400
43031 Stop loss order already existed 400
43032 rangeRate is smaller than {0} 400
43033 Trailing order does not exist 400
43034 The trigger price should be ≤ the current market price 400
43035 The trigger price should be ≥ the current market price 400
43036 Trader modify tpsl can only be operated once within 300ms 400
43037 The minimum order amount allowed for trading is {0} 400
43038 The maximum order amount allowed for trading is {0} 400
43039 Maximum price limit exceeded {0} 400
43040 Minimum price limit exceeded {0} 400
43041 Maximum transaction amount {0} 400
43042 Minimum transaction amount {0} 400
43043 There is no position 400
43044 The follow order status error 400
43045 The trader is ful 400
43046 User does not exist 400
43047 Followers are not allowed to follow again within xx minutes after being removed, please try again later! 400
43048 The symbol is null 400
43049 Margin coin is not allowed 400
43050 Leverage exceeds the effective range 400
43051 Maximum limit exceeded 400
43052 Follow order count can not less than {0} 400
43053 The copy ratio cannot exceed {0} 400
43054 The copy ratio cannot be less than {0} 400
43055 The take loss ratio must be between {0}-{1} 400
43056 The take profit ratio must be between {0}-{1} 400
43057 It is not allowed to bring orders or copy orders between sub-accounts 400
43058 Parameter verification failed 400
43059 Request failed, please try again 400
43060 Sort rule must send 400
43061 Sort Flag must send 400
43062 not to follow 400
43063 Can not follow trade with yourself 400
43064 Tracking order status error 400
43065 Tracking No does not exist 400
43066 operation failed 400
43067 The loaded data has reached the upper limit, and the maximum support for loading {0} data 400
43068 The status of the current follower is abnormal and removal is not allowed for now 400
43069 A follower account can only be removed when its equity is lower than {0} USDT 400
43001 The order does not exist 400
43002 Pending order failed 400
43003 Pending order failed 400
43004 There is no order to cancel 400
43005 Exceed the maximum number of orders 400
43006 The order quantity is less than the minimum transaction quantity 400
43007 The order quantity is greater than the maximum transaction quantity 400
43008 The current order price cannot be less than {0}{1} 400
43009 The current order price exceeds the limit {0}{1} 400
43010 The transaction amount cannot be less than {0}{1} 400
43011 The parameter does not meet the specification {0} 400
43012 Insufficient balance 400
41103 param {0} error 400
41101 param {0} error 400
41113 symbol is offline 400
41114 The current trading pair is under maintenance, please refer to the official announcement for the opening time 400
42013 transfer fail 400
42014 The current currency does not support deposit 400
42015 The current currency does not support withdrawal 400
42016 symbol {0} is Invalid or not supported spot trade 400
41100 error {0} 400
43111 param error {0} 400
43112 The amount of coins withdrawn is less than the handling fee {0} 400
43113 The daily limit {0} is exceeded in a single transaction 400
43114 Withdrawal is less than the minimum withdrawal count {0} 400
43115 The current trading pair is opening soon, please refer to the official announcement for the opening time 400
43116 This chain requires a tag to withdraw coins 400
43117 Exceeds the maximum amount that can be transferred 400
43118 clientOrderId duplicate 400
43119 Trading is not open 400
43120 symbol is not open trade 400
43121 Withdrawal address cannot be your own 400
43122 The purchase limit of this currency is {0}, and there is still {1} left 400
43123 param error {0} 400
43124 withdraw step is error 400
43125 No more than 8 decimal places 400
43126 This currency does not support withdrawals 400
43127 Sub transfer not by main account, or main/sub relationship error 400
43128 Exceeded the limit of the maximum number of orders for the total transaction pair {0} 400
45034 clientOid duplicate 400
47001 Currency recharge is not enabled 400
47002 Address verification failed 400
45001 Unknown error 400
45002 Insufficient asset 400
45003 Insufficient position 400
45004 Insufficient lock-in asset 400
45005 Insufficient available positions 400
45006 Insufficient position 400
45007 Insufficient lock position 400
45008 No assets 400
45009 The account is at risk and cannot perform trades temporarily 400
45010 The number of orders cannot exceed the maximum amount of the corresponding leverage 400
45011 Order remaining volume < Current transaction volume 400
45012 Remaining volume of position < Volume of current transaction 400
45013 The number of open orders < Current transaction volume 400
45014 Position does not exist during opening 400
45017 Settlement or the coin for transaction configuration not found 400
45018 In the case of a netting, you cannot have a liquidation order 400
45019 Account does not exist 400
45020 Liquidation can only occur under two-way positions 400
45021 When one-way position is held, the order type must also be one-way position type 400
45023 Error creating order 400
45024 Cancel order error 400
45025 The currency pair does not support the currency as a margin 400
45026 Please check that the correct delegateType is used 400
45031 The order is finalized 400
45035 Price step mismatch 400
45043 Due to settlement or maintenance reasons, the trade is suspended 400
45044 Leverage is not within the suitable range after adjustment 400
45045 Exceeds the maximum possible leverage 400
45047 Reduce the leverage and the amount of additional margin is incorrect 400
45051 Execution price parameter verification is abnormal 400
45052 Trigger price parameter verification anbormal 400
45054 No change in leverage 400
45055 The current order status cannot be cancelled 400
45056 The current order type cannot be cancelled 400
45057 The order does not exist! 400
45060 TP price of long position > Current price {0} 400
45061 TP price of short position < Current price {0} 400
45062 SL price of long position < Current price {0} 400
45064 TP price of long position > order price {0} 400
45065 TP price of short position < order price {0} 400
45066 SL price of long position < order price {0} 400
45067 SL price of short position > order price {0} 400
45068 There is no position temporarily, and the order of TP and SL cannot be carried out 400
45075 The user already has an ongoing copy trade 400
45082 Copy trade number error 400
45089 You are currently copy trading, leverage cannot be changed 400
45091 Too many tracking orders 400
45097 There is currently an order or a limit order, and the leverage cannot be adjusted 400
45098 You are currently a trader and cannot be switched to the full position mode 400
45099 When there are different coins, it cannot be adjusted to Isolated Margin mode 400
45100 When a one-way position is held, it cannot be adjusted to the Isolated Margin mode 400
45101 In Isolated Margin mode, it cannot be adjusted to a one-way position 400
45102 In the full position mode, the automatic margin call cannot be adjusted 400
45103 Failed to place the order, the maximum amount of single flash opening position is %s 400
45104 Failed to place the order, the maximum amount of single flash closing position is %s 400
45106 copy trade liquidation has been processed 400
45107 API is restricted to open positions. If you have any questions, please contact our customer service 400
45108 API is restricted to close position. If you have any questions, please contact our customer service 400
45109 The current account is a two-way position 400
45110 less than the minimum amount {0} USDT 400
45111 less than the minimum order quantity 400
45112 more than the maximum order quantity 400
45113 Maximum order value limit triggered 400
45114 The minimum order requirement is not met 400
45115 The price you enter should be a multiple of {0} 400
45116 The count of positions hold by the account exceeds the maximum count {0} 400
45117 Currently holding positions or orders, the margin mode cannot be adjusted 400
45118 Reached the upper limit of the order of transactions (the current number of order + the current number of orders) {0} 400
45119 This symbol does not support position opening operation 400
45120 size > max can open order size 400
45121 The reasonable mark price deviates too much from the market, and your current leveraged position opening risk is high 400
45122 Short position stop loss price please > mark price {0} 400
45123 Insufficient availability, currently only market orders can be placed 400
45124 Please edit and submit again. 400
45125 Order cancellation is unavailable for inactive orders. Please cancel parent order and place a new order. 400
45126 Order cancellation is unavailable for inactive orders. Please cancel parent order and place a new order. 400
45127 Position brackets disabled TP SL 400
45128 Position brackets disabled modify qty 400
45129 Cancel order is too frequent, the same orderId is only allowed to be canceled once in a second 400
49000 apiKey and userId mismatch 400
49001 not custody account, operation deny 400
49002 missing http header: ACCESS-BROKER-KEY or ACCESS-BROKER-SIGN 400
49003 illegal IP, access deny 400
49004 illegal ACCESS-BROKER-KEY 400
49005 access deny: sub account 400
49006 ACCESS-BROKER-SIGN check sign fail 400
49007 account is unbound 400
49008 account is bound 400
49009 clientUserId check mismatch with the bound user ID 400
49010 account: {0} still have assets: {1} 400
49011 kyc must be done before bind 400
49020 unsupported coin 400
49021 operation accepted 400
49022 access deny 400
49023 insufficient fund 400
49024 {0} decimal precision error 400
49025 Parameter mismatch with the initial requestId, request body: {0} 400
49026 {0} maximum {1} digits 400
49030 custody account, operation deny 400
49040 Unknown Error 400
60001 StartTime not empty 400
60002 MerchantId not empty 400
60003 Not found the p2p order 400
60004 Not found the p2p advertisement 400
60005 Not found the p2p merchant 400
70001 Activity ID not correct 400
70002 rankType error 400
40000 Bitget is providing services to many countries and regions around the world and strictly adheres to the rules and regulatory requirements of each country and region. According to the relevant regulations, Bitget is currently unable to provide services to your region (Mainland China) and you do not have access to open positions.Apologies for any inconvenience caused! 400
48001 Parameter validation failed {0} 400
48002 Missing request Parameter 400
46013 This symbol limits the selling amount{0},Remaining{0} 400
40404 Request URL NOT FOUND 400
50010 Unknown error 400
50012 The account has been suspended or deleted. Please contact our Customer Support 400
50013 The account has been suspended and deleted. Please contact our Customer Support 400
50019 The user is forbidden to trade. 400
50059 This currency cannot be transferred 400
50052 The asset balance will be less than 0 after transferring 400
50048 The maximum number of orders is exceeded 400
50046 The price is too low 400
50047 The price is too high 400
50026 The trading pair is currently unavailable 400
50025 The trading pair is currently unavailable 400
50016 The number of open orders is smaller than the minimum limit of the trading pair 400
50017 The number of open orders is bigger than the maximum limit of the trading pair 400
50023 The account has been suspended due to abnormal behavior. Please contact our Customer Support is you have any questions. 400
50031 System error 400
50044 The system account is not found 400
50049 The request body of the system user is empty 400
50050 The system loan collection has been done 400
50027 The trading pair is suspended for maintenance 400
50030 The trading pair will soon be available 400
50029 The trading pair has no order price 400
50028 The trading pair is removed 400
50040 The repayment amount must be more than 0 400
50042 The repayment amount must be more than the interest 400
50041 The repayment amount must be less than your available balance 400
50051 The user in reconciliation is not in the system (cache) 400
50024 The trading pair does not exist 400
50011 Parameter verification error 400
50053 The amount is less than 0 when making loan repayment 400
50056 The amount is less than 0 when paying liquidation fees 400
50054 The amount is less than 0 when making interest repayment 400
50055 The amount is less than 0 when paying trading fees 400
50033 The topic of the websocket query does not exist 400
50057 The amount is less than 0 when paying the excessive loss resulted from liquidation 400
50032 The currency does not exist 400
50036 The loan configuration does not exist 400
50037 This currency cannot be borrowed 400
50038 The system limit is exceeded 400
50034 The borrowing amount must be over 0.00000001 400
50035 The maximum borrowing amount is exceeded 400
50020 Insufficient balance 400
50045 Insufficient locked asset 400
50015 Currently, sub-accounts cannot engage in margin trading 400
50021 The margin trading account does not exist 400
50022 The account is liquidated 400
50014 The account already exists 400
50060 Duplicated clientOid 400
50058 After the profit is used to cover the excessive loss resulted from liquidation, the balance will be less than 0 400
50039 The currency and the trading pair do not match 400
50018 The price must be 0 or higher 400
50043 Unknown transaction type 400
50061 There is a problem with the parameter you requested 400
50062 The order status is cancelled or fullFill 400
50063 Token precision must less than or equal to eight 400
50064 Your account is temporarily frozen. Please contact customer support if you have any questions 400
50065 symbol_off_shelf 400
50066 Position closing, please try again later 400
31001 The user is not a trader 400
31002 Condition {0} is not satisfied 400
31003 Parameter {0} must have a value, cannot be empty 400
31004 Take profit price must be > current price 400
31005 Stop loss price must be < current price 400
31006 The order is in the process of being placed, closing of the position is not supported at the moment 400
31007 Order does not exist 400
31008 There is no position in this position, no take profit or stop loss order can be made 400
31009 Tracking order status error 400
31010 Clear user prompt 400
31011 The order is not completely filled and the order is closed prompting the cancellation of the commission 400
31012 Pullback greater than {0} 400
31013 Pullback range is less than {0} 400
31014 Stop gain yield greater than {0} 400
31015 Stop loss yield less than {0} 400
31016 Batch execution exception 400
31017 Maximum price limit exceeded {0} 400
31018 Minimum price change of {0} 400
31019 Support trading currency pair does not exist 400
31020 Business is restricted 400
31021 The currency pair is not available for trading, please select another currency pair 400
31022 Minimum order size for this trading area is not met, please select another trading area 400
31023 Ending order processing 400
31024 The order is not completely filled, please go to \"Spot trading\"-\"Current orders\" to cancel the order and then sell or close the operation! 400
31025 The user is not a trader 400
31026 The user is not exist 400
31027 Operation failed, please try again 400
31028 Parameter verification failed 400
31029 User is not existed 400
31030 Chosen trading pair is empty 400
31031 You’re log in as trader,can not follow trade 400
31032 Can not follow trade with yourself 400
31033 Fail to remove 400
31034 This trader’s no. of follower has reached limit, please select other trader 400
31035 Follow order ratio can not less than{0} 400
31036 Follow order ratio can not greater than{0} 400
31037 Follow order count can not less than{0} 400
31038 Exceeds max. limit 400
31039 Can not set reminder as your Elite Trader status has been revoked 400
31040 T/P ratio must between {0}%%-{1}%% 400
31041 S/L ratio must between {0}%%-{1}%% 400
31042 The status of your Elite Trader has been suspended, please contact online customer service to resume. 400
31043 Your copy trade follower cap is too high. Please contact customer support to lower it if you want to enable this function! 400
31044 You are applying to become a trader now. Copying trade is not allowed 400
31045 The max. quantity for TP/SL is {0}. For any quantity exceeding this limit, please operate under “Initiated Copies”. 400
31046 No copy trade relationship is allowed between a parent account and its sub-account 400
31047 No copying is allowed within {0} minutes after the copier has been removed. Please try again later. 400
31048 Only this trader's referrals are allowed to follow this trader at the moment. Please create an account with the trader's referral link! 400
31049 The trader's status is abnormal or has been revoked, and cannot be viewed at this time! 400
31050 This trader UID is already set for the region. 400
31051 traderUserId error 400
31052 Cannot set trading symbol that have not been opened by traders. 400
31053 executePrice cannot exceed triggerPrice 的{0} 400
31054 No order to cancel 400
20001 startTime should be less than endTime 400
22001 No order to cancel 400
22002 No position to close 400
22003 modify price and size, please pass in newClientOid 400
22004 This symbol {0} not support API trade 400
22005 This symbol does not support cross mode 400
22006 limit price > risk price 400
22007 limit price < risk price 400
22008 market price > risk price 400
22009 market price < risk price 400
22010 Please bind ip whitelist address 400
40100 Due to regulatory requirements, Hong Kong IPs are required to complete identity verification first 400
40101 Please complete KYC 400
00001 startTime and endTime interval cannot be greater than 366 days 400
12001 {0} can be used at most 400
12002 Current currency {0}, limit net sell value {1} USD 400
12003 Current currency {0}, limit net buy value {1} USD 400
13001 Withdraw is too frequent 400
13002 Currency does not exist 400
13003 Withdrawal exceeds the monthly limit 400
13004 Your remaining withdrawal amount{0} 400
13005 Failed to generate address 400
60006 Parameter error 400
60007 upload image cannot exceed 5M 400
60008 The image format must be [". jpg", ". jpeg", ". png"] 400
60009 The image format error 400
60010 upload error 400
60011 Ordinary users can not post ads 400
60012 Please change your status from offline to online before posting your ads! 400
60013 Insufficient balance 400
60014 Fiat info not found 400
60015 Digital currency info not found 400
60016 Only supports publish CNY advertisement 400
60017 Not support publish CNY advertisement 400
60018 Your KYC certification only supports publishing {0} 400
60019 Post failed. Unable to obtain preference price 400
60020 advertisement type error 400
60021 Payment method is empty 400
60022 Trading amount incorrect 400
60023 Beyond fiat limit ({0}-{1}) 400
60024 Fund reconciliation errors 400
60025 The remark length cannot be longer than the configuration length 400
60026 Exclusive country error 400
60027 Payment time limit error 400
60028 Payment method error 400
60029 publish advertisement error 400
60030 status error 400
60031 The advertisement number is too long 400
60032 The advertisement not exist 400
60033 Posted ad amount incorrect 400
60034 Number of images attached in the remark cannot exceed the allocation limit. 400
60035 Edit advertisement error 400
60036 payTimeLimit cannot be empty 400
60037 Post failed. Price is significantly deviated from preference price 400
60038 Post failed. Incorrect floating rate 400
60039 User does not exist 400
60040 Unauthorized access not supported 400
60041 Edit advertisement price error 400
60042 limitPrice not empty 400
60043 The advertisement status update fail 400
60044 The advertisement status in editing can be edited 400
60045 Exceeding the number of advertisement that can be published 400
60046 priceValue not empty 400
60047 userPayMethodId not empty 400
13007 The current currency is {0}, and the net purchase value of {1} USD is limited within 24 hours, and the net purchase value of {2} USD is also allowed for {3} 400
11000 withdraw address is not in addressBook 400
40103 based on your IP address , it appears that you are located in a country or region where we are currently unable to provide services 400
40104 Unable to withdraw to this account Please make sure this is a valid and verified account 400
30001 Minimum Price Change {0} % 400
40928 Risk control, currently your max open size is {0} {1}. The size was calculated with all the main-sub accounts 400
47003 Withdraw address is not in addressBook 400
13008 A single withdrawal exceeds the maximum limit 400
13009 Exceeds withdrawal daily limit 400
32038 The sell price cannot be lower than the trigger price percent{0} 400

WebSocket error code

Error Message Error Code
Channel does not exist 30001
Illegal request 30002
Invalid op 30003
User needs to log in 30004
Login failed 30005
request too many 30006
request over limit,connection close 30007
Invalid ACCESS_KEY 30011
Invalid ACCESS_PASSPHRASE 30012
Invalid ACCESS_TIMESTAMP 30013
Request timestamp expired 30014
Invalid signature 30015