API Document

  1. PUBLIC METHOD
    1. Ticker
      GET : https://btc-x.is/api/v1/ticker
      Example : https://btc-x.is/api/v1/ticker
      {
        "USD":{
          "last":433.1,
          "buy":431.8,
          "sell":433.1
        },
        ...
        "PHP":{
          "buy":20656.15,
          "sell":20629.07,
          "last":20642.92
        }
      }
    2. Market Depth
      GET : https://btc-x.is/api/v1/depth/<Base>/<Quote>[/<Record>]
      Result : Result : https://btc-x.is/api/v1/depth/btc/usd/100
      {
        "bids":[
          {
            "price":450.01,
            "amount":0.9
          },
          ...
        ],
        "asks":[
          {
            "price":455.90,
            "amount":1
          },
          ...
        ]
      }
    3. Trade History
      GET : https://btc-x.is/api/v1/trade/<Base>/<Quote>[/<Record>]
      Example : https://btc-x.is/api/v1/trade/btc/usd/100
      [
        {
          "id":"31",
          "type":"bid",
          "price":320 ,
          "amount":0.1,
          "date":"1410142870"
        },
        {
          "id":"30",
          "type":"ask",
          "price":490,
          "amount":1,
          "date":"1410142789"
        },
        ...
      ]


  2. AUTHENCATICATED PRIVATE METHODS

    Authenticated methods require the use of an api key (in your API settings ) and can only be accessed via the POST method.
    • Authorization is performed by sending the following variables into the request header.
    • POST https://btc-x.is/api/v1/private
    • Key : Public Key - Example : 7FAOLE67-D9OD55WE-WZ06X9K0-5CG93SO9-99WU063Q
    • Signature : ALL POST data "param1=data1¶m2=data2&Nonce=1234567890" signed by a secret key according to HMAC-SHA512 method.
      Example : 9c6135179f9b57624faebbaa31add9e2...bd1e227a7280b3e04e4
    • Result return in JSON format.
    • On error return error code. Example : { "error": 41 }

    1. Account Balance
      Method : BALANCE
      Parameters : No Require
      Result :
      {
        "BTC":2.0958,
        "LTC":100.80,
        "USD":1000.00,
        ...
      }
    2. List Your Orders
      Method : ORDER
      Parameters :
      Parameter Type Required Value
      status String / Array Yes OPEN - PARTLY - FILLED - CANCELLED
      Result :
      [
        {
          "id":"27",
          "type":"BUY",
          "market":"BTC-USD",
          "amount":"0.90000000",
          "price":"400.00",
          "status":"PARTLY"
        },
        {
          "id":"26",
          "type":"BUY",
          "market":"BTC-USD",
          "amount":"1.00000000",
          "price":"500.00",
          "status":"OPEN"
        },
        ...
      ]
    3. Cancel Your Orders
      Method : CANCEL
      Parameters :
      Parameter Type Required Value
      order Number / Array Yes Your order id with status OPEN or PARTLY.
      Result :
      {
        "fail":[
          [
            10,
            11,
            12
          ]
        ],
        "success":[
          [
            13,
            14,
            15
          ]
        ]
      }
    4. Trade
      Method : TRADE
      Parameters :
      Parameter Type Required Value
      type String Yes BUY - SELL
      market String Yes Market code. Example : BTC-USD,LTC-USD,...
      amount Number Yes Amount you want to trade.
      price Number Yes Price you want to trade.
      Result :
      {
        "order":[
          {
            "id":41,
            "type":"BUY",
            "market":"BTC-USD",
            "amount":0.1,
            "price":450.00
          }
        ]
      }
    5. Withdraw
      Method : WITHDRAW
      Parameters :
      Parameter Type Required Value
      currency String Yes Currency code. Example : BTC, USD, ...
      amount Number Yes Amount you want to withdraw. Example : 123456.78
      details Array No - If detail is null, the system will transfer the withdrawal amount to Vouher.
      - Using Parameter: Amount(You'd like to withdraw E-currency such as: PMUSD, WMZ, WME, OKPAY…)
      - Using Parameter: Address (You'd like to withdraw Crypto Coins such as: Bitcoin, Litecoin…)
      - Using a group of Parameter: Bank – Account – Name (You'd like to withdraw to Bank, only support for USD)
      Result :
      { "status" : true }
                        or
      
      {
        "status":true,
        "voucher":{
          "currency":"USD",
          "amount":100000,
          "code":"USD-H45TOL-SHICPJ-SMNTP9-LNSHTK-VD9VEQ"
        }
      }
    6. Redeem
      Method : REDEEM
      Parameters :
      Parameter Type Required Value
      voucher String Yes Your voucher code.
      Result :
      {
        "status":true,	
        "voucher":{
          "currency":"USD",
          "amount":"100.00",
          "code":"USD-PR44AY-OJJUOL-TSZDQF-NZPRGK-IZVUFB"
        }
      }
    7. History
      Method : HISTORY
      Parameters :
      Parameter Type Required Value
      record Number No The quantity of records returned by default is 25 and not over 250.
      Result :
      [
        {
          "id":"300555",
          "type":"WITHDRAWAL",
          "currency":"USD",
          "amount":"-2060.00",
          "fee":"0.00",
          "description":{
            "index":21864
          },
          "date":"1440067508"
        },
        ...
        {
          "id":"300544",
          "type":"TRADE",
          "currency":"BTC",
          "amount":"-5.0700",
          "fee":"0.00000000",
          "description":{
            "action":"SELL",
            "amount":100.5,
            "price":"600.00",
            "currency":{
              "base":"BTC",
              "quote":"USD"
            }
          },
          "date":"1440067507"
        }
      ]
    8. Errors Code List
      Error Description
      1 Your Banlance is not enough to make this order.
      2 Over quota orders.
      3 Buying amount is smaller than the minimum required.
      4 Market code is not correct (has been disabled or not exist)
      5 Missing parameter market
      6 Your price is not correct.
      7 Your price is not correct.
      8 Amount is not correct..
      9 Your account has been locked this method..
      10 Transaction type is not correct. Only recognize BUY or SELL value.
      11 Your API is not allowed for placing an order (TRADE).
      12 Your order status is not correct. Only recognize OPEN - PARTLY - FILLED – CANCELLED
      13 Your order status is not correct. Only recognize OPEN - PARTLY - FILLED – CANCELLED
      14 Your API is not allowed for listing order.
      15 Missing parameter order in the cancel order request.
      16 Your API is not allowed for cancelling order.
      17 Your account has been locked this method.
      18 Your API is not allowed for deposit.
      19 Your account has been locked this method.
      20 Your withdrawal amount was reached daily limit.
      21 Your withdrawal amount was reached weekly limit.
      22 Your withdrawal amount was reached monthly limit.
      23 Your Banlance is not enough to make transaction.
      24 Your Banlance is not enough to make transaction.
      25 Withdrawal amount is smaller than the minimum required.
      26 Withdrawal amount is not correct.
      27 Withdrawal currency is not correct.
      28 Your API is not allowed for withdraw.
      29 Your fund in this account has been blocked.
      30 Your account has been locked this method.
      31 There have a system errors in the using voucher progress.
      32 Voucher was used before.
      33 Voucher is not correct.
      34 Missing voucher parameter.
      35 Your account has been locked this method.
      36 Your API is not allowed view history transaction.
      37 Your account has been locked this method.
      38 Your API is not allowed view balance.
      39 Your account has been locked this method.
      40 Calling method is not exist.
      41 Signature is not correct.
      42 Signature is duplicated.
      43 This API was temporary disabled..
      44 Your account was temporary blocked.
      45 The IP address is not in allow list.
      46 API key is not correct.
      47 Missing Key or Signature parameter.
    9. Sample Code in PHP
      <?php
      define('api_KEY','7FAOLE67-D9OD55WE-WZ06X9K0-5CG93SO9-99WU063Q');
      define('api_SECRET','10d5e71f251902fdacd1fa4a8f76655dffd0e29d7dd1703b41c798a2bed42f07');
      
      function doQuery($Method,array $Request = array())
      {
        $Request['Method'] = $Method;
        $Request['Nonce'] = microtime(true) * 10000;
        $Data = http_build_query($Request, '', '&');
        
        $Object = curl_init();
        curl_setopt($Object, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($Object, CURLOPT_USERAGENT, 'Mozilla/4.0'.php_uname('s').'; PHP/'.phpversion().')');
        curl_setopt($Object, CURLOPT_URL, 'https://btc-x.is/api/v1/private');
        curl_setopt($Object, CURLOPT_POSTFIELDS, $Data);
        curl_setopt($Object, CURLOPT_HTTPHEADER, array('KEY: '.api_KEY,'SIGNATURE: '.hash_hmac('sha512', $Data, api_SECRET)));
        curl_setopt($Object, CURLOPT_SSL_VERIFYPEER, FALSE);
        
        if($Response = curl_exec($Object))
        {
          return $Response;
        }
        return false;
      }
      /*
      var_dump(doQuery('balance'));
      var_dump(doQuery('order',array('status' => array('open','partly'))));
      var_dump(doQuery('cancel',array('order' => array(11,12,13))));
      var_dump(doQuery('trade',array('type' => 'BUY','market' => 'BTC-USD','amount' => 0.1,'price' => 300.00)));
      var_dump(doQuery('trade',array('type' => 'SELL','market' => 'BTC-USD','amount' => 1,'price' => 500.00)));
      var_dump(doQuery('withdraw',array('currency' => 'BTC','amount' => 1,'details' => array('Address' => '1MgcFUsNUUgLict99hkv6S9Evt83YzuL9a'))));
      var_dump(doQuery('withdraw',array('currency'=>'USD','amount'=>100,'details'=>array(
        'Bank'=>'CHASE',
        'Account'=>'100102030405',
        'Name'=>'JOHN SMITH'))));
      var_dump(doQuery('withdraw',array('currency' => 'USD','amount' => 100000)));
      var_dump(doQuery('redeem',array('voucher' => 'USD-PR44AY-OJJUOL-TSZDQF-NZPRGK-IZVUFB')));
      var_dump(doQuery('history',array('record' => 5)));
      */
      ?>