There are thousands of public APIs available to serve our everyday needs. They span every imaginable category from weather forecasting to finance.
As the need for financial services grows, firms are coming up with innovative strategies to improve their client’s experience of their web and mobile applications. Companies are turning to both private and public APIs to achieve their development goals.
Financial institutions today utilize applications and software for virtually everything. APIs are indispensable tools that allow financial firms to facilitate their connectivity while at the same time improving service delivery.
One of the exchange APIs that is gaining traction in the financial industry with the rising interest in cryptocurrencies is coinlayer. Let’s take a look and see what makes it tick, and how you can easily implement it to meet your needs.
Table of Contents
What is coinlayer, and What Makes it Powerful?
apilayer, an Austrian technology company aiming to build a variety of reliable programming interfaces (APIs) and make them affordable for developers and startups built and maintains the coinlayer API. You can browse all of their available products here.
This article outlines coinlayer’s diverse API endpoints, available options, and integration guides for Python. It also takes a look at its interactive web-based dashboard (Jupyter Notebook), and desktop applications (Delphi).
Why Should You Use coinlayer to Provide Cryptocurrency Data?
coinlayer is extremely feature-rich. Here are some of its most significant benefits.
Real-Time & Historical Data:
Retrieve accurate live data and historical crypto rates all the way back to Bitcoin rates of 2011.
All data sent from and to the coinlayer API is secured via industry-standard 256-bit HTTPS encryption.
The coinlayer API is powered by a rock-solid distributed infrastructure and backed by an uptime SLA.
Fair Pricing Plans:
Make 500 monthly API calls for free — need more? Premium subscriptions start at only $9.99 monthly.
What Crypto Data Endpoints are Available via the API?
In total, the coinlayer API offers 6 API endpoints, each with different powerful functionalities. Here is a brief descripion:
- Live Data: Query the API for the latest available exchange rate data.
- Historical Data: Look up crypto rates for a specific date.
- Conversion Endpoint: Convert amounts between cryptocurrencies and target currencies.
- Time-Frame Data: Query the API for crypto data for a specific period.
- Change Data: Retrieve data about rate fluctuation for a specific period.
- List Endpoint: Retrieve a list of all available cryptocurrencies and target currencies.
How can I Access the coinlayer API?
First, get your API Credentials here, and set up your subscription plan:
API Access Key & Authentication
Next, to check if everything is working properly. Just run this URL in your web browser:
You see this API response:
HTTP GET Request Parameters for Live Data
|access_key||[Required] Your API access key.|
|target||[optional] Specify your preferred target currency. You can view all available symbols on the Target Currencies page.|
|symbols||[optional] Specify one or multiple (comma-separated) cryptocurrency symbols to be included in your API result. You can view all available values on the Available Cryptocurrencies page.|
|expand||[optional] Set to 1 to receive extended results. Learn more about Extended Results.|
|callback||[optional] Specify a JSONP callback function name according to the JSONP Callbacks section.|
Descriptions of each Response Object
|success||Returns true or false depending on whether or not the given API request was successful.|
|terms||Returns a URL leading to the coinlayer Terms of Service.|
|timestamp||Returns the exact time (UTC timestamp) the given crypto data was collected.|
|target||Returns the default or specified target currency.|
|rates||Returns a JSON array containing the requested cryptocurrency data.|
Common API errors
|404||404_not_found||The requested resource does not exist.|
|101||invalid_access_key||No API Key was specified or an invalid API Key was specified.|
|102||inactive_user||The account this API request is coming from is inactive.|
|103||invalid_api_function||The requested API endpoint does not exist.|
|104||usage_limit_reached||The maximum allowed API amount of monthly API requests has been reached.|
|105||function_access_restricted||The current subscription plan does not support this API endpoint.|
|106||no_rates_available||The current request did not return any results.|
|201||invalid_target_currency||An invalid target currency has been entered.|
|202||invalid_currency_symbols||One or more invalid symbols have been specified.|
|302||invalid_date||An invalid date has been specified [historical, convert].|
|403||invalid_conversion_amount||No or an invalid amount has been specified [convert].|
|501||no_timeframe_supplied||No or an invalid timeframe has been specified [timeframe].|
|502||invalid_start_date||No or an invalid “start_date” has been specified [timeframe, change].|
|503||invalid_end_date||No or an invalid “end_date” has been specified [timeframe, change].|
|504||invalid_time_frame||An invalid timeframe has been specified [timeframe, change].|
|505||time_frame_too_long||The specified timeframe is too long, exceeding 365 days [timeframe, change].|
How can I Track and Monitor Live Cryptocoin Prices with Python and coinlayer?
To get the latest crypto rates for all available cryptocurrencies use the following code to make an API request in Python:
# -*- coding: utf-8 -*-
r = requests.get("http://api.coinlayer.com/api/live?access_key=dd61c88c20c658209ab9639b8a5e29a9")
responses = r.json()
Here are the API responses inside the Python IDE:
# Bitcoin (BTC to USD):
# Ethereum (ETH to USD):
# Cardano (ADA to USD):
# Binance Coin (BNB to USD):
# Tether (USDT to USD):
# Ripple (XRP to USD):
# Dogecoin (DOGE to USD):
# Bitcoin Cash (BCH to USD):
# Litecoin (LTC to USD):
# Chainlink (LINK to USD)
Here is the API response inside your Python IDE:
How can I Develop a Web-Based Cryptocoin Price Tracking and Monitoring System with coinlayer and Jupyter Notebook?
You can easily build an interactive web-based Cryptocoin Live Price Tracker dashboard using the Python scripts in the previous section. All you need to do is run them inside Jupyter Notebook. If you have never used Jupyter Notebook before, visit the installation guide on the official website of Project Jupyter.
Here is the result:
Bonus: API Request using other Platform
How can I Make an API Request to coinlayer using the Delphi REST Debugger?
Download the Delphi REST Debugger here:
Choose the GET method, and send the request to the following URL:
Are You Ready to Build Your Own Live Cryptocoin Price Tracking and Monitoring System?
As you can see, the coinlayer REST API endpoint provides rich cryptocurrency data. You can connect this to any platform using any programming language you work with.
Here is a basic demo explaining how you can access live cryptocurrency prices using the coinlayer REST API for scripting, web, and desktop-based applications.
You can take advantage of the coinlayer free tier, but we recommend you upgrade your subscription plan for access to more powerful features. These include Conversion to All Target Currencies, More Extended Results, SSL Encryption, Time-Frame Endpoint, and many more! If you need a custom solution, contact us.
We can’t wait to see what you build with our REST API!