Coingecko API Guide
Last updated
Last updated
The CoinGecko API allows us to retrieve cryptocurrency data such as price, volume, market cap, and exchange data from CoinGecko using HTTP requests.
No registration and access tokens are required to work with the CoinGecko REST API! All you need to send GET requests is just an endpoint and in some cases query parameters.
In this guide we will review the following requests:
get the current price of a coin,
get the current data of a coin,
get the exchange list,
trending statistics.
There is a common parameter for all requests - the coin ID. You can find it on the coin page in the Info section for the "API id" label. To find the coin page, you can use the site search. Let's take this as an example of BNB:
To get the current price of any cryptocurrencies in any other supported currencies that you need:
Launch API Tester and create a new request by tapping on the “plus” icon.
Select the GET request type.
In the screen that opens, enter the following endpoint URL in the address field:
Add the "ids" parameter and set the coin IDs separated by commas as the value in the Query Params section. This parameter will be automatically added to the query string.
Add the "vs_currences" parameter. As a value, set the currencies in which you want to get the price.
Enter the values for the parameters separated by commas without spaces!
After setting all neccessary parameters tap the send request button. The server will return the following response:
You can import this request into API Tester app via these links:
curl -X GET 'https://api.coingecko.com/api/v3/simple/price?ids=binancecoin,bitcoin&vs_currencies=usd'
Let`s get current data (name, price, market, ... including exchange tickers) for a coin! The coin id is a required parameter for this request. The "id" parameter is part of the query string, it may look like this:
But this request also has a lot of optional parameters that affect what data the server will return. We use only one of the optional parameters, this will allow us to receive data in one language: localization=false. We will get the response as in the second screenshot below:
You can import this request into API Tester app via these links:
curl -X GET 'https://api.coingecko.com/api/v3/coins/bitcoin?localization=false'
Now we will get a list of all exchanges active with trading volumes. Endpoint for this request is following:
There are two optional but very important parameters for this request: "per_page" and "page":
The first one is responsible for the number of elements on the page.
The second one is responsible for the number of the current page.
We will use pagination to avoid overloading the server and client. The server will return the data in parts. Let's set the page size as 10 and the page number as 1. We will get the response as in the second screenshot below:
You can import this request into API Tester app via these links:
curl -X GET 'https://api.coingecko.com/api/v3/exchanges?per_page=10&page=1'
And finally, let's get some interesting statistics provided by CoinGecko: Top-7 trending coins on CoinGecko as searched by users in the last 24 hours (Ordered by most popular first). Endpoint for this request following:
There are no additional parameters here. The server returned LUNA in the first place, what will the server return when you will make a request?
You can import this request into API Tester app via these links:
curl -X GET 'https://api.coingecko.com/api/v3/search/trending'