How to Create a Cryptocurrency Exchange Rates using Coinlayer API?

• 8 minutes READ

Back in 2008, a group of people hidden behind the Satoshi Nakamoto figure, developed Bitcoin, a peer-to-peer distributed currency, based on the concept of blockchain. It’s been a wild ride since then. Everyone is in the hunt for the digital currency lion’s share. That’s good news for developers, because, as impactful as it is, the blockchain ecosystem is still far from maturity. The window of opportunity is still open, and with APIs like coinlayer, anyone can get ahead of the pack.

While, by design, the blockchain is decentralized, the ecosystem itself is centered around nodes and communities.  Countless tools, communities, and APIs have surfaced since 2011. I’ve played with many tools, and I was an active member in many communities because I find the blockchain a fantastic concept, one that can change our lives.

Coinlayer, the Cryptocurrency Exchange API

Coinlayer is my favorite choice for anything related to cryptocurrencies. I used the API in a few projects, including a rather popular Android app. Of course, by the time I discovered coinlayer and had sufficient knowledge of cryptocurrencies, I had already sold my stash of Bitcoins. Unfortunately, it was before the Bitcoin explosion, so… no island in the Pacific for me.

Coinlayer, the Real Time Crypto Currency API

Anyway, coinlayer provides actual crypto rates for more than 385 crypto coins. The exchange rates are based on data from the top 25 exchange markets. This means that accuracy is guaranteed. On top of that, the coinlayer API is backed by a resilient cloud infrastructure that delivers data in milliseconds.

Supported Coins

coinlayer supports all popular digital currencies. However, the beauty of coinlayer it’s the extended support for less popular coins, which makes it a versatile tool for any needs. The portfolio of supported currencies covers cryptic coins such as Unobtanium (UNO), Status Network Token (SNT) or (POE). It even provides exchange rates for PutinCoin (PUT) and its nemesis President Trump (PRES). How is that for decentralized politics?

Coinlayer supported coins

Anyway, the idea is that the coinlayer API supports any digital currency that has at least some kind of value. Furthermore, the API provides valuable historical data on all supported cryptocurrencies.

No-Code Email Template Builder

With Postcards Email Builder you can create and edit email templates online without any coding skills! Includes more than 100 components to help you create custom emails templates faster than ever before.

Free Email BuilderFree Email Templates

Available Target Currencies

The API supports conversions to a total of 166 world currencies. Unlike other similar APIs where you may need to make some time adjustments, coinlayer works out-of-the-box for any marked specific project.

Coinlayer Real World Currencies

Off-shore enthusiasts should also know that the API also supports the Seychellois Rupee (SCR). All joking aside, the coinlayer API covers all relevant financial markets.

Getting Started

What I like about the most about the API is how easy it is to use it. It’s really a point and forget API. It’s the type of API where you don’t need to spend hours reading the documentation or googling for answers. Even the errors are detailed and informative. For newcomers, the onboarding is made easy via a Quickstart tool that showcases all of the API’s features.

Coinlayer Quick Start

Once you complete the sign-up process, you’ll get a perpetual free API key. This is more than enough for testing purposes and should suffice for basic usage just fine.

After your login, you’ll get a box where you can test the API. Running the base query will return data for all available cryptocurrencies in JSON format and can be extended via endpoints. For ease of use, required query parameters are marked with orange, optional parameters with blue.

The basic structure consists of the base URL, the endpoint (live, list, convert, etc.), the API access key, endpoint specific parameter and optional parameters. The response returns the success status of the query, links to the terms and the privacy pages, particular endpoint attributes, the target currency, and specific endpoint datasets. coinlayer supports JSON Callbacks, so the result can be wrapped inside a function via the optional callback GET parameter.

The coinlayer API Endpoints

The coinlayer API provides six different endpoints: Live Data, Historical Data, Conversion, Time-Frame Data, Change Data and the List Endpoint.

Live Data Endpoint
    ? access_key = ACCESS_KEY

The main endpoint is Live Data. This endpoint returns the latest exchange rates.

Low-Code Website Builders

With Startup App and Slides App you can build unlimited websites using the online website editor which includes ready-made designed and coded elements, templates and themes.

Try Startup App Try Slides AppOther Products

By default, it will return all cryptocurrencies rate, but it can be customized via parameters to display specific rates and details. For example, you can add the target parameter to return a particular currency or the symbols parameter to cryptocurrency symbols. The response includes the following datasets:

  • timestamp – the UTC timestamp when the data is collected;
  • target – the target currency;
  • rates – the JSON array containing the requested data.

Expand option

Pretty basic until now right? Well, if you add the expand option, the API will return additional data with the API response.

COinlayer Extended Parameter

For example, if you set the target to Bitcoin, and use the expand parameter, the API will return the following additional fields:

  • rates > rate – the current exchange rate Bitcoin;
  • rates > high – the highest midpoint exchange rate recorded;
  • rates > low – the lowest midpoint exchange rate recorded on the requested date;
  • rates > vol – the volume of Bitcoin coins exchanged on a requested date;
  • rates > cap – the current Bitcoin market cap;
  • rates > sup – the current availability of Bitcoins.

Historical Rates Endpoint
    ? access_key = ACCESS_KEY

The most valuable endpoint, in my case, was the Historical Rates endpoint. It’s incredible the type of data that can be extracted via the API, especially if you throw in some machine learning.  The endpoint returns historical data for all currencies since their inception. This endpoint is invoked by adding the date format to the end of the API’s base URL.

Coinlayer Historical Data Endpoint

The query will return the following results:

  • timestamp – the UTC timestamp) the crypto data was collected;
  • target – the target currency;
  • historical – true if historic data is available;
  • date – returns the date for which the historical rate is requested;
  • rates – returns a JSON array containing the requested data;

Conversion Endpoint
    ? access_key = ACCESS_KEY
    & from = BTC
    & to = ETH
    & amount = 10

Converting cryptocurrencies to standard currencies, or vice versa, is done via the Conversion endpoint by appending three required parameters:

  • from – to specify the code of the currency to convert from;
  • to – to define the code of the coin to convert to;
  • amount – to specify the amount to be converted.
Coinlayer Conversion Endpoint

The API response will return detailed information on the currency conversion operation:

  • query > from – the code of the source currency;
  • query > to – the code of the target currency;
  • query > amount – the amount converted;
  • info > timestamp – the UTC timestamp for exchange rate;
  • info > rate – the exchange rate;
  • result – the conversion result.

Change Data
    ? access_key = ACCESS_KEY
    & start_date = 2018-04-01
    & end_date = 2018-04-30
    & symbols = BTC,ETH,XRP

The Change endpoint is an essential tool for those into the analytics side of the cryptocurrency phenomenon. By adding the start_date and end_date to the base URL, the API will return the fluctuation of a specific currency in the date interval.

Coinlayer Conversion Endpoint

Using this endpoint, the API will return the following data sets:

  • rates > start_rate – the cryptocurrency’s exchange rate at the start date.
  • rates > end_rate – the cryptocurrency’s exchange rate at the end date.
  • rates > change – the absolute margin between start and end rate.
  • rates > change_pct – the percentage change within the specified period.

Time-Frame Data Endpoint
    ? access_key = ACCESS_KEY
    & start_date = 2018-04-01
    & end_date = 2018-04-30
    & symbols = BTC,ETH

Similar to the change endpoint, the Timeframe endpoint will provide time series crypto data between two specific dates.

Coinlayer Time frame Data

Just add the start_date and end_date to the base URL and the API will return a consecutive set of data:

  • timeframe – true whenever a request to the timeframe is made;
  • start_date – returns the requested start date;
  • end_date – returns the requested end date;
  • target – the default or specified target currency.
  • rates > YYYY-MM-DD – provides a JSON object containing crypto data for each day in the requested

List Endpoint

    ? access_key = _ACCESS_KEY

The List endpoint returns all supported currencies including both crypto and standard currencies.

Coinlayer List ENdpoints

Here are the datasets:

  • symbol – returns the token of the cryptocurrency;
  • Name – the short name of the cryptocurrency;
  • name_full –  the extended name of the cryptocurrency and its token;
  • max_supply – the current maximum amount of circulating supply;
  • icon_url – displays an URL to a PNG icon of the respective cryptocurrency.

Use Case Scenarios

Coinlayer is the best place to start for anything related to cryptocurrencies. For example, developers can use coinlayer to add a cryptocurrency exchange functionality into a website or in a mobile app for a financial services or digital currency trading business. coinlayer is the perfect choice for real-time reliable exchange rates for all relevant cryptocurrencies in real time. Basically, anyone looking for integrating live reference prices into their projects should consider the coinlayer API.

Coinlayer can also be used with various chatbot frameworks such as Microsoft Bot Framework, to add a layer of interactivity to chatbots and increase their lead over their competitors. Of course, chatbots are yet to become as popular as once anticipated, but, as AI routines become more polished, chatbots will become key elements in automation processes, especially in volatile financial environments.

But coinlayer is so much more than an API for apps and services. In conjunction with machine learning and charting libraries, coinlayer can be used for building analytic apps that provide valuable real-time insights into the current state of the blockchain. Also, considering that API’s extensive capabilities with historical cryptocurrencies datasets, developers can use coinlayer to create predictive models for the future of blockchain.


As I’ve mentioned above, coinlayer offers a free tier for anyone looking to test the APIs capabilities. The free tier provides up to 500 requests per month, and, while it supports all cryptographic coins, it is limited to US dollars for target currencies. It also comes with the Historic endpoint, so it’s perfect for private use.

However, for just 9.99$ per month, the request limit can be extended to 5000 requests per month plus access to the almighty extended results parameter we’ve talked above. For those who need more requests per month, additional endpoints and faster currency updates, the Professional and the Professional Plus tiers throw in additional endpoints and faster exchange rates updates.

Coinlayer Pricing

Regardless of the tier you chose, coinlayer guarantees excellent support, response times as low as 20 milliseconds, and a extensive and interactive API documentation. And that’s where the competition has a lot to learn.

The future is in the blockchain

The blockchain is here to stay. Major players around the world have adopted the spirit of blockchain into their operations. Enthusiasts around the world are mining or trading cryptocurrencies. Researchers and innovators are feeding the “monster” with data and hashes. Everyone has the chance to start from the same positions in the blockchain race.

With coinlayer you even can get in the front. So, if you have any questions on blockchain or coinlayer, drop a comment. If you have an alternative tool, you’ve got my attention. If you want to showcase any projects build with coinlayer, or with any other tool, you’ve definitely got my attention.

Doru Ciobanu

Doru is an old BMW lover with a big heart.

Posts by Doru Ciobanu