API documentation

Permalink

About this API

Blockchain Financial API is a JSON-RPC web service for integration with automated software, mostly trading bots like GrowBot.

Important: only crypto/crypto markets are available through the API.

API endpoints are provided by two of our services:

* These methods require an API keypair.

Responses and errors

All methods provide responses as a JSON object with the next structure:

{
    success:boolean, // true if there were no issues, false otherwise.
    message:string, // description of any issue detected, only if the request failed.
    result:mixed // object, array or string
}

The API might throw HTTP response errors before being able to validate input parameters in very extreme cases, E.G. network problems or calling a non existing method.

All timestamps are based on the server timezone: America/Central (GMT -5).

About order ids

Order ids are numeric, but on all API methods that show them, the major market is added to the order id, E.G.:

  • A single market order on DOGE/GRWI will be shown on listings as 12345678901234.
    • On the API methods it will be shown as 12345678901234.GRWI

  • A multimarket order for DOGE on DYN, SEQ, GRWI and PND will be shown on listings as 98765432109876.
    On the API methods you'll see one id per market:
    • 98765432109876.DYN
    • 98765432109876.SEQ
    • 98765432109876.GRWI
    • 98765432109876.PND

Since the API only supports crypto/crypto markets, no payment methods are specified.

Rate limits and restrictions

API access has no limits. The only restrictions are driven by private methods requiring an API keypair.

Public methods

public/getpriceindexes

GET https://blockchainfinancial.com/api/public/getpriceindexes
Returns an object with fiat prices referenced by cryptocurrency.

Does not require any parameters.
{
    "success": true,
    "message": "",
    "result": {
        "BTC": {
            "USD": 56628,
            "CAD": 71427,
            "EUR": 47046,
            "GBP": 40629,
            "JPY": 6121050,
            "CNY": 368051,
            "KRW": 63280900,
            "TWD": 1587840,
            "MXN": 1131720
        },         "HTML": {
            "BTC": 0.00000001,
            "USD": 0.00056628,
            "CAD": 0.00071427,
            "EUR": 0.00047046,
            "GBP": 0.00040629,
            "JPY": 0.0612105,
            "CNY": 0.00368051,
            "KRW": 0.632809,
            "TWD": 0.0158784,
            "MXN": 0.0113172     } }

public/getcurrencies

GET https://blockchainfinancial.com/api/public/getcurrencies
Returns an array of objects with all the cryptocurrencies supported by our systems.

Improved: icon URLs have been added to the response.

Does not require any parameters.
{
    "success": true,
    "message": "",
    "result": [
        {
            "symbol": "BTC",
            "name": "Bitcoin",
            "depositConfirmations": 2,
            "withdrawalFee": 0.0005,
            "minWithdrawal": 0.001,
            "isActive": true,
            "smallIcon"
: "https://blockchainfinancial.com/mediaserver/btc_small.png",
            "largeIcon"
: "https://blockchainfinancial.com/mediaserver/btc_large.png"         },         {             "symbol": "BTX",             "name": "BitCore",             "depositConfirmations": 4,             "withdrawalFee": 0.0005,             "minWithdrawal": 0.001,             "isActive": true,             "smallIcon": "https://blockchainfinancial.com/mediaserver/btx_small.png",
            "largeIcon": "https://blockchainfinancial.com/mediaserver/btx_large.png"     ] }

public/validateaddress

GET https://blockchainfinancial.com/api/public/validateaddress?currency=<symbol>&address=<address>
Returns true or false in the result, depending if the given address of the given coin is a valid wallet address.

If the address is owned by a Blockchain Financial user, the local address legend is set as message. Also, the is_local flag is added outside of the result.

Parameters:
  • currency: symbol of the given coin, E.G. DOGE. Letter case is irrelevant.
  • address: the wallet address to check.
{
    "success": true,
    "message": "",
    "result": true
}

If the address is owned by a local user:

{
    "success": true,
    "message": "local address",
    "result": true,
    "is_local": true
}

public/getmarkets

GET https://blockchainfinancial.com/api/public/getmarkets
Returns an array of objects with the details of all crypto/crypto markets.

Does not require any parameters.

Notes:
  • Trading Fee is the multiplying factor for calculating the fee, E.G. 1% = 0.01, 0.1% = 0.001.
{
    "success": true,
    "message": "",
    "result": [
        {
            
"coinPair""BTC/BTX",
            
"tradingFee"0.003,
            
"minTrade"0.000001,
            
"maxTrade"0,
            
"minBaseTrade"0.000001,
            
"maxBaseTrade"0,
            
"minPrice"0.000001,
            
"maxPrice"0,
            
"isActive"true
        
},
        
{
            
"coinPair""BTC/CLOAK",
            
"tradingFee"0.003,
            
"minTrade"0.000001,
            
"maxTrade"0,
            
"minBaseTrade"0.01,
            
"maxBaseTrade"0,
            
"minPrice"0.01,
            
"maxPrice"0,
            
"isActive"true
        
}
    ] }

public/getticker

GET https://blockchainfinancial.com/api/public/getticker?[market=<minor/major>]&[range=<minutes>]
Returns an array of objects with the summary of all or a specific market within the latest 24 hours or within a given amount of minutes.

Optional parameters:
  • market: specify minor/major coin symbols, E.G. GRWI/DOGE to return the summary of a specific market.
  • range: by default, information is grabbed from the last 24 hours. If you want to get the summary info of the latest n minutes, specify them here, E.G. range=60 for the last hour.

Even if a market is specified, an array with a single item will be returned.

{
    "success": true,
    "message": "",
    "result": [
        {
            "market": "GRWI/BTC",
            "snapshotTime": "2019-09-03 10:44:09",
            "ask": 0.0000258,
            "bid": 0,
            "open": 0.0000258,
            "high": 0.0000258,
            "low": 0.0000258,
            "close": 0.0000258,
            "volume": 0,
            "baseVolume": 0
        },
        {
            "market": "GRWI/BTX",
            "snapshotTime": "2019-09-03 10:44:09",
            "ask": 0.78181818,
            "bid": 0,
            "open": 0.78181818,
            "high": 0.78181818,
            "low": 0.78181818,
            "close": 0.78181818,
            "volume": 0,
            "baseVolume": 0
        }     ] }

public/getorderbook

GET https://blockchainfinancial.com/api/public/getorderbook?type=<buy|sell>&market=<minor/major>&[limit=<int>]
Retrieves the buy or sell order book for a given market and returns it as an array of objects.

Parameters:
  • type must be either buy or sell.
  • market must be specified as minor/major symbols, E.G. DOGE/BTC. Letter case is irrelevant.
  • limit is optional. 100 rows are returned by default.

On buy orders, results are sorted by ascending rate (cheapest first); for sell orders, by descending rate (greater first).

{
    "success": true,
    "message": "",
    "result": [
        {
            "rate": 0.00000028,
            "quantity": 1230.0430
        },         {
            "rate": 0.00000027,
            "quantity": 849.4771
        },
        {
            "rate": 0.00000026,
            "quantity": 6384.1407001
        }
    ] }

Private methods

All the methods listed below require an API keypair. In order to get one, users must have registered an account in our site and provide an API keypair to access private data from your service.

Check this document to see how API keys are created.

How to authenticate requests

  • All requests should be made through HTTP GET requests unless otherwise explained.
  • The public API key must be included in the query string.
  • A nonce is required in the query string. It should be a random integer or a unix timestamp.
  • The entire URL must be hashed using SHA512 and the signature must be included in the request headers.

PHP example:

$public_key = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
$secret_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

$method = "api/account/getdepositaddress";
$params = http_build_query(array(
    "apikey" => $public_key,
    "nonce" => time(),
    "currency" => "DOGE"
));

$url = "https://blockchainfinancial.com/$method?$params";
$sign = hash_hmac("sha512", $url, $secret_key);
$headers = array("Apisign: " . $sign);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$contents = curl_exec($ch);

if( curl_error($ch) ) die("Can't call to the remote API at $url: " . curl_error($ch));

curl_close($ch);
if( empty($contents) ) die("Nothing has been received from the remote API. Called URL: $url");

$object = json_decode($contents);
if( empty($object) ) die("Error: API response is not a valid JSON response: $contents");
if( ! is_object($object) ) die("Error: API response is not a valid JSON object.");
print_r($object);

The output for the previous example will be:

stdClass Object
(
[success] => 1
[message] =>
[result] => Dxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
)

account/getbalances

GET https://blockchainfinancial.com/api/account/getbalances?apikey=<public_key>&nonce=<nonce>&[currencies=<symbol>[;<symbol>;...]]
Returns an array of objects with a balance showdown and deposit address (if available) for every cryptocurrency the user holds or the provided ones.

Optional parameters:
  • currencies: specify a semicolon separated list of coin symbols to only include those, E.G. BTC;LTC;DOGE.
    Symbols letter case is irrelevant.
{
    "success": true,
    "message": "",
    "result": [
        {
            "currency": "LTC",
            "balance": 7.9999299,
            "available": 7.9999299,
            "pending": 0,
            "address": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
            "isActive": true
        },
        {
            "currency": "DOGE",
            "balance": 1000,
            "available": 1000,
            "pending": 0,
            "address": "",
            "isActive": true
        }     ] }

account/getdepositaddress

GET https://blockchainfinancial.com/api/account/getdepositaddress?apikey=<public_key>&nonce=<nonce>&currency=<symbol>
Returns a string with the deposit address for the given coin. If none has been created by the user, one will be issued to the wallet daemon.

Required parameters:
  • currency: the symbol of the coin. Letter case is irrelevant.
{
    "success": true,
    "message": "",
    "result": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

account/newdepositaddress

GET https://blockchainfinancial.com/api/account/newdepositaddress?apikey=<public_key>&nonce=<nonce>&currency=<symbol>
Returns a string with a new deposit address for the given coin.

Required parameters:
  • currency: the symbol of the coin. Letter case is irrelevant.
{
    "success": true,
    "message": "",
    "result": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

exchange/postorder

GET https://blockchainfinancial.com/api/exchange/postorder?apikey=<key>&nonce=<nonce>&market=<market>&type=<buy|sell>&rate=<rate>&quantity=<amount>
Posts a new order on the given market and returns an object the order id and an array of filled order ids or null if none have been filled.

Required parameters:
  • market: minor/major symbols, E.G. EMC2/DOGE.
    Letter case is irrelevant.
  • type: must be buy or sell.
  • rate: the price you want to set.
    It must be a number separating decimals with a dot, E.G. 123.456789, with 8 decimals max.
    Dynamic rates are not accepted.
  • quantity: the amount of coins you're selling or buying.
    It must be a number separating decimals with a dot, E.G. 123.456789, with 8 decimals max
{
    "success": true,
    "message": "",
    "result": {
        "orderId": "12345678901234.XXXX",
        "filledOrders": [
            "12345678901234.XXXX", "12345678901234.XXXX"
        ]
    } }

exchange/getorder

GET https://blockchainfinancial.com/api/exchange/getorder?apikey=<key>&nonce=<nonce>&orderid=<order_id>
Returns an object with details of an order.

Required parameters:
  • orderid: the id of the order to show details for.
{
    "success": true,
    "message": "",
    "result": {
        "orderId": "12345678901234.DOGE",
        "type": "buy",
        "market": "TROLL/DOGE",
        "amount": 100,
        "remaining": 100,
        "state": "open",
        "creationDate": "2019-09-02 18:34:34",
        "expirationDate": "",
        "price": 0     } }

exchange/cancelorder

GET https://blockchainfinancial.com/api/exchange/cancelorder?apikey=<key>&nonce=<nonce>&orderid=<order_id>
Cancels an open/paused order.
If the order has no trades, it will be deleted.
If the order is single market and has trades, it will be closed.
If the order is multimarket, the market will be disabled but the order will be kept open for the other markets.

Required parameters:
  • orderid: the id of the order to cancel.

 the return value is a boolean true; it can be ignored.

{
    "success": true,
    "message": "",
    "result": true
}

exchange/getopenorders

GET https://blockchainfinancial.com/api/exchange/getopenorders?apikey=<key>&nonce=<nonce>&[market=<minor/major>]&[limit=<int>]
Returns an array of objects with information of all open orders of the user.

Optional parameters:
  • market: list entries only for the given market, E.G. TROLL/DOGE.
    Letter case is irrelevant.
  • limit: limit output to the provided amount of entries.

returned rows will be ordered by creation date descending (latest first).

{
    "success": true,
    "message": "",
    "result": [
        {
            "orderId": "45678912365482.DOGE",
            "type": "buy",
            "market": "TROLL/DOGE",
            "amount": 100,
            "remaining": 100,
            "state": "open",
            "creationDate": "2019-09-02 18:34:34",
            "expirationDate": "",
            "price": 0.2
        },
        {
            "orderId": "98745632178955.DOGE",
            "type": "buy",
            "market": "TROLL/DOGE",
            "amount": 45,
            "remaining": 45,
            "state": "open",
            "creationDate": "2019-09-02 17:34:21",
            "expirationDate": "",
            "price": 0.5
        }     ] }

exchange/gettradehistory

GET https://blockchainfinancial.com/api/exchange/gettradehistory?apikey=<key>&nonce=<nonce>&[market=<minor/major>]&[type=<buy|sell>]&[limit=<int>]
Returns an array of objects with the user trading history.

Optional parameters:
  • market: list entries only for the given market, E.G. HTML/CLOAK.
    Letter case is irrelevant.
  • type: if provided, must be buy or sell.
  • limit: limit output to the provided amount of entries.

returned rows will be ordered by the trade closing date descending (latest first).

{
    "success": true,
    "message": "",
    "result": [
        {
            "transactionId": 7412589631598523574,
            "orderId": "45213574584238.TROLL",
            "type": "sell",
            "market": "GRWI/TROLL",
            "orderVendorId": 36541236985214,
            "orderAmount": 0.69,
            "orderRemaining": 0,
            "orderState": "filled",
            "orderCreationDate": "2019-09-02 20:38:26",
            "orderExpirationDate": "",
            "tradeOpeningDate": "2019-09-02 20:39:09",
            "tradeClosingDate": "2019-09-02 20:39:09",
            "tradeClosingType": "filled",
            "tradeAmount": 0.1,
            "tradePrice": 1,
            "tradeTotal": 0.1,
            "tradeFee": 0.0003009
        },
        {
            "transactionId": 5412369587412547862,
            "orderId": "64111254785314.TROLL",
            "type": "buy",
            "market": "DOGE/TROLL",
            "orderVendorId": 41247854123658,
            "orderAmount": 100,
            "orderRemaining": 0,
            "orderState": "filled",
            "orderCreationDate": "2019-08-29 17:45:35",
            "orderExpirationDate": "",
            "tradeOpeningDate": "2019-08-31 20:19:58",
            "tradeClosingDate": "2019-08-31 20:19:58",
            "tradeClosingType": "filled",
            "tradeAmount": 4.925,
            "tradePrice": 5.174,
            "tradeTotal": 25.48195,
            "tradeFee": 0.014775
        }     ] }

Last update: April 20, 2021.