Regions

HTTP API

HTTP Public API

HTTP Private API

API Documentation

Service for Lightning FX will be discontinued as of Thursday, March 28, 2024, 6:00 pm (JST).
At the same time as Lightning FX is discontinued, bitFlyer Crypto CFD will be launched as a new service.
Until the termination of Lightning FX, the API Documentation remains unchanged.
With the launch of bitFlyer Crypto CFD, parts of the API Documentation will be changed.
Details on the changes will be announced separately.

bitFlyer Lightning offers two styles of API, the HTTP API and Realtime API.

Regions

API functionality may be limited by region. Specific products, such as markets, may not be available in every region. Specific order pairs may be limited to a specific region as well.

Please note that samples are based on JP region.

HTTP API

Japan Endpoint URL: https://api.bitflyer.com/v1/ U.S. Endpoint URL: https://api.bitflyer.com/v1/ Europe Endpoint URL: https://api.bitflyer.com/v1/

For HTTP API, Public API does not require API Key, while Private API requires API Key authentication.

You can try out our API at the API Playground.

API Limits

Please be aware of the HTTP API usage limits described below.
When exceeding an API limit, future API requests will be blocked temporarily.
After being blocked, the maximum request limit will be temporarily be decreased.

Condition Limitation
Same IP Address 500 queries per 5 minutes
Orders with volume <= 0.1 100 placements per minute**
Private APIs 500 queries per 5 minutes
Send a New Order
POST /v1/me/sendchildorder
Submit New Parent Order (Special order)
POST /v1/me/sendparentorder
Cancel All Orders
POST /v1/me/cancelallchildorders
300 queries per 5 minutes

** Exceeding this limit will enforce a temporary decreased limit of 10 times per minute for the duration of 1 hour

If we determine that orders are being repeatedly placed with the intent of increasing the load on the system, we may place restrictions on the user's API usage.

Authentication

bitFlyer Private APIs require authentication using an API Key and API Secret. They can be obtained by generating them on the developer's page.

The following HTTP request headers are required to properly authenticate a request:

The ACCESS-SIGN is the resulting HMAC-SHA256 hash of the ACCESS-TIMESTAMP, HTTP method, request path, and request body concatenated together as a character string, created using your API secret.

// Node.js sample
var request = require('request');
var crypto = require('crypto');

var key = '{{ YOUR API KEY }}';
var secret = '{{ YOUR API SECRET }}';

var timestamp = Date.now().toString();
var method = 'POST';
var path = '/v1/me/sendchildorder';
var body = JSON.stringify({
    product_code: 'BTC_JPY',
    child_order_type: 'LIMIT',
    side: 'BUY',
    price: 30000,
    size: 0.1
});

var text = timestamp + method + path + body;
var sign = crypto.createHmac('sha256', secret).update(text).digest('hex');

var options = {
    url: 'https://api.bitflyer.com' + path,
    method: method,
    body: body,
    headers: {
        'ACCESS-KEY': key,
        'ACCESS-TIMESTAMP': timestamp,
        'ACCESS-SIGN': sign,
        'Content-Type': 'application/json'
    }
};
request(options, function (err, response, payload) {
    console.log(payload);
});

API key permissions

When you set up an API key, you can set the permissions for each key. In order to access a list of the permissions held by the API key, please use the Get API permissions API.

API key permissions

Pagination

APIs that return many results can use query parameters to retrieve results within a specified range.

Two-factor Authentication

Since 2FA must be enabled for withdrawals, you will also need 2FA when using bitFlyer APIs. The authentication code is entered in the request parameters. If the code parameter is not included or is incorrect, the following error response will be returned.

Authenticate by including the verification code in the request as the code parameter.

{
   "status": -505,
   "error_message": "Two-factor authentication code is incorrect."
}

If you have enabled 2FA by email or SMS, a confirmation code will be sent. Please use the received confirmation code in your request.

HTTP Public API

Market List

Request

GET /v1/getmarkets
GET /v1/markets
GET /v1/getmarkets/usa
GET /v1/markets/usa
GET /v1/getmarkets/eu
GET /v1/markets/eu

Response

[
  {
    "product_code": "BTC_JPY",
    "market_type": "Spot"
  },
  {
    "product_code": "XRP_JPY",
    "market_type": "Spot"
  },
  {
    "product_code": "ETH_JPY",
    "market_type": "Spot"
  },
  {
    "product_code": "XLM_JPY",
    "market_type": "Spot"
  },
  {
    "product_code": "MONA_JPY",
    "market_type": "Spot"
  },
  {
    "product_code": "ETH_BTC",
    "market_type": "Spot"
  },
  {
    "product_code": "BCH_BTC",
    "market_type": "Spot"
  },
  {
    "product_code": "FX_BTC_JPY",
    "market_type": "FX"
  }
]

Order Book

Request

GET /v1/getboard
GET /v1/board

Query parameters

Response

{
  "mid_price": 33320,
  "bids": [
    {
      "price": 30000,
      "size": 0.1
    },
    {
      "price": 25570,
      "size": 3
    }
  ],
  "asks": [
    {
      "price": 36640,
      "size": 5
    },
    {
      "price": 36700,
      "size": 1.2
    }
  ]
}

Ticker

Request

GET /v1/getticker
GET /v1/ticker

Query parameters

product_code: Please specify a product_code, as obtained from the Market List. Please refer to the Regions to check available products in each region.

Response

{
  "product_code": "BTC_JPY",
  "state": "RUNNING",
  "timestamp": "2015-07-08T02:50:59.97",
  "tick_id": 3579,
  "best_bid": 30000,
  "best_ask": 36640,
  "best_bid_size": 0.1,
  "best_ask_size": 5,
  "total_bid_depth": 15.13,
  "total_ask_depth": 20,
  "market_bid_size": 0,
  "market_ask_size": 0,
  "ltp": 31690,
  "volume": 16819.26,
  "volume_by_product": 6819.26
}

Execution History

Request

GET /v1/getexecutions
GET /v1/executions

Query parameters

Response

[
  {
    "id": 39287,
    "side": "BUY",
    "price": 31690,
    "size": 27.04,
    "exec_date": "2015-07-08T02:43:34.823",
    "buy_child_order_acceptance_id": "JRF20150707-200203-452209",
    "sell_child_order_acceptance_id": "JRF20150708-024334-060234"
  },
  {
    "id": 39286,
    "side": "SELL",
    "price": 33170,
    "size": 0.36,
    "exec_date": "2015-07-08T02:43:34.72",
    "buy_child_order_acceptance_id": "JRF20150708-010230-400876",
    "sell_child_order_acceptance_id": "JRF20150708-024334-197755"
  }
]

Orderbook status

Request

GET /v1/getboardstate

Query parameters

product_code: Please specify a product_code, as obtained from the Market List. Please refer to the Regions to check available products in each region.

Response

{
  "health": "NORMAL",
  "state": "RUNNING",
}

{
  "health": "NORMAL",
  "state": "MATURED",
  "data": {
    "special_quotation": 410897
  }
}

*These items may change or new items may be added in the future.

Exchange status

This will allow you to determine the current status of the exchange.

Request

GET /v1/gethealth

Query parameters

Response

{
  "status": "NORMAL"
}

Max leverage for corporate accounts

You can retrieve information on the max leverage for corporate accounts here. The following information is for clients with corporate accounts.

Request

GET /v1/getcorporateleverage

Response

{
    "current_max": 7.70,
    "current_startdate": "2021-04-27T15:00:00",
    "next_max": 7.65,
    "next_startdate": "2021-05-04T15:00:00"
}

Chat

Obtain the chat log.

Request

GET /v1/getchats
GET /v1/getchats/usa
GET /v1/getchats/eu

Query parameters

Response

[
  {
    "nickname": "User1234567",
    "message": "Hello world!",
    "date": "2016-02-16T10:58:08.833"
  },
  {
    "nickname": "TestUser",
    "message": "TestHello",
    "date": "2016-02-15T10:18:06.67"
  }
]

Please note this request will only pull the chat logs from Japan if you use /v1/getchats. Use /v1/getchats/usa and /v1/getchats/eu to pull their respective regional chat logs.

HTTP Private API

Authentication is required for requests using the Private API. See the Authentication section.

Get API Key Permissions

Returns a list of HTTP Private APIs that can be used with the API key provided in the header of the request.

Request

GET /v1/me/getpermissions

Response

[ "/v1/me/getpermissions",
  "/v1/me/getbalance",
  "/v1/me/getcollateral",
  "/v1/me/getchildorders",
  "/v1/me/getparentorders",
  "/v1/me/getparentorder",
  "/v1/me/getexecutions",
  "/v1/me/getpositions"
]

Get Account Asset Balance

Request

GET /v1/me/getbalance

Response

[
  {
    "currency_code": "JPY",
    "amount": 1024078,
    "available": 508000
  },
  {
    "currency_code": "BTC",
    "amount": 10.24,
    "available": 4.12
  },
  {
    "currency_code": "ETH",
    "amount": 20.48,
    "available": 16.38
  }
]

Get Margin Status

Request

GET /v1/me/getcollateral

Response

{
  "collateral": 100000,
  "open_position_pnl": -715,
  "require_collateral": 19857,
  "keep_rate": 5.000,
  "margin_call_amount": 1000000,
  "margin_call_due_date": "2021-09-01T08:00:00"
}

Request

GET /v1/me/getcollateralaccounts

Response

[
  {
    "currency_code": "JPY",
    "amount": 10000
  },
  {
    "currency_code": "BTC",
    "amount": 1.23
  }
]

Obtain the details of your margin deposits for each currency.

Get Crypto Assets Deposit Addresses

Get a crypto asset address for making deposits to your bitFlyer account.

Request

GET /v1/me/getaddresses

Response

[
  {
    "type": "NORMAL",
    "currency_code": "BTC",
    "address": "3AYrDq8zhF82NJ2ZaLwBMPmaNziaKPaxa7"
  },
  {
    "type": "NORMAL",
    "currency_code": "ETH",
    "address": "0x7fbB2CC24a3C0cd3789a44e9073381Ca6470853f"
  }
]

Get Crypto Assets Deposit History

Request

GET /v1/me/getcoinins

Query parameters

Response

[
  {
    "id": 100,
    "order_id": "CDP20151227-024141-055555",
    "currency_code": "BTC",
    "amount": 0.00002,
    "address": "1WriteySQufKZ2pVuM1oMhPrTtTVFq35j",
    "tx_hash": "9f92ee65a176bb9545f7becb8706c50d07d4cee5ffca34d8be3ef11d411405ae",
    "status": "COMPLETED",
    "event_date": "2015-11-27T08:59:20.301"
  }
]

Get Crypto Assets Transaction History

Request

GET /v1/me/getcoinouts

Query parameters

Response

[
  {
    "id": 500,
    "order_id": "CWD20151224-014040-077777",
    "currency_code": "BTC",
    "amount": 0.1234,
    "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
    "tx_hash": "724c07dfd4044abcb390b0412c3e707dd5c4f373f0a52b3bd295ce32b478c60a",
    "fee": 0.0005,
    "additional_fee": 0.0001,
    "status": "COMPLETED",
    "event_date": "2015-12-24T01:40:40.397"
  }
]

Get Summary of Bank Accounts

Returns a summary of bank accounts registered to your account.

Request

GET /v1/me/getbankaccounts

Response

[
  {
    "id": 3402,
    "is_verified": true,
    "bank_name": "Wells Fargo",
    "branch_name": "1231234123",
    "account_type": "Checking",
    "account_number": "1111111",
    "account_name": "Name on Account"
  }
]

Get Cash Deposits

Request

GET /v1/me/getdeposits

Query parameters

Response

[
  {
    "id": 300,
    "order_id": "MDP20151014-101010-033333",
    "currency_code": "JPY",
    "amount": 10000,
    "status": "COMPLETED",
    "event_date": "2015-10-14T10:10:10.001"
  }
]

Withdrawing Funds

Request

POST /v1/me/withdraw

Body parameters

{
  "currency_code": "JPY",
  "bank_account_id": 1234,
  "amount": 12000
}

Additional fees apply for withdrawals. Please see the Fees and Taxes page for reference.

Response

{
  "message_id": "69476620-5056-4003-bcbe-42658a2b041b"
}


Error Response:

{
  "status": -700,
  "error_message": "This account has not yet been authenticated",
  "data": null
}

If an error with a negative status value is returned, the cancellation has not been committed.

Get Deposit Cancellation History

Request

GET /v1/me/getwithdrawals

Query parameters

Response

[
  {
    "id": 700,
    "order_id": "MWD20151020-090909-011111",
    "currency_code": "JPY",
    "amount": 12000,
    "status": "COMPLETED",
    "event_date": "2015-10-20T09:09:09.416"
  }
]

Send a New Order

Request

POST /v1/me/sendchildorder

Body parameters

{
  "product_code": "BTC_JPY",
  "child_order_type": "LIMIT",
  "side": "BUY",
  "price": 30000,
  "size": 0.1,
  "minute_to_expire": 10000,
  "time_in_force": "GTC"
}

Response

If the parameters are correct, the status code will show 200 OK.

{
    "child_order_acceptance_id": "JRF20150707-050237-639234"
}

Cancel Order

Request

POST /v1/me/cancelchildorder

Body parameters

{
  "product_code": "BTC_JPY",
  "child_order_id": "JOR20150707-055555-022222"
}

{
  "product_code": "BTC_JPY",
  "child_order_acceptance_id": "JRF20150707-033333-099999"
}

Please specify either child_order_id or child_order_acceptance_id

Response

If the parameters are correct, the status code will show 200 OK.

Submit New Parent Order (Special order)

It is possible to place orders with logic more complicated than limit orders (LIMIT) and market orders (MARKET). Such orders are handled as parent orders. By using a special order, it is possible to place orders in response to market conditions or place multiple associated orders.

Please read about the types of special orders and their methods in the bitFlyer Lightning documentation on special orders.

Request

POST /v1/me/sendparentorder

Body parameters

{
  "order_method": "IFDOCO",
  "minute_to_expire": 10000,
  "time_in_force": "GTC",
  "parameters": [{
    "product_code": "BTC_JPY",
    "condition_type": "LIMIT",
    "side": "BUY",
    "price": 30000,
    "size": 0.1
  },
  {
    "product_code": "BTC_JPY",
    "condition_type": "LIMIT",
    "side": "SELL",
    "price": 32000,
    "size": 0.1
  },
  {
    "product_code": "BTC_JPY",
    "condition_type": "STOP_LIMIT",
    "side": "SELL",
    "price": 28800,
    "trigger_price": 29000,
    "size": 0.1
  }]
}

In the parameters, specify an array of objects with the following keys and values.

Response

If the parameters are correct, the status code will show 200 OK.

{
  "parent_order_acceptance_id": "JRF20150707-050237-639234"
}

Cancel parent order

Parent orders can be canceled in the same manner as regular orders. If a parent order is canceled, the placed orders associated with that order will all be canceled.

Request

POST /v1/me/cancelparentorder

Body parameters

{
  "product_code": "BTC_JPY",
  "parent_order_id": "JCO20150925-055555-022222"
}

{
  "product_code": "BTC_JPY",
  "parent_order_acceptance_id": "JRF20150925-033333-099999"
}

Please specify only one between parent_order_id and parent_order_acceptance_id

Response

If the parameters are correct, the status code will show 200 OK.

Cancel All Orders

Cancel all existing orders for the corresponding product.

Request

POST /v1/me/cancelallchildorders

Body parameters

{
  "product_code": "BTC_JPY"
}

Response

If the parameters are correct, the status code will show 200 OK.

List Orders

Request

GET /v1/me/getchildorders

Query parameters

Response

[
  {
    "id": 138398,
    "child_order_id": "JOR20150707-084555-022523",
    "product_code": "BTC_JPY",
    "side": "BUY",
    "child_order_type": "LIMIT",
    "price": 30000,
    "average_price": 30000,
    "size": 0.1,
    "child_order_state": "COMPLETED",
    "expire_date": "2015-07-14T07:25:52",
    "child_order_date": "2015-07-07T08:45:53",
    "child_order_acceptance_id": "JRF20150707-084552-031927",
    "outstanding_size": 0,
    "cancel_size": 0,
    "executed_size": 0.1,
    "total_commission": 0,
    "time_in_force": "GTC"
  },
  {
    "id": 138397,
    "child_order_id": "JOR20150707-084549-022519",
    "product_code": "BTC_JPY",
    "side": "SELL",
    "child_order_type": "LIMIT",
    "price": 30000,
    "average_price": 0,
    "size": 0.1,
    "child_order_state": "CANCELED",
    "expire_date": "2015-07-14T07:25:47",
    "child_order_date": "2015-07-07T08:45:47",
    "child_order_acceptance_id": "JRF20150707-084547-396699",
    "outstanding_size": 0,
    "cancel_size": 0.1,
    "executed_size": 0,
    "total_commission": 0,
    "time_in_force": "GTC"
  }
]

Any order that has never been executed, and which is then invalidated, due to a cancellation, etc. will not be included in the list of orders. Although you can set child_order_state to CANCELED, EXPIRED, or REJECTED, even then, orders that have never been executed will not be included in the results.

List Parent Orders

Request

GET /v1/me/getparentorders

Query parameters

Response

[
  {
    "id": 138398,
    "parent_order_id": "JCO20150707-084555-022523",
    "product_code": "BTC_JPY",
    "side": "BUY",
    "parent_order_type": "STOP",
    "price": 30000,
    "average_price": 30000,
    "size": 0.1,
    "parent_order_state": "COMPLETED",
    "expire_date": "2015-07-14T07:25:52",
    "parent_order_date": "2015-07-07T08:45:53",
    "parent_order_acceptance_id": "JRF20150707-084552-031927",
    "outstanding_size": 0,
    "cancel_size": 0,
    "executed_size": 0.1,
    "total_commission": 0
  },
  {
    "id": 138397,
    "parent_order_id": "JCO20150707-084549-022519",
    "product_code": "BTC_JPY",
    "side": "SELL",
    "parent_order_type": "IFD",
    "price": 30000,
    "average_price": 0,
    "size": 0.1,
    "parent_order_state": "CANCELED",
    "expire_date": "2015-07-14T07:25:47",
    "parent_order_date": "2015-07-07T08:45:47",
    "parent_order_acceptance_id": "JRF20150707-084547-396699",
    "outstanding_size": 0,
    "cancel_size": 0.1,
    "executed_size": 0,
    "total_commission": 0
  }
]

price and size values for parent orders with multiple associated orders are both reference values only.

To obtain the detailed parameters for individual orders, use the API to obtain the details of the parent order. To obtain a list of associated orders, use the API to obtain the order list.

Get Parent Order Details

Request

GET /v1/me/getparentorder

Query parameters

Please specify either parent_order_id or parent_order_acceptance_id.

Response

{
  "id": 4242,
  "parent_order_id": "JCO20150925-046876-036161",
  "order_method": "IFDOCO",
  "expire_date": 10000,
  "parameters": [{
    "product_code": "BTC_JPY",
    "condition_type": "LIMIT",
    "side": "BUY",
    "price": 30000,
    "size": 0.1,
    "trigger_price": 0,
    "offset": 0
  }, {
    "product_code": "BTC_JPY",
    "condition_type": "LIMIT",
    "side": "SELL",
    "price": 32000,
    "size": 0.1,
    "trigger_price": 0,
    "offset": 0
  }, {
    "product_code": "BTC_JPY",
    "condition_type": "STOP_LIMIT",
    "side": "SELL",
    "price": 28800,
    "size": 0.1,
    "trigger_price": 29000,
    "offset": 0
  }],
  "parent_order_acceptance_id": "JRF20150925-060559-396699"
}

List Executions

Request

GET /v1/me/getexecutions

Query parameters

Response

[
  {
    "id": 37233,
    "child_order_id": "JOR20150707-060559-021935",
    "side": "BUY",
    "price": 33470,
    "size": 0.01,
    "commission": 0,
    "exec_date": "2015-07-07T09:57:40.397",
    "child_order_acceptance_id": "JRF20150707-060559-396699"
  },
  {
    "id": 37232,
    "child_order_id": "JOR20150707-060426-021925",
    "side": "BUY",
    "price": 33470,
    "size": 0.01,
    "commission": 0,
    "exec_date": "2015-07-07T09:57:40.397",
    "child_order_acceptance_id": "JRF20150707-060559-396699"
  }
]

List Balance History

Request

GET /v1/me/getbalancehistory

Query parameters

Response

[
  {
    "id": 1000108,
    "trade_date": "2016-10-19T14:44:55.28",
    "event_date": "2016-10-19T05:44:55.28",
    "product_code": "BTC_USD",
    "currency_code": "USD",
    "trade_type": "SELL",
    "price": 9999.99,
    "amount": 99.99,
    "quantity": 99.99,
    "commission": 0,
    "balance": 9999999.99,
    "order_id": "JORYYYYMMDD‌-000000-000001X"
  },
  {
    "id": 1000107,
    "trade_date": "2016-10-19T14:41:35.23",
    "event_date": "2016-10-19T05:41:35.23",
    "product_code": "BTC_USD",
    "currency_code": "USD",
    "trade_type": "SELL",
    "price": 9999.99,
    "amount": 999.99,
    "quantity": 99.99,
    "commission": 0,
    "balance": 9999999.99,
    "order_id": "JORYYYYMMDD‌-000000-000000X"
  }
]

Get Open Interest Summary

Request

GET /v1/me/getpositions

Query parameters

Response

[
  {
    "product_code": "FX_BTC_JPY",
    "side": "BUY",
    "price": 36000,
    "size": 10,
    "commission": 0,
    "swap_point_accumulate": -35,
    "require_collateral": 120000,
    "open_date": "2015-11-03T10:04:45.011",
    "leverage": 3,
    "pnl": 965,
    "sfd": -0.5
  }
]

Get Margin Change History

Request

GET /v1/me/getcollateralhistory

Query parameters

Response

[
  {
    "id": 4995,
    "currency_code": "JPY",
    "change": -6,
    "amount": -6,
    "reason_code": "CLEARING_COLL",
    "date": "2017-05-18T02:37:41.327"
  },
  {
    "id": 4994,
    "currency_code": "JPY",
    "change": 2083698,
    "amount": 0,
    "reason_code": "EXCHANGE_COLL",
    "date": "2017-04-28T03:05:07.493"
  },
  {
    "id": 4993,
    "currency_code": "BTC",
    "change": -14.69001618,
    "amount": 34.97163164,
    "reason_code": "EXCHANGE_COLL",
    "date": "2017-04-28T03:05:07.493"
  }
]

Get Trading Commission

Request

GET /v1/me/gettradingcommission

Query parameters

Response
{
  "commission_rate": 0.001
}