Crypto API tutorials and more:

How to connect CoinMarketCap to Google Sheets

This tutorial will show you how to use the CoinMarketCap API to import bitcoin prices and cryptocurrency data into Google Sheets.

Many crypto investors and traders rely on Coinmarketcap’s API to get accurate, real time data for thousands of cryptocurrencies and cryptocurrency exchanges.

With Coinmarketcap’s API, you can pull information on price, total market cap, 24h volume, 24h circulating supply, and price trends (day, week, year) for every cryptocurrency that’s listed at coinmarketcap.com.

Keep reading to learn how to pull data from Coinmarketcap into Google Sheets without writing any code.

Step 1.) Install and open the Apipheny add-on for Google Sheets

Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.

1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install

2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.

In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.

open apipheny

Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new

Step 2.) Sign up for a CoinMarketCap developer account and get your API key

To integrate CoinMarketCap’s API with Google Sheets, you first need to get your CoinMarketCap API key. You can log in to your Coinmarketcap developer account here. Or if you haven’t signed up yet, you can sign up for a CoinMarketCap developer account here.

The Coinmarketcap basic plan is completely free to use but it does come with limitations. Learn about those limitations on their plan features page.

The free plan comes with:

  • 333 daily credits
  • 10k monthly credits
  • 30 API calls per minute
  • 9 endpoints
  • 1 currency conversion per request

After signing up for a Coinmarketcap Developer account, go to https://coinmarketcap.com/api/ and click the GET YOUR API KEY NOW button:

You’ll have to sign in or create an account first and then you’ll be able to access your Developer Portal account dashboard. Here, the key is prominently displayed, masked by asterisks.

When you hover over the COPY KEY button, the actual contents are revealed. Copy the key to your clipboard by clicking the COPY KEY button:

Step 3.) Choose a CoinMarketCap API URL endpoint

In this section, we’ll show you how to browse the CoinMarketCap API documentation to find an API endpoint URL that retrieves the information you need. If you already know your URL, or you want to use the same example URL as us, just skip to Step 4.

First, open the CoinMarketCap API documentation page: https://coinmarketcap.com/api/documentation/v1/

The menu on the left contains general information about CoinMarketCap API and a list of categorized endpoints:

CoinMarketCap API documentation page
CoinMarketCap API documentation page

If we click the Cryptocurrency category, a list of its endpoints will be displayed:

Cryptocurrency section
Cryptocurrency section

An example endpoint is the Market Pairs Latest endpoint, which lists all active market pairs that CoinMarketCap tracks for a given cryptocurrency or fiat currency:

https://pro-api.coinmarketcap.com/v1/cryptocurrency/market-pairs/latest

The endpoint’s documentation contains a descriptive title, a paragraph describing the endpoint’s purpose, the accepted query parameters, followed by a response format section. In a distinct section on the right, you will see the endpoint’s HTTP method (GET) and URL:

Market Pairs Latest endpoint description
Market Pairs Latest endpoint description

All endpoints can be accessed from the following base domain: https://pro-api.coinmarketcap.com/v1/

More CoinMarketCap API endpoint examples

The Quotes Latest v2 endpoint, which returns the latest market quote for 1 or more cryptocurrencies.

Method: GET
API URL Path: https://pro-api.coinmarketcap.com/v2/cryptocurrency/quotes/latest
Headers:
    Header 1 Key: 
        Accept
    Header 1 Value: 
        application/json

    Header 2 Key: 
        Accept-Encoding
    Header 2 Value: 
        deflate, gzip

    Header 3 Key: 
        X-CMC_PRO_API_KEY
    Header 3 Value: 
       your_API_key

Make sure to replace your_API_key with the key you previously obtained.


The Airdrops endpoint, which returns a list of past, present, or future airdrops which have run on CoinMarketCap.

Method: GET
API URL Path: https://pro-api.coinmarketcap.com/v1/cryptocurrency/airdrops
Headers:
    Header 1 Key: 
        Accept
    Header 1 Value: 
        application/json

    Header 2 Key: 
        Accept-Encoding
    Header 2 Value: 
        deflate, gzip

    Header 3 Key: 
        X-CMC_PRO_API_KEY
    Header 3 Value: 
       your_API_key

Make sure to replace your_API_key with the key you previously obtained.


The Trending Most Visited endpoint, which returns a paginated list of all trending cryptocurrency market data, determined and sorted by traffic to coin detail pages.

Method: GET
API URL Path: https://pro-api.coinmarketcap.com/v1/cryptocurrency/trending/most-visited
Headers:
    Header 1 Key: 
        Accept
    Header 1 Value: 
        application/json

    Header 2 Key: 
        Accept-Encoding
    Header 2 Value: 
        deflate, gzip

    Header 3 Key: 
        X-CMC_PRO_API_KEY
    Header 3 Value: 
       your_API_key

Make sure to replace your_API_key with the key you previously obtained.


The Market Pairs Latest endpoint, which returns all active market pairs that CoinMarketCap tracks for a given exchange. The latest price and volume information is returned for each market. 

Method: GET
API URL Path: https://pro-api.coinmarketcap.com/v1/exchange/market-pairs/latest
Headers:
    Header 1 Key: 
        Accept
    Header 1 Value: 
        application/json

    Header 2 Key: 
        Accept-Encoding
    Header 2 Value: 
        deflate, gzip

    Header 3 Key: 
        X-CMC_PRO_API_KEY
    Header 3 Value: 
       your_API_key

Make sure to replace your_API_key with the key you previously obtained.


The Metadata endpoint, which returns all static metadata for one or more exchanges. This information includes details like launch date, logo, official website URL, social links, and market fee documentation URL.

Method: GET
API URL Path: https://pro-api.coinmarketcap.com/v1/exchange/info
Headers:
    Header 1 Key: 
        Accept
    Header 1 Value: 
        application/json

    Header 2 Key: 
        Accept-Encoding
    Header 2 Value: 
        deflate, gzip

    Header 3 Key: 
        X-CMC_PRO_API_KEY
    Header 3 Value: 
       your_API_key

Make sure to replace your_API_key with the key you previously obtained.


The Content Post Comments endpoint, which returns comments of the CMC Community post.

Method: GET
API URL Path: https://pro-api.coinmarketcap.com/v1/content/posts/comments
Headers:
    Header 1 Key: 
        Accept
    Header 1 Value: 
        application/json

    Header 2 Key: 
        Accept-Encoding
    Header 2 Value: 
        deflate, gzip

    Header 3 Key: 
        X-CMC_PRO_API_KEY
    Header 3 Value: 
       your_API_key

Make sure to replace your_API_key with the key you previously obtained.

CoinMarketCap API pagination

Pagination is a process that is used to divide a large dataset into smaller chunks (pages). Usually the endpoints that return a list of resources support pagination. 

Some of the CoinMarketCap API endpoints use the pagination option. This means you need to add pagination some of these parameters at the end of the URL:

  • start – optionally offset the start (1-based index) of the paginated list of items to return, default value is 1;
  • limit – optionally specify the number of results to return. Use this parameter and the “start” parameter to determine your own pagination size, default value is 100, value between 1…5000;

Each endpoint that needs pagination will have in its documentation relevant information on which of these parameters you can use and how to do it.

Example:
https://pro-api.coinmarketcap.com/v1/content/latest?start=1&limit=200

In the example above, the data set will start from index 1 and will be divided in sets of 200 records per page.

Step 4.) Enter your CoinMarketCap API request into Apipheny

Make sure you have the Apipheny add-on open in your Google Sheet, on the Import tab.

Method: In Apipheny’s Import tab, select the HTTP method (GET or POST) required by your API endpoint. For this example we are using GET.

API URL: In Apipheny’s API URL field, paste your CoinMarketCap API URL and endpoint, followed by any GET parameters required for your query. We give an example API URL you can use below.

Headers: In the Headers section in Apipheny, you should add three rows with the following keys and values:

Header 1
Key: 
Accept
Value: 
application/json

Header 2
Key: 
Accept-Encoding
Value: 
deflate, gzip

Header 3
Key: 
X-CMC_PRO_API_KEY
Value: 
your_API_key

your_API_key is the API key you previously obtained in Step 2. While the Coinmarketcap API also allows passing the API key as a query parameter, this makes it visible and vulnerable to being accessed by unwanted third parties. As such, the recommended method is to use the X-CMC_PRO_API_KEY header.

As an example, let’s use the cryptocurrency listings endpoint, which will return a list of all active cryptocurrencies, with the latest market data. The URL for this endpoint is:

https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest

This URL uses the GET HTTP method and while it does accept a number of parameters that allow you to customize the output, they are all optional and will come with sensible defaults. As such, the request can simply be made to the endpoint URL, without any parameters

The three headers previously described are required, so make sure they are entered in Apipheny, like in this screenshot:

Step 5.) Run the API endpoint request

The last step is to click the Run button at the bottom of the Apipheny add-on and wait for the cryptocurrency data to be fetched and added to your spreadsheet:



Crypto API tutorials and more:


API Tutorials



API Knowledge

What is an API?

What is an API URL?

What are parameters?

What is an endpoint?

What is an API key/token?

What is basic authentication?

What are headers?

What is a GET request?

What is a POST request?


Sponsored by Zink Virtual Tip Jar & Rewording.io Paraphrasing Tool

Accept donations on Twitch | Accept donations on Discord | Accept donations on YouTube | Accept donations on Telegram | Accept donations on Twitter | Accept donations on TikTok | Accept donations on Instagram | Accept donations on LinkedIn | Accept donations on Facebook | Accept donations on your Website