安心・安全なビットコイン(bitcoin)取引所Btcbox
ホーム > ヘルプ > API
API

一、API Instructions

1、Request Process

1.1 Create request data, user data. Generate signature and data package to be send to Btcbox server

1.2 Send request data, data package to Btcbox by http request: "POST/GET";

1.3 Btcbox server will process the request after safety checkBtcbox

1.4 Btcbox returns data in JSON format, refer to 3 and 4 for detailed format and error code

1.5 Process the returned data;

2、Safety Authentication

All private API will be verified

Go to Finance->Api, click 'apply', get private key and public key, private key will not be stored, once lost can not be recovered

Important Note: Do not reveal to anybody your keys. They are as important as your password

2.Signature Process

private api needs to verify the signature, example:

$param = array(

amount => 1,

price => 10000,

type => 'buy',

nonce => 141377098123

key => 5zi7w-4mnes-swmc4-egg9b-f2iqw-396z4-g541b

signature => 459c69d25c496765191582d9611028b9974830e9dfafd762854669809290ed82

);

nonce -- Can be understood as an increasing integer ,http://zh.wikipedia.org/wiki/Nonce

key -- Public key

signature -- Parameters like "amount", "price", "type", "nonce", "key" will be combined by '&' to create a new string, encrypt the new string by Sha256 algorithm, key is md5(private key)

3、API_Url

    Ticker

    Path:https://www.btcbox.co.jp/api/v1/ticker/

    Request method:GET

    Parameters

  • none
  • Return JSON dictionary

  • high - represents highest price
  • low - represents lowest price
  • buy - represents bid price one
  • sell - represents ask price one
  • last - represents latest price
  • vol - represents last 24 hour trade volume
  • Return:

  • {"high":39700,"low":36300,"buy":1.879,"sell":0,"last":38800,"vol":283.954}

    Depth

    Market Depth, Return data is large, Do not frequently use。

    Path:https://www.btcbox.co.jp/api/v1/depth/

    Request method:GET

    Parameters

  • none
  • Return JSON dictionary

  • asks - represents sell orders, format is: [price, quantity],the orders are ranked according to price from high to low.
  • bids - represents buy orders, format is: [price, quantity],the orders are ranked according to price from high to low.
  • Return:

  • {"asks":[[70000,5],[69000,0.48],[67000,0.9999],[64498,0.02],[61160,0.017],[60980,0.03],[60000,0.1924],[55900,1.4],[55100,2],[55044,0.019],[54500,0.7836],[54190,1],[52500,5.8645],[51500,5.6594],[51490,0.02],[47500,7],[45999,0.0244],[44585,0.024],[43000,10],[41700,10],[41300,6],[40900,10],[40500,6],[40125,10.0277],[40100,5],[40089,0.509],[39800,14.7132],[39799,0.0695],[39798,5],[39700,2.89],[39000,0.209]],"bids":[[38300,1.879],[38100,1.0078],[38000,1.24],[37700,4.706],[37600,3.8313],[37001,0.146],[36999,5.8],[36400,5],[36200,1.3314],[36002,2],[36000,1.568],[35501,0.282],[35500,9.9],[35200,5.6],[35010,10],[35001,0.03],[34600,7.6],[34500,5.505],[34200,9.3],[34000,6.4],[33800,4.434],[33333,3],[32830,0.0305],[31800,2],[31500,3.018],[30001,0.03],[30000,11.48],[28000,10],[25001,0.04],[22000,5.863],[20001,0.05],[460,10]]}

    Orders

    Return the most recent 100 transactions, Orders are listed by value of "date" and "tid" DESC

    Path:https://www.btcbox.co.jp/api/v1/orders/

    Request method:GET

    Parameters

  • none
  • Return JSON dictionary

  • date - timestamp
  • price - price
  • amount - amount
  • tid - Orders ID
  • type - buy or sell
  • Return:

  • [{"date":"0","price":3,"amount":0.1,"tid":"1","type":"buy"},{"date":"0","price":32323,"amount":2,"tid":"2","type":"sell"},{"date":"0","price":32,"amount":432,"tid":"3","type":"sell"},{"date":"0","price":323,"amount":2,"tid":"4","type":"sell"},{"date":"0","price":2100,"amount":0.3,"tid":"5","type":"buy"}]

Readonly

    Account Balance

    Account information

    Path:https://www.btcbox.co.jp/api/v1/balance/

    Request method:POST

    Parameters

  • key - API key
  • signature - signature
  • nonce - nonce
  • Return JSON dictionary

  • jpy_balance - Total JPY
  • btc_balance - Total BTC
  • jpy_lock - Lock JPY
  • btc_lock - Lock BTC
  • nameauth - Real-name authentication status, 0 -> no, 1 -> wait, 2 -> success
  • moflag - Cellphone status, 0 -> no ,1 -> yes
  • Return:

  • {"uid":8,"nameauth":0,"moflag":0,"btc_balance":4234234,"btc_lock":0,"ltc_balance":32429.6,"ltc_lock":2.4,"doge_balance":0,"doge_lock":0,"jpy_balance":2344581.519,"jpy_lock":868862.481}

    Wallet

    Path:https://www.btcbox.co.jp/api/v1/wallet/

    Request method:POST

    Parameters

  • key - API key
  • signature - signature
  • nonce - nonce
  • Return JSON dicitionary

  • result - true(success), false(fail)
  • address - Bitcoin address
  • Return:

  • {"result":true, "address":"1xxxxxxxxxxxxxxxxxxxxxxxx"}

    Trade_list

    return trade list by timestamp or trade type

    Path:https://www.btcbox.co.jp/api/v1/trade_list/

    Request method:POST

    Parameters

  • key - API key
  • signature - signature
  • nonce - nonce
  • since - unix timestamp(utc timezone) default == 0
  • type - [open or all]
  • Return JSON dictionary

  • id - ID
  • datetime - date and time
  • type - "buy" or "sell"
  • price - price
  • amount_original - total number
  • amount_outstanding - The number of remaining
  • Return:

  • [{"id":"11","datetime":"2014-10-21 10:47:20","type":"sell","price":42000,"amount_original":1.2,"amount_outstanding":1.2},{"id":"10","datetime":"2014-10-20 13:29:39","type":"sell","price":42000,"amount_original":1.2,"amount_outstanding":1.2},{"id":"9","datetime":"2014-10-20 13:29:29","type":"sell","price":42000,"amount_original":1.2,"amount_outstanding":1.2},{"id":"8","datetime":"2014-10-20 13:28:14","type":"buy","price":42800,"amount_original":0.34,"amount_outstanding":0.34},{"id":"7","datetime":"2014-10-20 13:27:38","type":"buy","price":42750,"amount_original":0.235,"amount_outstanding":0.235},{"id":"6","datetime":"2014-10-20 13:27:15","type":"buy","price":43299,"amount_original":4.789,"amount_outstanding":4.789},{"id":"5","datetime":"2014-10-20 13:26:52","type":"buy","price":42500,"amount_original":14,"amount_outstanding":14},{"id":"4","datetime":"2014-10-20 13:26:23","type":"buy","price":43200,"amount_original":0.4813,"amount_outstanding":0.4813},{"id":"3","datetime":"2014-10-20 13:25:57","type":"buy","price":43200,"amount_original":0.4813,"amount_outstanding":0.4813}]

    Trade_view

    Path:https://www.btcbox.co.jp/api/v1/trade_view/

    Request method:POST

    Parameters

  • key - API key
  • signature - signature
  • nonce - nonce
  • id - ID
  • Return JSON dictionary

  • id - ID
  • datetime - format:YYYY-mm-dd HH:ii:ss)
  • type - "buy" or "sell"
  • price - price
  • amount_original - total number
  • amount_outstanding - The number of remaining
  • status - Order status:no, part, cancelled, all
  • trades - JSON dictionary list:
    • trade_id - ID
    • amount - Number of transactions
    • price - price of transactions
    • datetime - format:YYYY-mm-dd HH:ii:ss)
    • fee

    Return:

  • {"id":11,"datetime":"2014-10-21 10:47:20","type":"sell","price":42000,"amount_original":1.2,"amount_outstanding":1.2,"status":"closed","trades":[]}

Full

    Trade_cancel

    Path:https://www.btcbox.co.jp/api/v1/trade_cancel/

    Request method:POST

    Parameters

  • key - API key
  • signature - signature
  • nonce - nonce
  • id - ID
  • Return JSON dictionary

  • result - true(success), false(fail)
  • id - ID
  • Return:

  • {"result":true, "id":"11"}

    Trade_add

    Path:https://www.btcbox.co.jp/api/v1/trade_add/

    Request method:POST

    Parameters

  • key - API key
  • signature - signature
  • nonce - nonce
  • amount - Total number
  • price
  • type - buy or sell
  • Return JSON dictionary

  • id - ID
  • result - true(success), false(fail)
  • Return:

  • {"result":true, "id":"11"}

Data Types

  • *_balance - float
  • id - int
  • datetime - datetime
  • since - int
  • type - string
  • price - float
  • amount* - float
  • status - string
  • trade_id - int
  • fee - float
  • result - bool
  • message - string
  • address - string

DEMO

Common Error Code and Solution
Error Code Solution
100 Required parameters can not be empty
101 Illegal parameter
102 coin does not exist
103 Key does not exist
104 Signature does not match
105 Insufficient permissions
106 Request expired(nonce error)
200 Lack of balance
201 Too small for the number of trading
202 Price must be in 0 - 1000000
203 Order does not exist
301 No Verified
401 System error
402 Requests too frequently
403 Non-open API
404 IP restriction does not request the resource