# Common Use Cases

### **GET logo images of coins**

Use coins/{id} endpoint, e.g. [https://api.coingecko.com/api/v3/coins/bitcoin](<https://api.coingecko.com/api/v3/coins/bitcoin&#xA;>) . You can also use this endpoint to receive other metadata like: links, categories, contract address, community, description in different languages and more.[<br>](<https://api.coingecko.com/api/v3/coins/bitcoin&#xA;>)

### **Best endpoint to get the latest price**

Use coins/simple endpoint. e.g. <https://api.coingecko.com/api/v3/coins/bitcoin> . This endpoint can also return market data like market cap, 24hour trading volume and 24hour price change %. \
Note: the data update frequency (or cache) for Pro API is around 30-40 seconds.  Public API may take 2 minutes or more to update the last price.&#x20;

### **Building a telegram bot to alert users on the latest coins listed on CoinGecko, which endpoint should I use?**

Use coins/list/new endpoint, it is the fastest endpoint to that return the latest coins (ids and activated time) added on CoinGecko. This is an exclusive endpoint for Pro API users, subscribe to any [paid plan](https://www.coingecko.com/en/api/pricing) to access it.  Note: the data update frequency (or cache) this endpoint is around 30 seconds.

### **GET all trading pairs (tickers) of a coin**

Use coins/{id}/tickers, e.g. [https://api.coingecko.com/api/v3/coins/uniswap/tickers<br>](<https://api.coingecko.com/api/v3/coins/uniswap/tickers&#xA;>)

### **GET trading pairs of specific coins from a specific exchange**

To get trading pairs of Uniswap from Binance only, you may use coins/{id}/tickers or /exchanges/{id}/tickers and insert the right param to filter. e.g.

* <https://api.coingecko.com/api/v3/coins/uniswap/tickers?exchange_ids=binance>
* [https://api.coingecko.com/api/v3/exchanges/binance/tickers?coin\_ids=uniswap<br>](<https://api.coingecko.com/api/v3/exchanges/binance/tickers?coin_ids=uniswap&#xA;>)

### **GET list of coins under specific category**

Use /coins/markets and category parameter to filter. e.g. the links below help you to get all the coins that are tagged as 'stablecoins' and 'arbitrum ecosystem' on CoinGecko.com. &#x20;

* [https://api.coingecko.com/api/v3/coins/markets?vs\_currency=usd\&category=stablecoins\&order=market\_cap\_desc\&per\_page=100\&page=1\&sparkline=false](<https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd\&category=stablecoins\&order=market_cap_desc\&per_page=100\&page=1\&sparkline=false&#xA;>)
* [https://api.coingecko.com/api/v3/coins/markets?vs\_currency=usd\&category=arbitrum-ecosystem\&order=market\_cap\_desc\&per\_page=100\&page=1\&sparkline=false](<https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd\&category=stablecoins\&order=market_cap_desc\&per_page=100\&page=1\&sparkline=false&#xA;>)[<br>](<https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd\&category=stablecoins\&order=market_cap_desc\&per_page=100\&page=1\&sparkline=false&#xA;>)

### Identify a list of DEX decentralised exchanges

1. Use [https://api.coingecko.com/api/v3/exchanges/list   ](<https://api.coingecko.com/api/v3/exchanges/list&#xD;&#xA;>) to get the full list of exchanges (id) on CoinGecko.com&#x20;
2. Use /exchanges/{id} to find out if an exchange is centralized (CEX) or not (DEX). Repeat the same for other exchanges.  e.g. <https://api.coingecko.com/api/v3/exchanges/uniswap_v3>

   <pre data-title="uniswap is DEX"><code>"centralized":false
   </code></pre>

### GET Bitcoin dominance data&#x20;

Use [https://api.coingecko.com/api/v3/global](<https://api.coingecko.com/api/v3/global&#xD;&#xA;>). It will show the total (global) market cap, as well as dominance % of BTC, ETH and more.

```
"market_cap_percentage": {
      "btc": 39.3896058954608,
```

### GET the market cap or dominance of a specific ecosystem

Use [https://api.coingecko.com/api/v3/coins/categories](<https://api.coingecko.com/api/v3/coins/categories&#xD;&#xA;>) , it will also return their 24hour percentage change, which can be useful to know which category or ecosystem is receiving traction.  You may also compare this endpoint against global market cap data.&#x20;

### GET all the coins of a specific blockchain network (by contract address)

1. First, you would have to identify the ID for the chain you are looking for using the [asset platform endpoint](https://api.coingecko.com/api/v3/asset_platforms).  Note: only coins that have contract address added by the CoinGecko team will be shown. (Learn more [here](/coingecko-api-guide/getting-started/10-min-tutorial-guide/1-get-data-by-id-or-address.md#b-coin-contract-address))
2. Once you have identified the chain ID, replace the correct ID in this link below <https://tokens.coingecko.com/\\><ID>/all.json . e.g.

```
 https://tokens.coingecko.com/arbitrum-one/all.json
```

Alternatively, you may also use /coins/list endpoint with the parameter include\_platform=true. This allows you to view all the coins listed on CoinGecko, and their respective blockchain networks.

{% code overflow="wrap" %}

```
https://api.coingecko.com/api/v3/coins/list?include_platform=true
```

{% endcode %}

### GET the 7-day sparkline price data of a coin

You may flag 'sparkline' parameter with the **/coins/{id}** and **/coins/markets** endpoints, for example:

```
https://api.coingecko.com/api/v3/coins/bitcoin?sparkline=true
```

```
https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=100&page=1&sparkline=true
```

### **I want to get a link to individual CoinGecko coin page, how do I do that?**

You may insert the API id with this URL format: *[www.coingecko.com/en/coins/{\*\*web\\\_slug\*\*}](http://www.coingecko.com/en/coins/{**web\\_slug**})*   For example: <https://www.coingecko.com/en/coins/bnb>&#x20;

web\_slug data can be obtained in the following endpoints:

* &#x20;`/coins/{id}`
* &#x20;`/coins/{id}/contract/{contract_address}`

### How do I check if a coin status is still active on CoinGecko and if the price update is stale?

To check if a coin is active or not, you may refer to the [**/coins/list**](<https://api.coingecko.com/api/v3/coins/list&#xA;>) endpoint, only active coins will be shown here.&#x20;

To check if a price is stale, you may use one of the following methods:

* use **/coins/{id}** endpoint , and look for 'last\_updated' timestamp data.
* use **/simple/price** endpoint, and insert the parameter include\_last\_updated\_at=true to check the latest update time. <br>

### How do I get the real-time and historical exchange of BTC in USD?

To check the current exchange rate, you may use the **`/exchange_rates`** endpoint ([test](https://api.coingecko.com/api/v3/exchange_rates)).

To check the historical exchange rate, you may use **`/coins/{id}/history`** (or **`/coins/{id}market_chart`**) endpoint to get the historical price of BTC in USD on a specific date. &#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://coingecko-api.gitbook.io/coingecko-api-guide/getting-started/common-use-cases.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
