Methods to query price & market data of coins
a. Coin ID
Using /simple/price endpoint as example:
https://pro-api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd&x_cg_pro_api_key=YOUR_API_KEYThe provided endpoint URL includes parameters such as
ids=bitcoinandvs_currencies=usd, indicating that the intention to retrieve the current price of Bitcoin in US Dollars.
How to obtain Coin ID aka API ID? There are 3 options:
Use /coins/list endpoint, example of responses:
json[ ...... \{ "id": "bitcoin", 👈 "symbol": "btc", "name": "Bitcoin" \}, ...... ]View the full list of coins with API ID, symbol and name using this Google Sheet.
Look for the "API ID“ by visiting the info section of a coin page on CoinGecko:
<img src="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/7bf604e-image.png?fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=ca1093ad1577a2160c53ee6ea3c9de8c" data-og-width="2122" width="2122" data-og-height="1256" height="1256" data-path="images/docs/7bf604e-image.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/7bf604e-image.png?w=280&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=58b6818eb39f1cc1cb13bfb1b827e9ef 280w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/7bf604e-image.png?w=560&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=debd856f53bd0349a94586da15246140 560w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/7bf604e-image.png?w=840&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=4995bc412246ed062435c7700fce33b0 840w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/7bf604e-image.png?w=1100&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=54503566448e1f70bfd6e3938ff18830 1100w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/7bf604e-image.png?w=1650&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=45f0c1afb1803886ff058fe7682a3a2a 1650w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/7bf604e-image.png?w=2500&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=f3d3d13f19af39c3c2918e06f9552bd6 2500w" />
b. Contract Address
Other than using Coin ID, you may also query price & market data of a coin using contract address, using /simple/token_price/\{id} endpoint as example:
https://pro-api.coingecko.com/api/v3/simple/token_price/ethereum?contract_addresses=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&vs_currencies=usd&x_cg_pro_api_key=YOUR_API_KEY
There are 3 parameters values required to apply for this endpoint:
id:Ethereum(Asset Platform ID)contract_addresses:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48(Contract Address)vs_currencies:usd(Target Currencies)
How to obtain Coins/Tokens Contract Address
Use /coins/list endpoint (
include_platform=true), example of responses:json[ ...... \{ "id": "1inch", "symbol": "1inch", "name": "1inch", "platforms": \{ "ethereum": "0x111111111117dc0aa78b770fa6a738034120c302", "avalanche": "0xd501281565bf7789224523144fe5d98e8b28f267", "binance-smart-chain": "0x111111111117dc0aa78b770fa6a738034120c302", "near-protocol": "111111111117dc0aa78b770fa6a738034120c302.factory.bridge.near", "energi": "0xdda6205dc3f47e5280eb726613b27374eee9d130", "harmony-shard-0": "0x58f1b044d8308812881a1433d9bbeff99975e70c", "polygon-pos": "0x9c2c5fd7b07e95ee044ddeba0e97a665f142394f" \} \}, ...... ]Look for the "Contract“ by visiting the info section of a coin page on CoinGecko.
Notes
- Not all coins will have a contract address listed on the CoinGecko site.
- If an address is not shown on the CoinGecko page, you will not be able to query the coin by its contract address via the API.
- The contract addresses are curated by the CoinGecko team, if you find out any missing contract address, feel free to share with us to review.
<img src="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/576675c-image.png?fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=d16b2cfd819ece1c689f6595081edcad" data-og-width="2096" width="2096" data-og-height="1484" height="1484" data-path="images/docs/576675c-image.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/576675c-image.png?w=280&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=2e16c3e076d1cd3f43af7fb949d2382a 280w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/576675c-image.png?w=560&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=e46ee9cc8a1f9be560c3ea1940695a02 560w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/576675c-image.png?w=840&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=c19faccaebd60eeeb79e8305ca20c609 840w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/576675c-image.png?w=1100&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=68ad652fdbc4fc6739daaf8f0121a548 1100w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/576675c-image.png?w=1650&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=330f42772de72f72af2759e0c417db30 1650w, https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/576675c-image.png?w=2500&fit=max&auto=format&n=a7cplMjqO5fc2v5e&q=85&s=d9a988b003d06757a4f9886a9e047d58 2500w" />
Get the token contract address from project website, white-paper, documentation, or block explorer site: