Coingecko API Guide

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:

  1. get the current price of a coin,

  2. get the current data of a coin,

  3. get the exchange list,

  4. trending statistics.

Get the current price

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:

  1. Launch API Tester and create a new request by tapping on the โ€œplusโ€ icon.

  2. Select the GET request type.

  3. In the screen that opens, enter the following endpoint URL in the address field:

    https://api.coingecko.com/api/v3/simple/priceโ€จ
  4. 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.

  5. 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:

Get the current data

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:

https://api.coingecko.com/api/v3/coins/bitcoin

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:

Exchanges

Now we will get a list of all exchanges active with trading volumes. Endpoint for this request is following:

https://api.coingecko.com/api/v3/exchanges

There are two optional but very important parameters for this request: "per_page" and "page":

  1. The first one is responsible for the number of elements on the page.

  2. 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:

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:

https://api.coingecko.com/api/v3/search/trending

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:

Last updated