Skip to content

Spot trading

Base URL for all endpoints in this module: https://openapi.bitbaby.com/spot/open

Full URL = {baseurl}{requestPath}, e.g. https://openapi.bitbaby.com/spot/open/sapi/v1/order.

When signing, requestPath must be /sapi/v1/... only — do not include the gateway prefix /spot/open. See General information → Signed endpoints.

General

Security: NONE

Endpoints below require no API key or signature.

Test connectivity

GET /sapi/v1/ping

Checks REST API connectivity.

200

json
{}

Server time

GET /sapi/v1/time

Returns server time. Call once before placing orders to align your local clock.

200

json
{
    "timezone": "GMT+08:00",
    "serverTime": 1595563624731
}

Symbols

GET /sapi/v1/symbols

Lists tradable symbols with precision and minimum-size metadata.

200

json
{
    "symbols": [
        {
            "symbol": "btcusdt",
            "baseAsset": "BTC",
            "quoteAsset": "USDT",
            "pricePrecision": 2,
            "quantityPrecision": 8,
            "limitPriceMin": "0.01",
            "limitVolumeMin": "0.0001",
            "marketBuyMin": "10",
            "marketSellMin": "0.0001"
        }
    ]
}

Response

FieldTypeExampleDescription
symbolstringbtcusdtSymbol (lowercase)
baseAssetstringBTCBase asset
quoteAssetstringUSDTQuote asset
pricePrecisioninteger2Price decimals
quantityPrecisioninteger8Quantity decimals
limitPriceMinstring0.01Min price tick for limit orders
limitVolumeMinstring0.0001Min size for limit orders
marketBuyMinstring10Min notional for market buy (quote)
marketSellMinstring0.0001Min size for market sell

Market data

Security: NONE

Market endpoints below require no API key or signature.

Order book depth

GET /sapi/v1/depth

Query parameters

NameTypeDescription
symbol*stringSymbol, e.g. BTCUSDT
limitintegerDefault 100; max 100

200

json
{
  "time": 1595563624731,
  "bids": [
    ["3.90000000", "431.00000000"],
    ["4.00000000", "431.00000000"]
  ],
  "asks": [
    ["4.00000200", "12.00000000"],
    ["5.10000000", "28.00000000"]
  ]
}

Each level is [price, quantity], sorted best price first.

24h ticker

GET /sapi/v1/ticker

24-hour rolling statistics.

Query parameters

NameTypeDescription
symbol*stringSymbol, e.g. BTCUSDT

200

json
{
    "high": "9279.0301",
    "vol": "1302",
    "last": "9200",
    "low": "9279.0301",
    "rose": "0",
    "time": 1595563624731
}

Response

FieldTypeDescription
timelongTimestamp (ms)
highstringHigh
lowstringLow
laststringLast price
volstring24h volume
rosestring24h change

Recent trades

GET /sapi/v1/trades

Query parameters

NameTypeDescription
symbol*stringSymbol, e.g. BTCUSDT
limitintegerDefault 200

200

json
[
    {
        "price": "3.00000100",
        "qty": "11.00000000",
        "time": 1499865549590,
        "side": "BUY"
    }
]

Response

FieldTypeDescription
pricestringTrade price
qtystringQuantity
timelongTrade time (ms)
sidestringAggressor side, BUY/SELL

K-lines / candles

GET /sapi/v1/klines

Query parameters

NameTypeDescription
symbol*stringSymbol, e.g. BTCUSDT
interval*stringOne of 1min, 5min, 15min, 30min, 60min, 1day, 1week, 1month
limitintegerDefault 100; max 300

200

json
[
    {
        "idx": 1594640340,
        "open": "6228.77",
        "close": "6228.77",
        "high": "6228.77",
        "low": "6228.77",
        "vol": "111"
    }
]

Response

FieldTypeDescription
idxlongOpen time (seconds)
openstringOpen
closestringClose
highstringHigh
lowstringLow
volstringVolume

Trading

Security: TRADE

Trading endpoints require API key + signature. Every endpoint below requires the same headers; we don't repeat them in each section.

HeaderTypeDescription
X-CH-APIKEY*stringAPI key
X-CH-TS*stringTimestamp (ms)
X-CH-SIGN*stringHMAC-SHA256 hex
Content-Type*stringapplication/json

Place order

POST /sapi/v1/order

Rate limit: 100 req / 2s

Request body

NameTypeDescription
symbol*stringSymbol, e.g. BTCUSDT
volume*numberOrder quantity
side*stringBUY / SELL
type*stringLIMIT / MARKET
pricenumberRequired for LIMIT orders
newClientOrderIdstringClient order id (you must keep it unique)
recvWindowintegerRecv window (ms)

200

json
{
    "symbol": "LXTUSDT",
    "orderId": "150695552109032492",
    "clientOrderId": "157371322565051",
    "transactTime": "1573713225668",
    "price": "0.005452",
    "origQty": "110",
    "executedQty": "0",
    "status": "NEW",
    "type": "LIMIT",
    "side": "SELL"
}

Response

FieldTypeDescription
orderIdstringSystem order id
clientOrderIdstringClient order id
symbolstringSymbol
transactTimestringCreate time (ms)
pricestringPrice
origQtystringOrder quantity
executedQtystringFilled quantity
typestringLIMIT / MARKET
sidestringBUY / SELL
statusstringNEW / PARTIALLY_FILLED / FILLED / CANCELED / REJECTED

Test new order

POST /sapi/v1/order/test

Same parameters as POST /sapi/v1/order but the order is not sent to the matching engine. Use it to validate signatures and parameters.

200

json
{}

Cancel order

POST /sapi/v1/cancel

Rate limit: 100 req / 2s

Request body

NameTypeDescription
symbol*stringSymbol, e.g. BTCUSDT
orderId*stringOrder id
newClientOrderIdstringClient order id

200

json
{
    "symbol": "BHTUSDT",
    "clientOrderId": "0",
    "orderId": "499890200602846976",
    "status": "CANCELED"
}

Batch place

POST /sapi/v1/batchOrders

Rate limit: 50 req / 2s; max 10 orders per batch

Request body

NameTypeDescription
symbol*stringSymbol, e.g. BTCUSDT
orders*arrayArray of orders, max 10

orders[] fields

FieldTypeDescription
pricenumberPrice (required for LIMIT)
volumenumberQuantity
sidestringBUY / SELL
batchTypestringLIMIT / MARKET
newClientOrderIdstringPer-order client id (optional)

200

json
{
    "ids": [
        "165964665990709251",
        "165964665990709252",
        "165964665990709253"
    ]
}

Batch cancel

POST /sapi/v1/batchCancel

Rate limit: 50 req / 2s; max 10 orders per call

Request body

NameTypeDescription
symbol*stringSymbol, e.g. BTCUSDT
orderIds*arrayOrder ids, e.g. [123, 456]

200

json
{
    "success": ["165964665990709251", "165964665990709252"],
    "failed":  ["165964665990709250"]
}

Items in failed typically didn't exist or had reached a terminal state (FILLED / CANCELED).

Query order

GET /sapi/v1/order

Rate limit: 20 req / 2s

Query parameters

NameTypeDescription
symbol*stringSymbol, e.g. BTCUSDT
orderId*stringOrder id
newClientOrderIdstringClient order id

200

json
{
    "orderId": "499890200602846976",
    "clientOrderId": "157432755564968",
    "symbol": "BHTUSDT",
    "price": "0.01",
    "origQty": "50",
    "executedQty": "0",
    "avgPrice": "0",
    "status": "NEW",
    "type": "LIMIT",
    "side": "BUY",
    "transactTime": "1574327555669"
}

Open orders

GET /sapi/v1/openOrders

Lists open orders for the given symbol.

Rate limit: 20 req / 2s

Query parameters

NameTypeDescription
symbol*stringSymbol, e.g. BTCUSDT
limitintegerDefault 100

200

json
[
    {
        "orderId": "499902955766523648",
        "symbol": "BHTUSDT",
        "price": "0.01",
        "origQty": "50",
        "executedQty": "0",
        "avgPrice": "0",
        "status": "NEW",
        "type": "LIMIT",
        "side": "BUY",
        "time": "1574329076202"
    }
]

User trades

GET /sapi/v1/myTrades

Rate limit: 20 req / 2s

Query parameters

NameTypeDescription
symbol*stringSymbol, e.g. BTCUSDT
limitintegerDefault 100; max 100
fromIdintegerStart from this trade id

200

json
[
  {
    "symbol": "ETHBTC",
    "id": 100211,
    "bidId": 150695552109032492,
    "askId": 150695552109032493,
    "price": "4.00000100",
    "qty": "12.00000000",
    "time": 1499865549590,
    "isBuyer": true,
    "isMaker": false,
    "feeCoin": "ETH",
    "fee": "0.001"
  }
]

Response

FieldTypeDescription
symbolstringSymbol
idlongTrade id
bidIdlongBid order id
askIdlongAsk order id
pricestringTrade price
qtystringQuantity
timelongTrade time (ms)
isBuyerbooleantrue if you were the buyer
isMakerbooleantrue if you were the maker
feeCoinstringFee asset
feestringFee amount

Account

Security: USER_DATA

Account endpoints require API key + signature. Headers as in Trading.

Account information

GET /sapi/v1/account

Rate limit: 20 req / 2s

200

json
{
    "balances": [
        { "asset": "BTC", "free": "0", "locked": "0" },
        { "asset": "ETH", "free": "0", "locked": "0" }
    ]
}

Response

FieldTypeDescription
balancesarrayAsset balances
assetstringAsset name
freestringAvailable balance
lockedstringLocked balance (open orders)

Deposit history

GET /sapi/v1/deposit/history

TIP

The backend accepts both query string and JSON body (@RequestBody(required = false)). Prefer the query string so signing matches the rest of the GET endpoints.

Query parameters

NameTypeDescription
symbolstringAsset, e.g. USDT
statusintegerStatus filter
startTimelongStart time (ms); defaults to last 90 days
endTimelongEnd time (ms); defaults to now
txidstringOn-chain txid filter
limitintegerPage size; max 1000

200

json
[
  {
    "symbol": "USDT",
    "amount": "100.00",
    "address": "0x...",
    "txid": "0x...",
    "status": 1,
    "createTime": 1574329076202
  }
]

Withdraw history

GET /sapi/v1/withdraw/history

Parameters identical to /sapi/v1/deposit/history. The response uses withdraw-side fields with the same shape.