🔀Spot

Spot Trading API Documentation

Terminology

  • base asset refers to the asset that is the quantity of a symbol.

  • quote asset refers to the asset that is the price of a symbol.

Symbol status

  • TRADING

  • HALT

  • BREAK

Order status

  • NEW

  • PARTIALLY_FILLED

  • FILLED

  • CANCELED

  • PENDING_CANCEL

  • REJECTED

Order types

  • LIMIT

  • MARKET

Order side

  • BUY

  • SELL

Time in Force

  • GTC

  • IOC

  • FOK

Kline/Candlestick Interval

m -> minutes; h -> hours; d -> days; w -> weeks; M -> months

  • 1m

  • 3m

  • 5m

  • 15m

  • 30m

  • 1h

  • 2h

  • 4h

  • 6h

  • 8h

  • 12h

  • 1d

  • 3d

  • 1w

  • 1M

For detailed request limit information, see brokerInfo.

Rate limiters (rateLimitType)

  • REQUESTS_WEIGHT

  • ORDERS

Rate limit intervals

  • SECOND

  • MINUTE

  • DAY

For example:

{
      "rateLimitType": "ORDERS",
      "interval": "SECOND",
      "limit": 20
    }

Public

Security Type: None

Endpoints under Public section can be accessed freely without requiring any API-key or signatures.

Test Connectivity

GET https://api.bitflex.com/openapi/v1/ping

This endpoint checks connectivity to the host

Path Parameters

NameTypeDescription

string

  • Weight: 0

Get Server Time

GET https://api.bitflex.com/openapi/v1/time

Path Parameters

NameTypeDescription

string

  • Weight: 0

Get Trading Pairs

GET https://api.bitflex.com/openapi/v1/pairs

[
    {
        "symbol": "BTCUSDT",
        "quoteToken": "USDT",
        "baseToken": "BTC"
    },...
]

Market

Security Type: None

Endpoints under the Market section can be accessed freely without requiring any API-key or signatures.

Broker Token Information

GET https://api.bitflex.com/openapi/v1/brokerInfo

Current broker trading rules and symbol information

Query Parameters

NameTypeDescription

type

string

Trade section information. Possible values include token, options, and contracts, If the parameter is not sent, all trading information will be returned.

{
  "timezone": "UTC",
  "serverTime": 1538323200000,
  "rateLimits": [{
      "rateLimitType": "REQUESTS_WEIGHT",
      "interval": "MINUTE",
      "limit": 1500
    },
    {
      "rateLimitType": "ORDERS",
      "interval": "SECOND",
      "limit": 20
    },
    {
      "rateLimitType": "ORDERS",
      "interval": "DAY",
      "limit": 350000
    }
  ],
  "brokerFilters":[],
  "symbols": [{
    "symbol": "ETHBTC",
    "status": "TRADING",
    "baseAsset": "ETH",
    "baseAssetPrecision": "0.001",
    "quoteAsset": "BTC",
    "quotePrecision": "0.01",
    "icebergAllowed": false,
    "filters": [{
      "filterType": "PRICE_FILTER",
      "minPrice": "0.00000100",
      "maxPrice": "100000.00000000",
      "tickSize": "0.00000100"
    }, {
      "filterType": "LOT_SIZE",
      "minQty": "0.00100000",
      "maxQty": "100000.00000000",
      "stepSize": "0.00100000"
    }, {
      "filterType": "MIN_NOTIONAL",
      "minNotional": "0.00100000"
    }]
  }]
}

Response:

nametypeexampledescription

timezone

string

UTC

Timezone of timestamp

serverTime

long

1554887652929

Retrieves the current time on server (in ms).

In the symbols field, All actively trading symbols will be displayed.

nametypeexampledescription

symbol

string

ETHBTC

Name of the symbol

status

string

TRADING

Status of the symbol

baseAsset

string

ETH

Underlying asset for the symbol

baseAssetPrecision

float

0.001

Precision of the symbol quantity

quoteAsset

string

BTC

Quote asset for the symbol

quoteAssetPrecision

float

0.01

Precision of the symbol price

icebergAllowed

string

false

Whether iceberg orders are allowed.

For filters in symbols field:

nametypeexampledescription

filterType

string

PRICE_FILTER

Type of the filter.

minPrice

float

0.001

Minimum of the symbol price

maxPrice

float

100000.00000000

Maximum of the symbol price

tickSize

float

0.001

Precision of the symbol price.

minQty

float

0.01

Minimal trading quantity of the symbol

maxQty

float

100000.00000000

Maximum trading quantity of the symbol

stepSize

float

0.001

Precision of the symbol quantity

minNotional

float

1

Precision of the symbol order size (quantity * price)

Depth

GET https://api.bitflex.com/openapi/quote/v1/depth

This endpoint retrieve market depth data. This endpoint updates every 300ms.

Query Parameters

NameTypeDescription

symbol

string

Symbol Name. E.g. BTCUSDT

limit

integer

Default 100; Max 100.

{
  "bids": [
    [
      "3.90000000",   // PRICE
      "431.00000000"  // QTY
    ],
    [
      "4.00000000",
      "431.00000000"
    ]
  ],
  "asks": [
    [
      "4.00000200",  // PRICE
      "12.00000000"  // QTY
    ],
    [
      "5.10000000",
      "28.00000000"
    ]
  ]
}

Response:

nametypeexampledescription

time

long

1550829103981

Current timestamp (ms)

bids

list

(see below)

List of all bids, best bids first. See below for entry details.

asks

list

(see below)

List of all asks, best asks first. See below for entry details.

The fields bids and asks are lists of order book price level entries, sorted from best to worst.

nametypeexampledescription

''

float

123.10

price level

''

float

300

The total quantity of orders for this price level

GET https://api.bitflex.com/openapi/quote/v1/depth/merged

This endpoint retrieve market depth data (not full depth). This endpoint updates every 300ms.

Query Parameters

NameTypeDescription

symbol

string

Symbol Name. E.g. BTCUSDT

limit

integer

Default 40; Max 40.

{
  "bids": [
    [
      "3.90000000",   // PRICE
      "431.00000000"  // QTY
    ],
    [
      "4.00000000",
      "431.00000000"
    ]
  ],
  "asks": [
    [
      "4.00000200",  // PRICE
      "12.00000000"  // QTY
    ],
    [
      "5.10000000",
      "28.00000000"
    ]
  ]
}

Response:

nametypeexampledescription

time

long

1550829103981

Current timestamp (ms)

bids

list

(see below)

List of all bids, best bids first. See below for entry details.

asks

list

(see below)

List of all asks, best asks first. See below for entry details.

The fields bids and asks are lists of order book price level entries, sorted from best to worst.

nametypeexampledescription

''

float

123.10

price level

''

float

300

The total quantity of orders for this price level

Recent Trades List

GET https://api.bitflex.com/openapi/quote/v1/trades

This endpoint retrieves latest trades

Query Parameters

NameTypeDescription

symbol

string

Symbol Name. E.g. BTCUSDT

limit

integer

Default 500; Max 1000

[
  {
    "price": "4.00000100",
    "qty": "12.00000000",
    "time": 1499865549590,
    "isBuyerMaker": true
  },...
]

Response:

nametypeexampledescription

price

float

0.055

The price of the trade

time

long

1537797044116

Current timestamp (ms)

qty

float

5

The quantity traded

isBuyerMaker

string

true

true= Order is a buy order when created, false = Order is a sell order when created

Kline/candlestick data

GET https://api.bitflex.com/openapi/quote/v1/klines

This endpoint retrieves kline data

Query Parameters

NameTypeDescription

symbol

string

Symbol Name

interval

string

Interval of the Kline. Possible values include: 1m,5m,15m,30m,1h,1d,1w,1M

startTime

number

Starting timestamp (ms)

endTime

number

Ending timestamp (ms)

limit

integer

Default 500; Max 1000

[
  [
    1499040000000,      // Open time
    "0.01634790",       // Open
    "0.80000000",       // High
    "0.01575800",       // Low
    "0.01577100",       // Close
    "148976.11427815",  // Volume
    1499644799999,      // Close time
    "2434.19055334",    // Quote asset volume
    308,                // Number of trades
    "1756.87402397",    // Taker buy base asset volume
    "28.46694368"       // Taker buy quote asset volume
  ]
]

Response:

nametypeexampledescription

''

long

1538728740000

Open Time

''

float

36.00000

Open

''

float

36.00000

High

''

float

36.00000

Low

''

float

36.00000

Close

''

float

148976.11427815

Trade volume amount

''

long

1538728740000

Close time

''

float

2434.19055334

Quote asset volume

''

integer

308

Number of trades

''

float

1756.87402397

Taker buy base asset volume

''

float

28.46694368

Taker buy quote asset volume

  • If startTime and endTime are not sent, the most recent klines are returned.

24hrs ticker price change statistics

GET https://api.bitflex.com/openapi/quote/v1/ticker/24hr

24 hour price change statistics. Careful when accessing this no symbol.

Path Parameters

NameTypeDescription

symbol

string

Symbol Name. E.g. BTCUSDT

## Single ticker 
{
  "time": 1538725500422,
  "symbol": "ETHBTC",
  "bestBidPrice": "4.00000200",
  "bestAskPrice": "4.00000200",
  "lastPrice": "4.00000200",
  "openPrice": "99.00000000",
  "highPrice": "100.00000000",
  "lowPrice": "0.10000000",
  "volume": "8913.30000000"
}
## Multiple ticker info when symbol is omiited
[
  {
    "time": 1538725500422,
    "symbol": "ETHBTC",
    "lastPrice": "4.00000200",
    "openPrice": "99.00000000",
    "highPrice": "100.00000000",
    "lowPrice": "0.10000000",
    "volume": "8913.30000000"
 },...
]

Response:

nametypeexampledescription

time

long

1538728740000

Open Time

symbol

string

ETHBTC

Symbol Name

bestBidPrice

float

4.000002000

Best Bid Price

bestAskPrice

float

4.000002000

Best Ask Price

lastPrice

float

4.000002000

Last Price

openPrice

float

99.0000000

Open Price

highPrice

float

100.0000000

High Price

lowPrice

float

0.10000000

Low Price

volume

float

8913.300000

Trade Volume

  • If the symbol is not sent, tickers for all symbols will be returned in an array.

Symbol price ticker

GET https://api.bitflex.com/openapi/quote/v1/ticker/price

Latest price for a symbol or symbols

Query Parameters

NameTypeDescription

symbol

string

Symbol Name. E.g. BTCUSDT

## Single ticker 
{
  "price": "4.00000200"
}
## Multiple ticker info when symbol is omiited
[
  {
    "symbol": "LTCBTC",
    "price": "4.00000200"
  },
  {
    "symbol": "ETHBTC",
    "price": "0.07946600"
  },...
]

Response:

nametypeexampledescription

symbol

string

ETHBTC

Symbol Name

price

float

4.0000200

Symbol Price

  • If the symbol is not sent, prices for all symbols will be returned in an array.

Symbol Orderbook Ticker

GET https://api.bitflex.com/openapi/quote/v1/ticker/bookTicker

Best price/quantity on the orderbook for a symbol or symbols

Path Parameters

NameTypeDescription

symbol

string

Symbol Name. E.g. BTCUSDT

## Single ticker 
{
  "symbol": "LTCBTC",
  "bidPrice": "4.00000000",
  "bidQty": "431.00000000",
  "askPrice": "4.00000200",
  "askQty": "9.00000000"
}
## Multiple ticker info when symbol is omiited
[
  {
    "symbol": "LTCBTC",
    "bidPrice": "4.00000000",
    "bidQty": "431.00000000",
    "askPrice": "4.00000200",
    "askQty": "9.00000000"
  },
  {
    "symbol": "ETHBTC",
    "bidPrice": "0.07946700",
    "bidQty": "9.00000000",
    "askPrice": "100000.00000000",
    "askQty": "1000.00000000"
  },...
]

Response:

nametypeexampledescription

symbol

string

ETHBTC

Symbol Name

bidPrice

float

4.0000000

Bid Price

bidQty

float

431

Bid Quantity

askPrice

float

4.0000200

Ask Price

askQty

float

9

Ask Quantity

  • If the symbol is not sent, prices for all symbols will be returned in an array.

Trade

Security Type: USER_DATA/TRADE

Endpoints under Trade require an API-key and a signature.

New Order

POST https://api.bitflex.com/openapi/v1/order

This endpoint allows you to send in a new order

Query Parameters

NameTypeDescription

symbol

string

Symbol Name. E.g. BTCUSDT

quantity

number

Order quantity. For MARKET BUY orders, quantity=amount.

side

string

Side of the order, BUY/SELL

type

string

Type of the order, LIMIT/MARKET/LIMIT_MAKER

timeInForce

string

Time in force. Possible values include GTC(Default),FOK,IOC

price

number

Order price, REQUIRED for LIMIT orders

newClientOrderId

string

Unique order ID generated by users to mark their orders

Headers

NameTypeDescription

X-BH-APIKEY

string

Your API key.

Request Body

NameTypeDescription

signature

string

Authentication is needed for this endpoint

timestamp

integer

Current unix timestamp(ms)

recvWindow

integer

RecvWindow for this request.

{
    'symbol': 'LXTUSDT', 
    'orderId': '494736827050147840', 
    'clientOrderId': '157371322565051',
    'transactTime': '1573713225668', 
    'price': '0.005452', 
    'origQty': '110', 
    'executedQty': '0', 
    'status': 'NEW',
    'timeInForce': 'GTC', 
    'type': 'LIMIT', 
    'side': 'SELL'
    }
  • Weight: 1

Response:

Nametypeexampledescription

orderId

integer

891

ID of the order.

clientOrderId

integer

213443

A unique ID of the order.

symbol

string

LXTUSDT

Symbol Name

transactTime

integer

1573713225668

Time the order is placed

price

float

4765.29

Price of the order.

origQty

float

1.01

Quantity ordered

executedQty

float

1.01

Quantity of orders that has been executed

type

string

LIMIT

The order type, possible types: LIMIT, MARKET

side

string

BUY

Direction of the order. Possible values include BUY or SELL

status

string

NEW

The state of the order.Possible values include NEW, PARTIALLY_FILLED, FILLED, CANCELED, and REJECTED.

timeInForce

string

GTC

Time in force. Possible values include GTC,FOK,IOC

  • Weight: 1

Test New Order

POST https://api.bitflex.com/openapi/v1/order/test

Test new order creation and signature/recvWindow length. Creates and validates a new order but does not send the order into the matching engine.

Query Parameters

NameTypeDescription

symbol

string

Symbol Names. E.g. BTCUSDT

quantity

number

Order Quantity

side

string

Side of the order, BUY/SELL

type

string

Type of the order, LIMIT/MARKET/LIMIT_MAKER

timeInForce

string

Time in force. Possible values include GTC(Default),FOK,IOC

price

number

Order Price, REQUIRED for LIMIT orders

newClientOrderId

string

Unique order ID generated by users to mark their orders.

Headers

NameTypeDescription

X-BH-APIKEY

string

Your API key

Request Body

NameTypeDescription

signature

string

Authentication is needed for this endpoint

timestamp

integer

Current unix timestamp(ms)

recvWindow

integer

RecvWindow for this request.

{}
  • Weight: 1

Query Order

GET https://api.bitflex.com/openapi/v1/order

Check an order's

Query Parameters

NameTypeDescription

orderId

string

Order Id. E.g. 507904211109878016

clientOrderId

string

Client Order Id, Unique order ID generated by users to mark their orders. E.g. 12094ahsihsiad

Headers

NameTypeDescription

X-BH-APIKEY

string

Your API key

Request Body

NameTypeDescription

signature

string

Authentication is needed for this endpoint

timestamp

integer

Current unix timestamp(ms)

recvWindow

integer

RecvWindow for this request.

{
    'orderId': '488856771354432512', 
    'clientOrderId': '1573012268226', 
    'exchangeId': '301', 
    'symbol': 'BTCUSDT', 
    'price': '0', 
    'origQty': '0.000664', 
    'executedQty': '0.000664', 
    'cummulativeQuoteQty': '6.16415104', 
    'avgPrice': '9283.36', 
    'status': 'FILLED', 
    'timeInForce': 'GTC', 
    'type': 'MARKET', 
    'side': 'SELL', 
    'stopPrice': '0.0', 
    'icebergQty': '0.0', 
    'time': '1573012268407', 
    'updateTime': '0', 
    'isWorking': true
    }

Response:

Nametypeexampledescription

orderId

integer

713637304

ID of the order

clientOrderId

string

213443

Unique ID of the order.

symbol

string

BHTUSDT

name of the symbol

price

float

12.34

Price of the order.

origQty

float

1.01

Quantity ordered

executedQty

float

1.01

Quantity of orders that has been executed

avgPrice

float

4754.24

Average price of filled orders.

type

string

LIMIT

The order type, possible types: LIMIT, MARKET

side

string

BUY

Direction of the order. Possible values include BUY or SELL

status

string

NEW

The state of the order.Possible values include NEW, PARTIALLY_FILLED, FILLED, CANCELED, and REJECTED.

timeInForce

string

GTC

Time in force. Possible values include GTC,FOK,IOC.

  • Weight: 1

  • Either orderId or clientOrderId must be sent.

  • For some historical orders cummulativeQuoteQty will be < 0, meaning the data is not available at this time.

Cancel Order

DELETE https://api.bitflex.com/openapi/v1/order

Cancel an active order

Query Parameters

NameTypeDescription

orderId

string

Order Id. E.g. 507904211109878016

clientOrderId

string

Client Order Id, Unique order ID generated by users to mark their orders. E.g. 12094ahsihsiad

Headers

NameTypeDescription

X-BH-APIKEY

string

Your API key

Request Body

NameTypeDescription

signature

string

Authentication is needed for this endpoint

timestamp

integer

Current unix timestamp(ms)

recvWindow

integer

RecvWindow for this request.

{
    'exchangeId': '301', 
    'symbol': 'BHTUSDT', 
    'clientOrderId': '0', 
    'orderId': '499890200602846976', 
    'status': 'CANCELED'
    }
Nametypeexampledescription

orderId

integer

713637304

ID of the order

clientOrderId

string

213443

Unique ID of the order.

symbol

string

BHTUSDT

Name of the symbol

status

string

NEW

The state of the order.Possible values include NEW, PARTIALLY_FILLED, FILLED, CANCELED, and REJECTED.

  • Weight: 1

  • Either orderId or clientOrderId must be sent.

Current Open Orders

GET https://api.bitflex.com/openapi/v1/openOrders

Get all open orders on a symbol. Careful when accessing this with no symbol

Query Parameters

NameTypeDescription

symbol

string

Symbol Name. E.g. BTCUSDT

orderId

string

Order Id. E.g. 507904211109878016

limit

integer

Default 500; Max 1000

Headers

NameTypeDescription

X-BH-APIKEY

string

Your API key

Request Body

NameTypeDescription

signature

string

Authentication is needed for this endpoint

timestamp

integer

Current unix timestamp(ms)

recvWindow

integer

RecvWindow for this request.

[
    {
        'orderId': '499902955766523648', 
        'clientOrderId': '157432907618453', 
        'exchangeId': '301', 
        'symbol': 'BHTUSDT', 
        'price': '0.01', 
        'origQty': '50', 
        'executedQty': '0', 
        'cummulativeQuoteQty': '0', 
        'avgPrice': '0', 
        'status': 'NEW', 
        'timeInForce': 'GTC', 
        'type': 'LIMIT', 
        'side': 'BUY', 
        'stopPrice': '0.0', 
        'icebergQty': '0.0', 
        'time': '1574329076202', 
        'updateTime': '0', 
        'isWorking': true
        },...
    ]

Response:

Nametypeexampledescription

orderId

integer

713637304

ID of the order

clientOrderId

string

213443

Unique ID of the order.

symbol

string

BHTUSDT

name of the symbol

price

float

12.34

Price of the order.

origQty

float

1.01

Quantity ordered

executedQty

float

1.01

Quantity of orders that has been executed

avgPrice

float

4754.24

Average price of filled orders.

type

string

LIMIT

The order type, possible types: LIMIT, MARKET

side

string

BUY

Direction of the order. Possible values include BUY or SELL

status

string

NEW

The state of the order.Possible values include NEW, PARTIALLY_FILLED, FILLED, CANCELED, and REJECTED.

timeInForce

string

GTC

Time in force. Possible values include GTC,FOK,IOC.

  • Weight: 1

  • If orderId is set, it will get orders < that orderId. Otherwise most recent orders are returned.

  • Weight: 1

  • If orderId is set, it will get orders < that orderId. Otherwise most recent orders are returned.

History Orders

GET https://api.bitflex.com/openapi/v1/historyOrders

Get all history orders. Careful when accessing this with no symbol.

Query Parameters

NameTypeDescription

symbol

string

Symbol Name. E.g. BTCUSDT

orderId

string

Order Id. E.g. 507904211109878016

startTime

integer

Start time (ms)

endTime

integer

End Time (ms)

limit

integer

Default 500; Max 1000

Headers

NameTypeDescription

X-BH-APIKEY

string

Your API key

Request Body

NameTypeDescription

signature

string

Authentication is needed for this endpoint

timestamp

integer

Current unix timestamp(ms)

recvWindow

integer

RecvWindow for this request.

[
    {
        'orderId': '499890200602846976', 
        'clientOrderId': '157432755564968', 
        'exchangeId': '301', 
        'symbol': 'BHTUSDT', 
        'price': '0.01', 
        'origQty': '50', 
        'executedQty': '0', 
        'cummulativeQuoteQty': '0', 
        'avgPrice': '0', 
        'status': 'CANCELED', 
        'timeInForce': 'GTC', 
        'type': 'LIMIT', 
        'side': 'BUY', 
        'stopPrice': '0.0', 
        'icebergQty': '0.0', 
        'time': '1574327555669', 
        'updateTime': '0', 
        'isWorking': true
        },...
    ]

Response:

Nametypeexampledescription

orderId

integer

713637304

ID of the order

clientOrderId

string

213443

Unique ID of the order.

symbol

string

BHTUSDT

name of the symbol

price

float

12.34

Price of the order.

origQty

float

1.01

Quantity ordered

executedQty

float

1.01

Quantity of orders that has been executed

avgPrice

float

4754.24

Average price of filled orders.

type

string

LIMIT

The order type, possible types: LIMIT, MARKET

side

string

BUY

Direction of the order. Possible values include BUY or SELL

status

string

NEW

The state of the order.Possible values include FILLED, CANCELED, and REJECTED.

timeInForce

string

GTC

Time in force. Possible values include GTC,FOK,IOC.

  • Weight: 5

  • If orderId is set, it will get orders < that orderId. Otherwise most recent orders are returned.

Trades

GET https://api.bitflex.com/openapi/v1/myTrades

Get historical trades.

Query Parameters

NameTypeDescription

symbol

string

Symbol Name. E.g. BTCUSDT

startTime

integer

Start time (ms)

endTime

integer

End time (ms)

fromId

integer

Trade Id to fetch from

toId

integer

Trade Id to fetch to

limit

integer

Default 500; Max 1000

Headers

NameTypeDescription

X-BH-APIKEY

string

Your API key

Request Body

NameTypeDescription

signature

string

Authentication is needed for this endpoint

timestamp

integer

Current unix timestamp(ms)

recvWindow

integer

RecvWindow for this request.

[
  {
    "symbol": "ETHBTC",
    "id": 28457,
    "orderId": 100234,
    "price": "4.00000100",
    "qty": "12.00000000",
    "commission": "10.10000000",
    "commissionAsset": "ETH",
    "time": 1499865549590,
    "isBuyer": true,
    "isMaker": false
  }
]

Response:

Nametypeexampledescription

symbol

string

ETHBTC

Symbol Name (trading pair)

id

integer

28457

Trade ID

orderId

integer

100234

Order ID

price

integer

4.001

Timestamp of the trade

qty

float

12

Trade quantity

commission

float

10.10000

Trading fee

commissionAsset

string

ETH

Trading fee token name

time

number

1499865549590

Timestamp of the trade

isBuyer

bool

true

true= Buyer false= Seller

isMaker

bool

false

true=Maker false=Taker

  • Weight: 5

  • If only fromId is set,it will get orders < that fromId in descending order.

  • If only toId is set, it will get orders > that toId in ascending order.

  • If fromId is set and toId is set, it will get orders < that fromId and > that toId in descending order.

  • If fromId is not set and toId it not set, most recent order are returned in descending order.

Account

Security Type: USER_DATA/TRADE

Endpoints under Account require an API-key and a signature.

Account Information

GET https://api.bitflex.com/openapi/v1/account

Get current account information (balances)

Headers

NameTypeDescription

X-BH-APIKEY

string

Your API key

Request Body

NameTypeDescription

signature

string

Authentication is needed for this endpoint

timestamp

integer

Current unix timestamp(ms)

recvWindow

integer

RecvWindow for this request.

{
    'balances': 
        [
            {
                'asset': 'ALGO', 
                'free': '0', 
                'locked': '0'
                }, 
            {
                'asset': 'BHT', 
                'free': '0', 
                'locked': '0'
                },...
        ]
    }

Response:

Nametypeexampledescription

balances

float

Show balance details.

In the balances field:

Nametypeexampledescription

asset

string

USDT

Name of the asset

free

float

600.0

Amount available for use

locked

float

100.0

Amount locked (for open orders)

  • Weight: 5

Account Deposit Information

GET https://api.bitflex.com/openapi/v1/depositOrders

Get deposit orders for a specific account

Query Parameters

NameTypeDescription

startTime

integer

Start time (ms)

endTime

integer

End time (ms)

fromId

string

Deposit orderId to fetch from. Default gets the most recent deposit orders.

limit

integer

Default 500; Max 1000

Headers

NameTypeDescription

X-BH-APIKEY

string

Your API key

Request Body

NameTypeDescription

signature

string

Authentication is needed for this endpoint

timestamp

integer

Current unix timestamp(ms)

RecvWindow

integer

RecvWindow for this request.

[
    {
        'time': '1565769575929', 
        'orderId': '428100569859739648', 
        'token': 'USDT', 
        'address': '', 
        'addressTag': '', 
        'fromAddress': '', 
        'fromAddressTag': '', 
        'quantity': '1100'
        },...
    ]

Response:

Nametypeexampledescription

time

float

1565769575929

Deposit timestamp.

orderId

integer

428100569859739648

Order ID

token

string

USDT

Token Name

address

string

Your token address

addressTag

string

Your token address tag

fromAddress

string

From which token address

fromAddressTag

string

From which token address tag

quantity

float

1100

Transferred quantity

  • Weight: 5

  • If fromId is set, it will get orders > that fromId. Otherwise most recent orders are returned.

Account withdrawal information

GET https://api.bitflex.com/openapi/v1/withdrawalOrders

Query Parameters

NameTypeDescription

token

string

Token name. Default: All tokens.

startTime

number

Starting timestamp(ms)

endTime

number

Ending timestamp(ms)

fromId

number

Query from this OrderId. Defaults to latest records.

limit

integer

Default 500; Max 1000

Headers

NameTypeDescription

X-BH-APIKEY

string

Your API Key

Request Body

NameTypeDescription

signature

string

Authentication is needed for this endpoint.

timestamp

integer

Current unix timestamp(ms).

recvWindow

integer

RecvWindow for this request.

[
    {
        "time":"1536232111669",
        "orderId":"90161227158286336",
        "accountId":"517256161325920",
        "tokenId":"BHC",
        "tokenName":"BHC",
        "address":"0x815bF1c3cc0f49b8FC66B21A7e48fCb476051209",
        "addressExt":"address tag",
        "quantity":"14", // Withdrawal qty
        "arriveQuantity":"14", // Arrived qty
        "statusCode":"PROCESSING_STATUS",
        "status":3,
        "txid":"",
        "txidUrl":"",
        "walletHandleTime":"1536232111669",
        "feeTokenId":"BHC",
        "feeTokenName":"BHC",
        "fee":"0.1",
        "requiredConfirmNum":0, // Required confirmations
        "confirmNum":0, // Confirmations
        "kernelId":"", // BEAM and GRIN only
        "isInternalTransfer": false // True if this transfer is internal
    },
    {
        "time":"1536053746220",
        "orderId":"762522731831527",
        "accountId":"517256161325920",
        "tokenId":"BHC",
        "tokenName":"BHC",
        "address":"fdfasdfeqfas12323542rgfer54135123",
        "addressExt":"EOS tag",
        "quantity":"", //Withdrawal qty
        "arriveQuantity":"10", // Arrived qty
        "statusCode":"BROKER_AUDITING_STATUS",
        "status":"2",
        "txid":"",
        "txidUrl":"",
        "walletHandleTime":"1536232111669",
        "feeTokenId":"BHC",
        "feeTokenName":"BHC",
        "fee":"0.1",
        "requiredConfirmNum":0, // Required confirmations
        "confirmNum":0, // Confirmations
        "kernelId":"", // BEAM and GRIN only
        "isInternalTransfer": false // True if this transfer is internal
    }
]
Status CodeStatusDescription

1

BROKER_AUDITING_STATUS

Processing by broker

2

BROKER_REJECT_STATUS

Rejected by broker

3

AUDITING_STATUS

Processing by platform

4

AUDIT_REJECT_STATUS

Reject by platform

5

PROCESSING_STATUS

Processing by wallet

6

WITHDRAWAL_SUCCESS_STATUS

Withdrawal success

7

WITHDRAWAL_FAILURE_STATUS

Withdrawal failed

8

BLOCK_MINING_STATUS

Blockchain mining

Withdrawal Detail

GET https://api.bitflex.com/openapi/v1/withdraw/detail

Get withdrawal info

Query Parameters

NameTypeDescription

orderId

number

Either orderId or clientOrderId must be sent

clientOrderId

string

Either orderId or clientOrderId must be sent

Headers

NameTypeDescription

X-BH-APIKEY

string

Your API Key

Request Body

NameTypeDescription

signature

string

Authentication is needed for this endpoint

timestamp

integer

Current Unix Timestamp (ms)

recvWindow

integer

RecvWindow for this request.

{
    "time":"1536232111669",
    "orderId":"90161227158286336",
    "accountId":"517256161325920",
    "tokenId":"BHC",
    "tokenName":"BHC",
    "address":"0x815bF1c3cc0f49b8FC66B21A7e48fCb476051209",
    "addressExt":"address tag",
    "quantity":"14", // Withdrawal qty
    "arriveQuantity":"14", // Arrived qty
    "statusCode":"PROCESSING_STATUS",
    "status":3,
    "txid":"",
    "txidUrl":"",
    "walletHandleTime":"1536232111669",
    "feeTokenId":"BHC",
    "feeTokenName":"BHC",
    "fee":"0.1",
    "requiredConfirmNum":0, // Required confirmations
    "confirmNum":0, // Confirmations
    "kernelId":"", // BEAM and GRIN only
    "isInternalTransfer": false // True if this transfer is internal
    }

Get Sub-account list

POST https://api.bitflex.com/openapi/v1/subAccount/query

Get your main-account and sub-accounts

Headers

NameTypeDescription

X-BH-APIKEY

string

Your API Key

Request Body

NameTypeDescription

signature

string

Authentication is needed for this request

timestamp

integer

Current unix timestamp (ms)

RecvWindow

integer

Recv Window for this request

[
    {
        "accountId": "122216245228131",
        "accountName": "",
        "accountType": 1,
        "accountIndex": 0 // main-account: 0, sub-account: 1
    },
    {
        "accountId": "482694560475091200",
        "accountName": "createSubAccountByCurl", // sub-account name
        "accountType": 1, // sub-account type 1. token trading 3. contract trading
        "accountIndex": 1
    },
    {
        "accountId": "422446415267060992",
        "accountName": "",
        "accountType": 3,
        "accountIndex": 0
    },
    {
        "accountId": "482711469199298816",
        "accountName": "createSubAccountByCurl",
        "accountType": 3,
        "accountIndex": 1
    },
]

Response:

NameTypeExampleDescription

accountId

integer

YES

Your accountId for main-account or sub-account

accountName

string

YES

Name of your account.

accountType

integer

YES

Account type: 1. token trading account 2. Options account 3. Contracts account

accountIndex

integer

YES

0: main account; >0 (1 or larger): sub-account

  • Weight: 5

Internal Account Transfer

POST https://api.bitflex.com/openapi/v1/transfer

Internal transfer are permitted using this endpoint

Query Parameters

NameTypeDescription

fromAccountType

string

Source account type: 1. token trading account 2.Options account 3. Contracts account

fromAccountIndex

string

Sub-account index(valid when using main-account api, get sub-account indices from /subAccount/query endpoint)

toAccountType

integer

Source account type: 1. token trading account 2.Options account 3. Contracts account

toAccountIndex

integer

Sub-account index(valid when using main-account api, get sub-account indices from /subAccount/query endpoint)

tokenId

string

Token Id. E.g. BTC, ETH, XRP

amount

integer

Amount of token(s) to be transferred

Headers

NameTypeDescription

X-BH-APIKEY

string

Your API key

Request Body

NameTypeDescription

signature

string

Authentication is needed for this endpoint

timestamp

integer

Current unix timestamp (ms)

RecvWindow

integer

Recv window for this request

{
    "success":"true" // success
}

Explanation

  1. Either transferring or receiving account must be the main account (Token trading account)

  2. Main-account API can support transferring to other account(including sub-accounts) and receiving from other accounts

  3. Sub-account API only supports transferring from current account to the main-account. Therefore fromAccountType\fromAccountIndex\toAccountType\toAccountIndex should be left empty.

  4. Weight: 1

Withdraw

POST https://api.bitflex.com/openapi/v1/withdraw

Withdraw to external address

Query Parameters

NameTypeDescription

tokenId

string

TokenId. E.g. BTC、ETH...

clientOrderId

string

Id generated from broker side, to prevent double withdrawal

address

string

提 Withdrawal address (Note: the withdrawal address must be in current tag list in your PC/APP client)

addressExt

string

EOS tag

withdrawQuantity

string

WIthdrawal Amount

chainType

string

chain type, USDT chain types areOMNI ERC20 TRC20default is OMNI

Headers

NameTypeDescription

X-BH-APIKEY

string

Your API Key

Request Body

NameTypeDescription

signature

string

Authentication is needed for this endpoint.

timestamp

integer

Current Unix Timestamp(ms)

recvWindow

integer

RecvWindow for this request

 {
        "status": 0,
        "success": true,
        "needBrokerAudit": false, // Whether this request needs broker auit
        "orderId": "423885103582776064" // Id for successful withdrawal
    }

Check Balance Flow

GET https://api.bitflex.com/openapi/v1/balance_flow

Check balance flow for a specified account

Query Parameters

NameTypeDescription

accountType

integer

Account type: 1. token trading account 2.Options account 3. Contracts account

accountIndex

integer

Sub-account index(valid when using main-account api, get sub-account indices from /subAccount/queryendpoint)

tokenId

string

Token Id. E.g. BTC, ETH, XRP

fromFlowId

integer

FlowId to start from

endFlowId

integer

FlowId to end with

startTime

integer

Time to start from

endTime

integer

Time to end with

limit

integer

Number of entries returned. Default 500, max 500.

Headers

NameTypeDescription

X-BH-APIKEY

string

Your API key

Request Body

NameTypeDescription

signature

string

Authentication is needed for this endpoint.

timestamp

integer

Current Unix timestamp (ms)

RecvWindow

integer

Recv window for this request

[
    {
        "id": "539870570957903104",
        "accountId": "122216245228131",
        "tokenId": "BTC",
        "tokenName": "BTC",
        "flowTypeValue": 51, // balance flow type
        "flowType": "USER_ACCOUNT_TRANSFER", // balance flow type name
        "flowName": "Transfer", // balance flow type Explanation
        "change": "-12.5", // change
        "total": "379.624059937852365", // total asset after change
        "created": "1579093587214"
    },
    {
        "id": "536072393645448960",
        "accountId": "122216245228131",
        "tokenId": "USDT",
        "tokenName": "USDT",
        "flowTypeValue": 7,
        "flowType": "AIRDROP",
        "flowName": "Airdrop",
        "change": "-2000",
        "total": "918662.0917630848",
        "created": "1578640809195"
    }
]

Explanation

  1. Main-account API can query balance flow for token account and other accounts(including sub-accounts, or designated accountType and accountIndex accounts)

  2. Sub-account API can only query current sub-account, therefore accountType and accountIndex is not required.

Response:

NameTypeExampleDescription

id

integer

539870570957903104

Flow id

accountId

integer

122216245228131

Your accountId

tokenId

string

USDT

Token ID

tokenId

string

USDT

Token name, same as token id in most cases

flowTypeValue

integer

51

Flow type value

flowType

string

AIRDROP

Flow type

flowName

string

Airdrop

Flow type name

change

float

-12.5

Amount affected for this action

total

float

782.235

Account balance after the action

created

string

1579093587214

Timestamp of the action

Balance Flow Types:

CategoryParameter Type NameParameter Type IdExplanation

General Balance Flow

TRADE

1

trades

General Balance Flow

FEE

2

trading fees

General Balance Flow

TRANSFER

3

transfer

General Balance Flow

DEPOSIT

4

deposit

Derivatives

MAKER_REWARD

27

maker reward

Derivatives

PNL

28

PnL from contracts

Derivatives

SETTLEMENT

30

Settlement

Derivatives

LIQUIDATION

31

Liquidation

Derivatives

FUNDING_SETTLEMENT

32

Funding fee settlement

Internal Transfer

USER_ACCOUNT_TRANSFER

51

userAccountTransfer Exclusive

OTC

OTC_BUY_COIN

65

OTC buy coin

OTC

OTC_SELL_COIN

66

OTC sell coin

OTC

OTC_FEE

73

OTC fees

OTC

OTC_TRADE

200

Old OTC balance flow

Campaign

ACTIVITY_AWARD

67

Campaign reward

Campaign

INVITATION_REFERRAL_BONUS

68

User rebates

Campaign

REGISTER_BONUS

69

Registration reward

Campaign

AIRDROP

70

Airdrop

Campaign

MINE_REWARD

71

Mining reward

  • Weight: 5

Last updated