The CoinGecko API provides cryptocurrency trading information in real-time that can be used to track global market prices across 450+ exchanges. The CoinGecko REST API publishes cryptocurrency information in the JSON format that can be coded into websites, mobile applications, cloud software, and spreadsheets. Data from the API includes current prices for Bitcoin as well as over 6,500 altcoins with trading volume, historical records, and additional crypto exchange resources. The CoinGecko API is free to use up to 100 requests per minute.
Cryptocurrencies like Bitcoin, Ethereum, Litecoin, Dogecoin, Ripple, Tron, Dash, Cardano, and thousands of others trade 24/7/365 on open exchanges worldwide. Developers building websites and mobile applications with PHP, Python, Ruby, and JavaScript can use the code snippets below to add data from the CoinGecko API into their apps.
Sign up for a free account at RapidAPI to access this service and generate a free API key that you can use when building custom software applications.
About the CoinGecko API
CoinGecko was originally founded in 2014 by TM Lee and Bobby Ong in Singapore. The company first published global reports on the cryptocurrency marketplace with a focus on real-time insights. In 2018, the CoinGecko API was launched as a free global service with support for over 20 endpoints. CoinGecko has subsequently launched a feature-rich set of iOS and Android apps, extending their platform support to derivatives, DeFi, yield farming, and NFTs. The company has over 10 million users and delivers more than 10 billion API calls every month in support of cryptocurrency trading apps.
Crypto Trading: View all of the cryptocurrencies supported by the CoinGecko API.
The CoinGecko API has multiple endpoints that allow developers to ping the service and retrieve information about coins, exchanges, status updates, events, exchange rates, or global variables. The service currently supports over 6,500 cryptocurrency coins and 450 trading exchanges.
The CoinGecko API allows websites and mobile applications to include comprehensive historical data from crypto price records into their displays. The CoinGecko API service supports cryptocurrency wallets, DeFi applications, block explorers, data aggregators, professional media services, and other innovative crypto trading platforms.
What is the CoinGecko API?
The CoinGecko API is a comprehensive resource supporting both real-time and historical price discovery for cryptocurrency trading applications. CoinGecko offers a wider platform of cryptocurrency resources which includes reports on different coins and exchanges, as well as portfolio management and wallet information. The CoinGecko API is designed to function by providing real-time updates on cryptocurrency prices. The service now also supports DeFi and yield farming. Decentralized finance or DeFi coins are used by traders to swap between different coin exchanges. CoinGecko records the historical price, volume, and market capitalization of these coins, as well as those used by various NFT platforms like Theta, Chiliz, Enjin, Decentraland, Rarible, etc. The most popular DeFi coins are currently Uniswap, Chainlink, Terra, PancakeSwap, and Aave.
Crypto App Development: Build data-driven visualizations with rich chart displays for customized crypto trading applications on web and mobile with any UI framework.
The CoinGecko API is used by cryptocurrency wallet services like Trezor, MetaMask, MEW, Electrum, MyCrypto, BitGo, and Infinito for price discovery and current trading information. The service is relied on by decentralized finance applications like Curve, Chainlink, Kyber Network, Zapper.fi, Balancer, Frontier, Zerion, and Aave. Block explorers like Etherscan, EOSPark, cryptoID, Blockchair, Cosmostation, and CoinExplorer also utilize real-time pricing information from CoinGecko. DappRadar, MNO, and other data aggregators use the API for historical prices, trading charts, and exchange reports. The CoinGecko API is also used by professional media publishers like TomoChain, HummingBot, Status, and ForkLog for rich media displays.
How does the CoinGecko API work?
The CoinGecko API is based on the OpenAPI Specification and provides a swagger.json file to declare the available commands for the service. Swagger standardizes the API with JSON and YAML declarations that establish the parameters for queries and authorization. With Swagger Codegen, client libraries in over 40 programming languages are implemented. The current version of the CoinGecko API (v3) does not require an API key to use for the free service. Developers can utilize the service with RapidAPI keys for preferential connections. The free service supports up to 100 queries per minute. Sign up for a free account at RapidAPI to use the platform.
CoinGecko API V3: List of API Commands:
The contents of the CoinGecko swagger.json file are used to define the API call structure: Download or view the swagger.json file for CoinGeck API v3.
The available programming queries to the CodeGecko API service are:
Ping:
- GET /ping [Check API server status]
Simple:
- GET /simple/price [Get the current price of any cryptocurrencies in any other supported currencies that you need.]
- GET /simple/token_price/{id} [Get the current price of tokens (using contract addresses) for a given platform in any other currency that you need.]
- GET /simple/supported_vs_currencies [Get list of supported_vs_currencies.]
Coins:
- GET /coins/list [List all supported coins id, name, and symbol (no pagination required).]
- GET /coins/markets [List all supported coins price, market cap, volume, and market-related data.]
- GET /coins/{id} [Get current data (name, price, market, … including exchange tickers) for a coin.]
- GET /coins/{id}/tickers [Get coin tickers (paginated to 100 items).]
- GET /coins/{id}/history [Get historical data (name, price, market, stats) at a given date for a coin.]
- GET /coins/{id}/market_chart [Get historical market data to include price, market cap, and 24h volume (granularity auto).]
- GET /coins/{id}/market_chart/range [Get historical market data to include price, market cap, and 24h volume within a range of timestamp (granularity auto).]
- GET /coins/{id}/status_updates [Get status updates for a given coin (beta).]
- GET /coins/{id}/ohlc [Get coin’s OHLC (Beta).]
- GET /coins/{id}/contract/{contract_address} [Get coin info from contract address.]
- GET /coins/{id}/contract/{contract_address}/market_chart/ [Get historical market data include price, market cap, and 24h volume (granularity auto) from a contract address.]
- GET /coins/{id}/contract/{contract_address}/market_chart/range [Get historical market data include price, market cap, and 24h volume within a range of timestamp (granularity auto) from a contract address.]
Exchanges:
- GET /exchanges [List all exchanges.]
- GET /exchanges/list [List all supported markets id and name (no pagination required).]
- GET /exchanges/{id} [Get exchange volume in BTC and top 100 tickers only.]
- GET /exchanges/{id}/tickers [Get exchange tickers (paginated, 100 tickers per page).]
- GET /exchanges/{id}/status_updates [Get status updates for a given exchange (beta).]
- GET /exchanges/{id}/volume_chart [Get volume_chart data for a given exchange (beta).]
Finance Platforms:
- GET /finance_platforms [List all finance platforms.]
- GET /finance_products [List all finance products.]
Indexes:
- GET /indexes [List all market indexes.]
- GET /indexes/{market_id}/{id} [get market index by market id and index id.]
- GET /indexes/list [list market indexes id and name.]
- GET /indexes/list_by_market_and_id/{market_id}/{id} [get market index by market id and market index id.]
Derivatives:
- GET /derivatives [List all derivative tickers.]
- GET /derivatives/exchanges [List all derivative exchanges.]
- GET /derivatives/exchanges/{id} [show derivative exchange data.]
- GET /derivatives/exchanges/list [List all derivative exchanges name and identifier.]
Status Updates:
- GET /status_updates [List all status_updates with data (description, category, created_at, user, user_title and pin).]
Events:
- GET /events [Get events, paginated by 100.]
- GET /events/countries [Get the list of event countries.]
- GET /events/types [Get the list of event types.]
Exchange Rates:
- GET /exchange_rates [Get BTC-to-Currency exchange rates.]
Search:
- GET /search/trending [Get trending search coins (Top-7) on CoinGecko in the last 24 hours.]
Global:
- GET /global [Get cryptocurrency global data.]
- GET /global/decentralized_finance_defi [Get cryptocurrency global decentralized finance(defi) data.]
The commands listed above can be used to retrieve information from the CoinGecko API to build the required functionality for customizing cryptocurrency websites and mobile applications. Developers can use the code snippets below or widgets.
CoinGecko API Endpoints: Get coin history, status charts, market information, trading ranges, historical statistics, and other real-time updates for altcoin trading applications.
Who is the CoinGecko API for exactly?
The CoinGecko API is used by many of the world’s leading cryptocurrency applications. These include cryptocurrency wallets, trading portals, banks, discovery applications, decentralized finance platforms, yield farming utilities, and NFT galleries. Developers programming in C++, Go, NodeJS, .Net, PHP, Python, Java, and Kotlin can access unofficial clients for the CodeGecko API on GitHub. The service supports over 40 programming languages through the Open API Specification and swagger.json.
RapidAPI users can take advantage of the platform for scripting and connection services. The X-RapidAPI-Key and Host values will be automatically populated in your code after sign-up for a free account. The RapidAPI gateway for the CoinGecko API has a latency of around 100 ms and 100% uptime in 2021. Developers can access free real-time and historical cryptocurrency market data such as price, market cap, volume, developer stats, social activity, and more. The CoinGecko API now supports over 6500 cryptocurrencies such as Bitcoin, Ethereum, Litecoin, EOS, Grin, Stellar, and Dogecoin.
Tutorial: How to Connect to the CoinGecko API
To build the CodeGecko API into any website or mobile application, sign in to the RapidAPI website and navigate to the resource page. Under the “Endpoints” tab, there is a reference table with a drop-down menu supporting all of the available programming languages. The CodeGecko API has code snippets available for 19 of the most popular programming languages for web design and mobile app development. RapidAPI will auto-populate the API key and developer code for the service into the code. Insert the custom parameters for each cryptocurrency coin or exchange to complete the template.
Developers can use the code snippets listed below to build applications using the CodeGecko API with PHP, Python, Ruby, or JavaScript. There are over 20 endpoints for the API, where each endpoint can be invoked by multiple different methods with each programming language. Choose the particular method from the RapidAPI interface that best suits your existing codebase or programming preference and style. The examples below show some introductory methods to get started with the CoinGecko API.
PHP Code Snippets:
For PHP applications and websites, there are four different methods with which the CoinGecko API code can be input into a web page or mobile app. Developers have the options to use cUrl, HTTP, or a Unirest request. Which one is chosen is determined by the personal preferences of the programmer. For this tutorial, we will use an HTTP method to illustrate the basic API calls and variable options for the CoinGecko service.
Embed the CoinGecko API with an HTTP request in PHP to call the complete coin list:
<?php $request = new HttpRequest(); $request->setUrl('https://coingecko.p.rapidapi.com/coins/list'); $request->setMethod(HTTP_METH_GET); $request->setHeaders([ 'x-rapidapi-key' => 'insert-your-api-key-here', 'x-rapidapi-host' => 'coingecko.p.rapidapi.com' ]); try { $response = $request->send(); echo $response->getBody(); } catch (HttpException $ex) { echo $ex; }
This query returns the complete list of cryptocurrency coins supported by the CoinGecko API service. At the current time, this includes 6,877 coins. Developers can use this list to retrieve the Coin ID for use in other API queries:
[100 items 0:{3 items "id":"01coin" "symbol":"zoc" "name":"01coin" } 1:{3 items "id":"0-5x-long-algorand-token" "symbol":"algohalf" "name":"0.5X Long Algorand Token" } 2:{3 items "id":"0-5x-long-altcoin-index-token" "symbol":"althalf" "name":"0.5X Long Altcoin Index Token" } 3:{3 items "id":"0-5x-long-balancer-token" "symbol":"balhalf" "name":"0.5X Long Balancer Token" } 4:{3 items "id":"0-5x-long-bitcoin-cash-token" "symbol":"bchhalf" "name":"0.5X Long Bitcoin Cash Token" } 5:{3 items "id":"0-5x-long-bitcoin-sv-token" "symbol":"bsvhalf" "name":"0.5X Long Bitcoin SV Token" } 6:{3 items "id":"0-5x-long-bitcoin-token" "symbol":"half" "name":"0.5X Long Bitcoin Token" } 7:{3 items "id":"0-5x-long-cardano-token" "symbol":"adahalf" "name":"0.5X Long Cardano Token" } 8:{3 items "id":"0-5x-long-chainlink-token" "symbol":"linkhalf" "name":"0.5X Long Chainlink Token" } 9:{3 items "id":"0-5x-long-cosmos-token" "symbol":"atomhalf" "name":"0.5X Long Cosmos Token" } 10:{3 items "id":"0-5x-long-defi-index-token" "symbol":"defihalf" "name":"0.5X Long DeFi Index Token" } ...
Search the list for the token ID you need for the support of specific cryptocurrency coins in applications. Save these values for other API queries to support price discovery.
To retrieve a similar list of supported cryptocurrency exchanges, use the code:
<?php $request = new HttpRequest(); $request->setUrl('https://coingecko.p.rapidapi.com/exchanges/list'); $request->setMethod(HTTP_METH_GET); $request->setHeaders([ 'x-rapidapi-key' => 'insert-your-api-key-here', 'x-rapidapi-host' => 'coingecko.p.rapidapi.com' ]); try { $response = $request->send(); echo $response->getBody(); } catch (HttpException $ex) { echo $ex; }
At the current time, the CodeGecko API supports 457 cryptocurrency exchanges. The token IDs for the exchanges are returned from the query in a list:
[100 items 0:{2 items "id":"aave" "name":"Aave" } 1:{2 items "id":"aax" "name":"AAX" } 2:{2 items "id":"aax_futures" "name":"AAX Futures" } 3:{2 items "id":"abcc" "name":"ABCC" } 4:{2 items "id":"abit" "name":"Abit" } 5:{2 items "id":"acdx" "name":"ACDX" } 6:{2 items "id":"acdx_futures" "name":"ACDX Futures" } 7:{2 items "id":"aex" "name":"AEX" } 8:{2 items "id":"airswap" "name":"AirSwap" } 9:{2 items "id":"allbit" "name":"Allbit" } 10:{2 items "id":"allcoin" "name":"Allcoin" } ...
Similar to the Coin ID list, developers can search and reference the specific Exchange ID required for other requests to the CodeGecko API service from these token values.
Once the Coin ID and the Exchange ID are retrieved, use the RapidAPI interface to build more complex queries for the CoinGecko API. For example, using the GET coins/{id} method with “bitcoin” as an API query with the following PHP code:
<?php $request = new HttpRequest(); $request->setUrl('https://coingecko.p.rapidapi.com/coins/bitcoin'); $request->setMethod(HTTP_METH_GET); $request->setQueryData([ 'localization' => 'true', 'tickers' => 'true', 'market_data' => 'true', 'community_data' => 'true', 'developer_data' => 'true', 'sparkline' => 'false' ]); $request->setHeaders([ 'x-rapidapi-key' => 'insert-your-api-key-here', 'x-rapidapi-host' => 'coingecko.p.rapidapi.com' ]); try { $response = $request->send(); echo $response->getBody(); } catch (HttpException $ex) { echo $ex; }
This will return a JSON result with the entirety of the background information details that are stored by the CoinGecko platform on Bitcoin, such as:
{32 items "id":"bitcoin" "symbol":"btc" "name":"Bitcoin" "asset_platform_id":NULL "platforms":{1 item "":"" } "block_time_in_minutes":10 "hashing_algorithm":"SHA-256" "categories":[1 item 0:"Cryptocurrency" ] "public_notice":NULL "additional_notices":[]0 items "localization":{21 items "en":"Bitcoin" "de":"Bitcoin" "es":"Bitcoin" "fr":"Bitcoin" "it":"Bitcoin" "pl":"Bitcoin" "ro":"Bitcoin" "hu":"Bitcoin" "nl":"Bitcoin" "pt":"Bitcoin" "sv":"Bitcoin" "vi":"Bitcoin" "tr":"Bitcoin" "ru":"биткоин" "ja":"ビットコイン" "zh":"比特币" "zh-tw":"比特幣" "ko":"비트코인" "ar":"بيتكوين" "th":"บิตคอยน์" "id":"Bitcoin" } "description":{21 items "en":"Bitcoin is the first successful internet money based on peer-to-peer technology; whereby no central bank or authority is involved in the transaction and production of the Bitcoin currency. It was created by an anonymous individual/group under the name, Satoshi Nakamoto. The source code is available publicly as an open source project, anybody can look at it and be part of the developmental process. Bitcoin is changing the way we see money as we speak. The idea was to produce a means of exchange, independent of any central authority, that could be transferred electronically in a secure, verifiable and immutable way. It is a decentralized peer-to-peer internet currency making mobile payment easy, very low transaction fees, protects your identity, and it works anywhere all the time with no central authority and banks. Bitcoin is designed to have only 21 million BTC ever created, thus making it a deflationary currency. Bitcoin uses the <a href="https://www.coingecko.com/en?hashing_algorithm=SHA-256">SHA-256</a> hashing algorithm with an average transaction confirmation time of 10 minutes. Miners today are mining Bitcoin using ASIC chip dedicated to only mining Bitcoin, and the hash rate has shot up to peta hashes. Being the first successful online cryptography currency, Bitcoin has inspired other alternative currencies such as <a href="https://www.coingecko.com/en/coins/litecoin">Litecoin</a>, <a href="https://www.coingecko.com/en/coins/peercoin">Peercoin</a>, <a href="https://www.coingecko.com/en/coins/primecoin">Primecoin</a>, and so on. The cryptocurrency then took off with the innovation of the turing-complete smart contract by <a href="https://www.coingecko.com/en/coins/ethereum">Ethereum</a> which led to the development of other amazing projects such as <a href="https://www.coingecko.com/en/coins/eos">EOS</a>, <a href="https://www.coingecko.com/en/coins/tron">Tron</a>, and even crypto-collectibles such as <a href="https://www.coingecko.com/buzz/ethereum-still-king-dapps-cryptokitties-need-1-billion-on-eos">CryptoKitties</a>." … etc.
Developers can use this output across different altcoins to build content into their websites and mobile applications automatically using the CoinGecko API service.
To use the GET exchange/{id} command with PHP code and a HTTP request for Aave:
<?php $request = new HttpRequest(); $request->setUrl('https://coingecko.p.rapidapi.com/exchanges/aave'); $request->setMethod(HTTP_METH_GET); $request->setHeaders([ 'x-rapidapi-key' => 'da091eeda6msh3b59fd3da17b761p1ca770jsn0b111c548b2c', 'x-rapidapi-host' => 'coingecko.p.rapidapi.com' ]); try { $response = $request->send(); echo $response->getBody(); } catch (HttpException $ex) { echo $ex; }
This API command returns a unique set of background information about the Aave exchange formatted in JSON that can easily be styled and formatted into apps:
{23 items "name":"Aave" "year_established":2019 "country":NULL "description":"" "url":"https://app.aave.com/?referral=93" "image":"https://assets.coingecko.com/markets/images/544/small/AAVE.png?1593088709" "facebook_url":"" "reddit_url":"" "telegram_url":"Aavesome" "slack_url":"" "other_url_1":"https://discordapp.com/invite/AnSqnvV" "other_url_2":"" "twitter_handle":"aaveaave" "has_trading_incentive":false "centralized":false "public_notice":"" "alert_notice":"" "trust_score":NULL "trust_score_rank":258 "trade_volume_24h_btc":1396.0091696064296 "trade_volume_24h_btc_normalized":1396.0091696064296 "tickers":[17 items 0:{18 items "base":"AUSDC" "target":"ETH" "market":{...}3 items "last":0.000395803337582016 "volume":48305063.158664 "converted_last":{...}3 items "converted_volume":{...}3 items "trust_score":NULL "bid_ask_spread_percentage":NULL "timestamp":"2021-04-27T02:10:31+00:00" "last_traded_at":"2021-04-27T02:10:31+00:00" "last_fetch_at":"2021-04-27T05:49:05+00:00" "is_anomaly":false "is_stale":true "trade_url":NULL "token_info_url":NULL "coin_id":"aave-usdc-v1" "target_coin_id":"ethereum" } etc...
Use the Exchange ID tokens from the list to build custom API queries for the CoinGecko service in the same manner as using the Coin ID to return prices, charts, and background information about the cryptocurrency project or platform.
Python Code Snippets:
For Python applications and websites, there are three different methods that the CoinGecko API code can be input with depending on the preference of the programmer. Developers can use the HTTP client, an import request, or a Unirest command to embed the functionality in a display page. Here we will display the examples of the Python code that can be used alternatively to the PHP snippets above.
To call the complete coin list with the HTTP Client using Python:
import http.client conn = http.client.HTTPSConnection("coingecko.p.rapidapi.com") headers = { 'x-rapidapi-key': "insert-your-api-key-here", 'x-rapidapi-host': "coingecko.p.rapidapi.com" } conn.request("GET", "/coins/list", headers=headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))
To retrieve the complete list of cryptocurrency exchange tokens using HTTP & Python:
import http.client conn = http.client.HTTPSConnection("coingecko.p.rapidapi.com") headers = { 'x-rapidapi-key': "input-your-api-key-here", 'x-rapidapi-host': "coingecko.p.rapidapi.com" } conn.request("GET", "/exchanges/list", headers=headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))
To return background information on the “Bitcoin” ID using an HTTP request in Python:
import http.client conn = http.client.HTTPSConnection("coingecko.p.rapidapi.com") headers = { 'x-rapidapi-key': "insert-your-api-key-here", 'x-rapidapi-host': "coingecko.p.rapidapi.com" } conn.request("GET", "/coins/bitcoin?localization=true&tickers=true&market_data=true&community_data=true&developer_data=true&sparkline=false", headers=headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))
To return the background information on the “Aave” exchange using the Exchange ID and an HTTP request in Python.
import http.client conn = http.client.HTTPSConnection("coingecko.p.rapidapi.com") headers = { 'x-rapidapi-key': "insert-api-key-here", 'x-rapidapi-host': "coingecko.p.rapidapi.com" } conn.request("GET", "/exchanges/aave", headers=headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8"))
Please see the RapidAPI interface page for the CoinGecko API project for a complete list of Python snippets and counterexamples for each working methodology.
Ruby Code Snippets:
For Ruby coders, there are two different programming methods that the CoinGecko API can be used with to easily input dynamic cryptocurrency information into a web page or mobile application. Developers can use their choice of either a net::HTTP request or a Unirest command to call the CoinGecko API for real-time and historical information.
To retrieve the complete list of cryptocurrency coins with a net::HTTP request in Ruby:
require 'uri' require 'net/http' require 'openssl' url = URI("https://coingecko.p.rapidapi.com/coins/list") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Get.new(url) request["x-rapidapi-key"] = 'insert-api-key-here' request["x-rapidapi-host"] = 'coingecko.p.rapidapi.com' response = http.request(request) puts response.read_body
To retrieve the complete list of exchanges & wallets using a net::HTTP request in Ruby:
require 'uri' require 'net/http' require 'openssl' url = URI("https://coingecko.p.rapidapi.com/exchanges/list") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Get.new(url) request["x-rapidapi-key"] = 'insert-api-key-here' request["x-rapidapi-host"] = 'coingecko.p.rapidapi.com' response = http.request(request) puts response.read_body
Return the Coin ID information for “Bitcoin” using a net::HTTP request in Ruby:
require 'uri' require 'net/http' require 'openssl' url = URI("https://coingecko.p.rapidapi.com/coins/bitcoin?localization=true&tickers=true&market_data=true&community_data=true&developer_data=true&sparkline=false") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Get.new(url) request["x-rapidapi-key"] = 'insert-api-key-here' request["x-rapidapi-host"] = 'coingecko.p.rapidapi.com' response = http.request(request) puts response.read_body
Return the Exchange ID info for the “Aave” platform using a net::HTTP request in Ruby:
require 'uri' require 'net/http' require 'openssl' url = URI("https://coingecko.p.rapidapi.com/exchanges/aave") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Get.new(url) request["x-rapidapi-key"] = 'insert-api-key-here' request["x-rapidapi-host"] = 'coingecko.p.rapidapi.com' response = http.request(request) puts response.read_body
Import the endpoint information into your Ruby website or mobile application and use your choice of resources for the styling, GUI, and display of cryptocurrency details.
JavaScript Code Snippets:
For JavaScript applications and websites, there are four different methods that the code can be input into a web page or mobile application using the RapidAPI service. Developers can use jQuery, fetch, an XML HTTP request, or Axios to build displays for the application. Otherwise, the information returned by the API is the same across all programming languages, standardized in JSON for use in any application framework.
To retrieve the complete list of coins supported by CoinGecko with an XMLHttp request in JavaScript:
const data = null; const xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } }); xhr.open("GET", "https://coingecko.p.rapidapi.com/coins/list"); xhr.setRequestHeader("x-rapidapi-key", "insert-api-key-here"); xhr.setRequestHeader("x-rapidapi-host", "coingecko.p.rapidapi.com"); xhr.send(data);
To return the list of exchanges and wallet apps via an XMLHttp request in JavaScript:
const data = null; const xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } }); xhr.open("GET", "https://coingecko.p.rapidapi.com/exchanges/list"); xhr.setRequestHeader("x-rapidapi-key", "insert-api-key-here"); xhr.setRequestHeader("x-rapidapi-host", "coingecko.p.rapidapi.com"); xhr.send(data);
To return the background information on the “Bitcoin” ID with an XMLHttp request in JavaScript:
const data = null; const xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } }); xhr.open("GET", "https://coingecko.p.rapidapi.com/coins/bitcoin?localization=true&tickers=true&market_data=true&community_data=true&developer_data=true&sparkline=false"); xhr.setRequestHeader("x-rapidapi-key", "insert-api-key-here"); xhr.setRequestHeader("x-rapidapi-host", "coingecko.p.rapidapi.com"); xhr.send(data);
To return the background info on the “Aave” Exchange ID with an XMLHttp request in JavaScript:
const data = null; const xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } }); xhr.open("GET", "https://coingecko.p.rapidapi.com/exchanges/aave"); xhr.setRequestHeader("x-rapidapi-key", "insert-api-key-here"); xhr.setRequestHeader("x-rapidapi-host", "coingecko.p.rapidapi.com"); xhr.send(data);
Make sure to replace the placeholder text with your custom API key from RapidAPI. Use the same code with different Coin and Exchange ID values for additional endpoint results when building dynamic custom displays for websites and mobile applications.
Endpoints of the CoinGecko API
The CoinGecko API currently supports 6,877 coins and 457 cryptocurrency exchanges through unique token IDs. Using any of the unique tokens allows the developer to access a custom API endpoint for results. Some of the CoinGecko API queries include additional variables that can condition or refine the endpoint results for further diversity.
To change the default values of the optional variables for each CoinGecko API query, reference the “Additional Parameters” section of the RapidAPI user interface. For the GET coin/list command, there are additional parameters for:
- Localization: Include all localized languages in response (true/false)
- Tickers: Include tickers data (true/false)
- Market_data: Include market_data (true/false)
- Community_data: Include community_data data (true/false)
- Developer_data: Include developer_data data (true/false)
- Sparkline: Include sparkline 7 days data (eg. true, false)
Use the “true/false” values with additional parameters to further configure the results of endpoint displays according to the requirements of your websites and mobile apps. These values can also be used with individual coins to filter data for API results pages.
Alternatives to the CoinGecko API
Binance, Kraken, Bittrex, Bitstamp, BitMEX, Poloniex, Gate.io, and EtherScan all have developer APIs with different levels of real-time price discovery, altcoin support, and historical data that can be used as potential alternatives to the CoinGecko service, although none provide a service with an equivalent level of depth of functionality.
Some of the main alternatives to the CoinGecko API service globally are:
- The CoinMarketCap Crypto API: The most popular cryptocurrency price discovery and real-time trading platform API in this market sector. The prices of the CoinMarketCap Crypto API may be more expensive to use for support of software applications in production compared to the free CoinGecko API service.
- The CryptoCompare API: Access cryptocurrency trading prices, historical data, news, and other information about 5,419 assets and 302 exchanges using the CryptoCompare API with free and paid plans for any organization.
- Coincodex API: This cryptocurrency API is still in development, but lacks the depth of coin and exchange support that the CoinGecko API offers developers.
Other cryptocurrency APIs hosted by RapidAPI publicly include Alpha Chain, Cryptocurrency Real Time, CoinLore, Cryptonit, and CoinFeeds.
What are the benefits of the CoinGecko API?
The CoinGecko API allows developers to build comprehensive trading applications for cryptocurrency exchanges with real-time price discovery and historical chart information. Cryptocurrency wallet applications, coin banks, and exchanges can use the CoinGecko API to retrieve real-time prices for user portfolios. Individuals can also use the API service to build spreadsheets with live pricing information in displays.
The CoinGecko API is free for developers to use in their applications up to a limit of 100 queries per minute. The platform offers the widest support for altcoins, stablecoins, and other cryptocurrency resources in the marketplace. The CoinGecko API allows apps to import background information in JSON format about over 6,877 cryptocurrencies and 457 exchanges. Exchange data can also be exported for macro-economic analysis.
Cryptocurrency Exchanges & Wallet Apps: The CoinGecko API displays information from over 300 exchange and wallet applications like Trezor, MetaMask, MEW, Etherscan, BlockChair, Kyber Network, Trust Wallet, MyCrypto, & DappRadar.
Developer Resources for the CoinGecko API
For more information on using the CoinGecko API to build iOs and Android apps or websites, the resources below are recommended for developers and programmers:
- MetaMask: “What is a Token Contract Address?” (2021):
https://metamask.zendesk.com/hc/en-us/articles/360015488811-What-is-a-Token-Contract-Address- - OpenAPI Specification (Swagger): “What Is OpenAPI?” (2021): https://swagger.io/docs/specification/about/
- CoinGecko Buzz: “Q1 2021 Quarterly Cryptocurrency Report” (2021):
https://www.coingecko.com/buzz/q1-2021-quarterly-cryptocurrency-report - Finsof: “CoinGecko- Guide for Beginners” (2019): https://finsof.net/coingecko-guide-2019
- GitHub: “CoinGecko API – Public Repositories” (2021):
https://github.com/topics/coingecko-api - IvanOnTech Academy: “What is CoinGecko – A Beginner’s Guide” (2021):
https://academy.ivanontech.com/blog/what-is-coingecko-a-beginner-s-guide
- AlgoTrading 101: “CoinGecko API – A Complete Guide” (2021):
https://algotrading101.com/learn/coingecko-api-guide/
Make sure to utilize the resources on the CoinGecko API website, such as the FAQ page and API documentation. Use the RapidAPI resources for quick developer tools.
Summary: Build Cryptocurrency Trading Support
Cryptocurrencies like Bitcoin, Ethereum, XRP, Tether, Dogecoin, and other altcoins have surged in popularity recently to challenge traditional banking, money transfer, and payment systems. CoinGecko is one of the oldest and most trusted companies covering the cryptocurrency ecosystem globally. The CoinGecko API is one of the most extensive resources for cryptocurrency trading, with real-time price discovery from almost 500 exchanges worldwide as well as historical chart information available free of charge.
Developers can use the CoinGecko API to build thousands of endpoints into their websites and mobile applications with dynamic data that updates automatically. PHP, Python, Ruby, and JavaScript coders can use the snippets generated at RapidAPI to access the CoinGecko service with security and low-latency connections. The CoinGecko API is a recommended solution to support the demanding requirements of building new, innovative web/mobile applications that work with blockchain, cryptocurrencies, decentralized finance, yield farming, and NFT platforms worldwide.
Thanks for the mention! : )