CoinDesk, Bitpay and Coinbase: APIs for developing bitcoin apps

4 min reading
CoinDesk, Bitpay and Coinbase: APIs for developing bitcoin apps
CoinDesk, Bitpay and Coinbase: APIs for developing bitcoin apps

BBVA API Market

It’s not a secret that the great advantages of application programming interfaces as regards new ways of doing business with third parties and reducing costs. Their importance is clearly evidenced by the fact that no company, entrepreneur or developer envisions the present or the future without them. The same applies to the community that offers solutions linked to bitcoins. Without APIs it would be almost impossible to implement the payment and transaction technology.

Using Programmable Web (the largest and best API repository in the world with more than 15,000 APIs) as a reference, we have created this short list of application programming interfaces linked to the most popular bitcoin services. However, this has been a hard decision since there are countless projects and APIs in this sector. 

CoinDesk API

CoinDesk is a platform that offers bitcoin-related services. Its most used service is probably the Bitcoin Price Index (BPI) which establishes bitcoin’s exchange price in real time. Hundreds of bitcoin-related services use this index to calculate their exchange policy. To include information from this index in an application or website, external developers only need to fulfill a single condition: CoinDesk needs to be credited as the primary source of the index’s financial data.

This interface is a REST API which returns information in JSON format. As it usually happens with a REST API, the requests for this data are made through HTTP requests. Initially, there is no limitation on using the API or the flow of requests for information albeit you are warned against abuse. CoinDesk API has several endpoints from which external developers can raise requests and obtain answers.

For example, the API offers the exchange price of their index in several currencies to programmers of other applications through an endpoint with the following URL: http(s)://api.coindesk.com/v1/bpi/currentprice.json. An endpoint is basically a remote procedure call (RPC) service that provides an access method for external people or customers. Typically, its answer is in JSON format. Example: 

{“time”:{“updated”:”Jun 8, 2016 18:11:00 UTC”,”updatedISO”:”2016-06-08T18:11:00+00:00″,”updateduk”:”Jun 8, 2016 at 19:11 BST”},”disclaimer”:”This data was produced from the CoinDesk Bitcoin Price Index (USD). Non-USD currency data converted using hourly conversion rate from openexchangerates.org”,”bpi”:{“USD”:{“code”:”USD”,”symbol”:”$”,”rate”:”578.9950″,”description”:”United States Dollar”,”rate_float”:578.995},”GBP”:{“code”:”GBP”,”symbol”:”£”,”rate”:”398.7741″,”description”:”British Pound Sterling”,”rate_float”:398.7741},”EUR”:{“code”:”EUR”,”symbol”:”€”,”rate”:”507.7566″,”description”:”Euro”,”rate_float”:507.7566}}}

Bitpay API

Bitpay is an online payment service that allows you to carry out transactions with bitcoins. Application and service developers can connect to Bitpay API to integrate features such as invoice management, refunds, transactions, pricing, etc. into their products. And all this is achieved through HTTP calls made directly to Bitpay API using programming languages such as Node.js, PHP and Ruby. This application programming interface is based on the REST protocol (REST API).

The API’s operation is simple: any developer can perform a HTTP call to any resource in the API and the latter returns the requested information in JSON format. The process can become much more intuitive because Bitpay offers several specific libraries for this purpose: as we explained, libraries in multiple types of syntax; and open-source plugins that are also available on GitHub. These can be used to install content management systems such as Drupal and WordPress or e-commerce specific toolboxes such as Prestashop, Magento and WooCommerce. Since it is open source, it can be downloaded and improved by developers. 

API sessions are an interesting concept within Bitpay’s interface. This feature increases its security and privacy against replay attacks; also, it ensures that requests for information are processed in order of arrival even if the service is interrupted. Every HTTP call to the API is associated with a session ID (sessionID) and a request number (requestNumber). This process is bidirectional: 

Each additional HTTP request to the API results in a change to the requestNumber. The first one is assigned the number 1; the second is assigned the number 2… 

– If a customer makes a request and the service doesn’t return any information because the service has been interrupted, the developer can run the call again using the same requestNumber. The API returns the information if this has been cached; alternatively, it sends it from scratch. 

Coinbase APIs

Coinbase is possibly one of the most well-known platforms for buying, selling and using bitcoins. A big part of its success is based on its range of APIs: Merchants API, Exchange API and Network (Toshi) API (currently in beta phase). 

–  Merchants API: this REST API allows external developers to access and integrate all features offered by Coinbase Merchants into their applications; these features include accepting online payments in bitcoins and managing invoices. The API supports two types of authentication: an API key for customers to access their own accounts, and an OAuth2 protocol which creates access tokens for external developers. 

– Exchange API: application programming interface that allows other developers to design trading products using bitcoins and benefiting from secure and reliable access to the U.S. stock market. To capture data in real time programmers can resort to two libraries in two different types of syntax: one library is in Node.js (simplifies the return of information in JSON format and the execution of requests through the API’s endpoints) and the other library is in Ruby

Network (Toshi) API: Toshi is an open-source bitcoin node developed by Coinbase to design online apps on a large scale. It allows you to access aggregate blockchain data: retrieve the latest bitcoin blocks; carry out all kinds of transactions; and obtain information about transactions and balances.

If you want to try BBVA’s APIs, test them here.

It may interest you