API Connector Documentation
Import CoinGecko Data to Google Sheets
In this guide, we’ll walk through how to pull cryptocurrency market data from the CoinGecko API directly into Google Sheets, using the API Connector add-on for Sheets.
The cool thing about CoinGecko is that they provide a huge amount of well-organized crypto data, including some unique API endpoints like most-searched coins. This tutorial will show how to get an API key before fetching data.
Contents
- Before You Begin
- Part 1: Get Your CoinGecko API Key
- Part 2: Pull CoinGecko API Data into Sheets
- Part 3: Create a Custom Request
- Part 4: Handle Pagination
- Part 5: CoinGecko Limits
- Part 6: API Documentation
- Appendix: CoinGecko Template
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Get Your CoinGecko API Key
- To get started, you'll need a CoinGecko account, so, if you haven't already, create an account and log in to coingecko.com.
- Once you're logged in, navigate to https://www.coingecko.com/en/api/pricing.
- To subscribe to a paid API plan, click one of the Upgrade buttons in the pricing table. Alternatively, get a free API key by clicking Create Demo Account underneath the pricing table.
- If you select a paid plan, you'll see the Billing Info form on the left (use the MIXEDANALYTICS20 offer code for 20% off any API plan). If you are creating a free demo account, you'll see the form on the right instead.
- Either way, once your account is set up, navigate to the Developer dashboard and click +Add New Key
- You'll be prompted to label your key and click Create
- Your API key will now be listed on the page. Copy this key and keep it safe as we'll use it shortly!
Part 2: Pull CoinGecko API Data into Sheets
The easiest way to get started with the CoinGecko API is through API Connector’s built-in integration.
- In Sheets, open API Connector and create a new request (Extensions > API Connector > Open > Create request)
- If you're using a free API key through a Demo Account, select CoinGecko from the drop-down list of applications. If you are using a paid CoinGecko API plan, select CoinGecko Pro. The CoinGecko Pro application contains some unique endpoints that aren't accessible to free users.
- Under Authorization, enter your API key.
- Choose an endpoint. For example, select
/coins/markets
, which is the endpoint for fetching the latest market data. - In the parameters section, select which "vs_currency" you'd like to use.
- Optionally select other parameters, e.g. select specific coin IDs or set
per_page
to 250 to get more than 100 records. - Choose a destination sheet, name your request, and hit Run to see the response data in your sheet.
- Optionally open the field editor to filter out any unnecessary fields from your report.
Part 3: Create a Custom Request
Alternatively, you can run your own custom requests instead of using API Connector’s pre-built integration, using any of the API URLs shown in the API documentation. Here's an example request setup:
- Open up Google Sheets and click Extensions > API Connector > Open > Create request.
- In the request form enter the following. If you're using CoinGecko's paid API, change the base URL to
https://pro-api.coingecko.com/api/v3/
, and the header key tox-cg-pro-api-key
.- Application:
Custom
- Method:
GET
- Request URL:
https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd
- Headers:
x-cg-demo-api-key
:your_key
- Application:
- Create a new tab and click Set current to use that tab as your data destination.
- Name your request and click Run. A moment later you’ll see a list of coins populate your sheet.
Part 4: Handle Pagination
- For several endpoints, CoinGecko limits the number of records returned in each response. By default, only 100 records will be returned unless you set the
per_page
parameter to 250: - If you need more than 250 records, you can loop through multiple pages automatically with page parameter pagination handling, like this:
- Pagination type:
page parameter
- Page parameter:
page
- Run until: choose when to stop running the request
- Pagination type:
Part 5: CoinGecko Limits
Update: As of October 2023, CoinGecko now supports API keys. You can now get your own personal API key to avoid running into shared rate limits!
CoinGecko does allow access to their API without a key. However, if you run requests through Google Sheets without an API key, you'll probably come across error messages like these:
- API server responded with an error (429), error code: 1015
- API server responded with an error (403): error code: 1020
This is because CoinGecko applies rate limits, as shown in their terms & conditions.
When you run your requests through API Connector / Google Sheets, you’re more likely to hit these rate limits because all requests running through Google Sheets share the same pool of IP addresses from Google’s servers. Therefore, get a key first to avoid running into issues.
Part 6: API Documentation
Official API documentation: https://www.coingecko.com/en/api/documentation
Appendix: CoinGecko Template
In this template, everything is configured for you to simply type in whatever coins you’re interested in and get a dashboard like below:
You can jump right to a copy of the template here. Happy data grabbing!
Hey so i did this but it seems like it doesn't keep up with the price fluctuations and it just stays at the original price when i set up the API, do you know the reason why this is happening?
Hi there, the sheet doesn't automatically pull in new data from the API. To get fresh data, you need to click Run or set up scheduling. The IMPORTAPI custom function also has some auto-refresh functionality. Let me know if anything isn't clear and I'll be happy to explain further.
Once I refresh the data, the sequence in which the data is downloaded is not always the same. For example, if I use the code
https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=ethereum,bitcoin,simple-token,ripple,litecoin,stratis,waves,litecoin-cash,holotoken,celo-gold
If I add another 10-20 tokens to the end of that code, the list appears in a different sequence each time. This makes it difficult to use this data in other sheets (since the reference cell no longer points to the correct token)
Hey Nik, when you make a spreadsheet you usually don't want to reference cells directly, since it's pretty normal for source data to move around. You can use a function like VLOOKUP so the data stays in place regardless of its exact location in the list. With VLOOKUP you set the name of the coin as your lookup value, then set your sheets to read from that, rather than having them look for a fixed cell location.
Thank you for the tip, that was brilliant and it fixed the issue! Did not know about VLOOKUP so found a simple youtube tutorial.
Awesome! Next you can learn about MATCH, that will really blow your mind 😀
Hi!
So I ran a market API and only got back 200 coins! can I at least get back the first 1000 or 2000?
Good question. For markets, by default CoinGecko limits the amount of records they return at once. To get more you need to add
&per_page=250&page=1
,&per_page=250&page=2
,&per_page=250&page=3
, and so on to the end of your URL. I've just updated the article to reflect this.thank you!
Not working this method
Can you elaborate on what doesn't work?
Hi
I used this API
https://api.coingecko.com/api/v3/exchange_rates
But all the rates return in one row - is there a way to make a list with each rate on its own row....
🙂
Hey there, this is due to the way they've structured their response data. If you check it in an API tool that returns the raw JSON (e.g. Swagger), you'll notice that the response from CoinGecko uses named objects where normally you would see arrays. This prevents API Connector from recognizing where to split the data into columns vs. rows when converting the JSON response into Sheets format.
In any case, to answer your question, you can use JMESPath, which is a very useful query language that allows you to filter and restructure the response data. The query
rates.*
removes the object names so that the response can be parsed correctly. I added a screenshot of this to the article.One other option is to create a second sheet containing a Sheets function like
=transpose(Exchange_rates!1:2)
to convert the response from one long row to one long column. I don't think it's a great solution but it's still a bit better than the default response.Hi Ana
I came up with 3 solutions for this problem.
Solution 1 & 2 require you to enter the formula in the first Row of 4 cells. Then drag the formula down in this case for 61 Rows since there are 61 rates returned by the API (a horizontal row of 4x61=244 cells)
Solution 3 returns the whole table,
after you enter the formula in the top left cell where you want the table
Solution 1:
=INDEX($7:$7,(ROW()-11)*4+COLUMN())
Solution 2:
=OFFSET(A$7,0,(ROW()-11)*4)
Solution 3:
Note this assumes the API data is returned on Row A7:7 - just change that to suit your Row.
=arrayformula( query( query( iferror( if( {1,1,0}, floor( mod(row(A:A)-{1,1},{9^9, 4}), {4,1} ), transpose( split( regexreplace( query( transpose( query( transpose(A7:7 & char(9)), "", 9^9 ) ), "", 9^9 ), "\s+$", "" ), char(9) & " ", ) ) ) ), "select max(Col3) where Col3 '' group by Col1 pivot Col2", 0 ), "offset 1", 0 ) )
Solution 3 is care of the experts at Docs Editors Help.
Nice, thank you for sharing!
In the message above showing Solution 3 I was using the following
URL Path = https://api.coingecko.com/api/v3/exchange_rates
To use the Solution 3 above you need two Google Sheets
1 - Results Sheet (This is where the table will display)
2 - Data Sheet (This is where the API writes its ouput)
Also where you see the function - transpose(A7:7 - this shows my data was being read from row7 - BUT -
You should point to the sheet holding your Data with - transpose('Data'!A2:2 & char(9)
Results Sheet
=============
Col A Col B Col C Col D
Row(1) rates » btc » name rates » btc » unit rates » btc » value rates » btc » type
Row(2)
Data Sheet
==========
This is where the API Connctor will put the data.
1 - URL Path = https://api.coingecko.com/api/v3/exchange_rates
2 - Output Option = Overwrite
This means the data will always be written on to Row(2) starting with Cell A2
Is it possible to use the template but expand it to go beyond just 30 inputs? (I have around 100 coins I want to track). Can anyone help with what changes I would need to make?
Thanks
Should be possible, just do the following:
1) in the Inputs tab, add in as many rows as you want
2) in the cells Inputs!D5 and Summary!B8, change the formulas to include the new rows you added
I have tried this different ways and still not able to get more than 30 results, any other thoughts?
Hey Marty, I updated the template to allow up to 50 coins, please check if that works for you.
Hi there!
I'm using this code:
https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum,litecoin,aave,morpheus-network,sparkpoint,zcash,0x&vs_currencies=usd
and for some reason it doesn't pull zcash or 0x - I found some other ids didn't pull as well. Any tips? Thanks!
Oh weird, there it goes. Before it was saying error 429
429 errors mean you're hitting their rate limits. The rate limit for the CoinGecko API is 10 calls each second per IP address. Unfortunately it's easy to run into these limits, since all Sheets calls are routed through Google's IP address pool, meaning other people are using the same resources. It should work if you wait a minute and try again.
Update: you can now avoid this by getting a CoinGecko API key .
Hi Ana,
I'm using the template you shared and it all works great except super randomly, ren is ignored and doesnt print into the sheet, i've tired ren, REN, REN (REN), no juice.
Any idea why? I tried a few other random coins on CG and they work fine. https://www.coingecko.com/en/coins/ren
Many thanks, Marc
Ok hmm worked it out, it's so opaque though, I used https://api.coingecko.com/api/v3/coins/list
and then hunted down "ren" and finally figured maybe it was 'republic' and sure enough it's "republic-protocol", but idk why they dont share that on the page for their API users. Cheers.
Good question, I checked and I think it's because this request sheet is set up to look for the ID rather than the symbol. In this case, the ID is "republic-protocol" while the symbol is "ren". In many cases the ID and symbol are the same, so that's why this problem isn't always evident. I'll try to make that more clear.
How do you get the ATH date?
I'm not sure, I don't see that data point in their API docs. You can check https://www.coingecko.com/api/documentations/v3 to see all the metrics they have available.
This may be the most useful article I've ever found online! I was looking at the CoinGecko page on importing to Google Sheets and was getting nowhere. This is super-clear and the example spreadsheet has taken all of the work out of it. Thanks.
This is an awesome comment, thank you Matt! 🙂
Hi,
Thank you for the template, very helpful!
I'm looking for some workaround to fit my need. I don't understand why the "Summary" lines order is not based on the "Data" one. Each time I refresh, the order change in "Data" in relation to the market cap rank.
How can I set up that for "Summary"?
Thank you for your insights.
The order of the Summary items comes from the Inputs tab. You can see the formula in the
Summary!B8
cell.As you note, the order for the Data tab is set by CoinGecko, and by default is based on descending order of market cap size.
I'm not totally sure what you're looking to do, but if you want your data sorted by market cap, then you can just use the Data sheet, or make your own summary table that isn't based on the Inputs tab.
Thanks. I managed to do it with the Vlookup trick
Any idea how to keep tracking my portfolio performance monthly/annually?
If you have a list of all your coins and their values, you could copy/paste that at the start of each month into a new column, to keep a record. My other (free) add-on Archive Data (link) automates that, you can check if it helps.
Hey,
somehow it does not work for me. I always get an "ERROR" in the cell.
I really don`t know why? Maybe you have an idea?
Cheers
Lars
Can you please say a little more about your request setup? Are you running your request from the sidebar or via the IMPORTAPI custom function? Where are you seeing "ERROR", is there any more info returned when you hover over the cell?
Hey, thank you for your quick response. I just solved the problem. A json script was still running, after I deleted it everything works well.
Thanks
Lars
Great, glad to hear it's working now 🙂
Hi Ana, thanks for all your work with this great plugin, I was previously using json coingecko method and whilst it worked sometimes, as my portfolio grew, the scripts became less reliable.
REFRESH BUTTON
One thing I'm still trying to solve, is the ability to run your API via a REFRESH button on my portfolio sheet and referencing my API coingecko data from another sheet, this was a setup I made with the JSON script and worked ok.
I have seen you mention IMPORTAPI but I'm unsure how to trigger this from the script function on the button, I suspect this might need some custom script adding as code.gs where the json was previously parked? Any help would be appreciated.
Here's a link to the sample sheet with the setup:
https://docs.google.com/spreadsheets/d/1bJ5x7bqBVN4ngPcYWQTNqVqttatt5hA6XUtKp9ux-dM/edit?usp=sharing
Would you also know how to use the sparklne data for each coin in the sheet using coingecko's import, i have the sparkline data imported but google sheets removed support for [SPARKLINE=]
Hey Fagin, thanks for the message. If you want to use IMPORTAPI, you would just set up your request in the API Connector sidebar. Then, if your request is named, say, Get Coins, you’d enter =IMPORTAPI("Get Coins") into any cell to run that request directly in your sheet. You can also run this request on demand by checking a box, this article has some examples of that (check the section called "Fast Cell-Based Refresh").
I’m not really sure what you mean about adding a custom script. I checked your sheet – it looks great – but I wasn’t sure what part you wanted me to look at (and without Edit access I can’t see your API Connector requests). So feel free to message back if you’d like to clarify anything further.
This Article is awesome!!! i'm now trying a way to adapt your template so it pulls historical prices at a certain day. Do you know if that's possible?
Thank you for the comment! You can use the 'history' endpoint to get historical prices. You would need to run a different request for each coin you're looking to pull, though, like this. Please check and see if it works for you.
https://api.coingecko.com/api/v3/coins/bitcoin/history?date=30-12-2018
Hey!
Great application. I got a question though. Is it possible that some APIs (like in my case for the StormX coin) are not working?
https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=stormx
Is the command i used but the connector says "no records found".
Any Ideas?
Hey Jonas, the problem here is that 'stormx' is the coin name, not the ID. Please replace 'stormx' with 'storm' and it should work. You can see a full list of coin names, IDs, and symbols by making a request to
https://api.coingecko.com/api/v3/coins/list
Is there a volume to get data on 24h volume change? I see market cap change; would be nice to get volume changes as well?
Sure, you can see all of CoinGecko's available endpoints here: https://www.coingecko.com/api/documentations/v3
I see a few different endpoints for historical data, e.g.
https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=1
4 orhttps://api.coingecko.com/api/v3/coins/bitcoin/history?date=01-01-2021&localization=false
Thanks for useful topic. I have one question. I want to know how to get latest import token or coin on coingecko ? Can you have any idea for this?
Do you mean recently added coins like the ones listed here? https://www.coingecko.com/en/coins/recently_added
I don't see anything about recently added coins in CoinGecko's API docs, but you don't really need the API for this anyway, you can import that data with a formula like
=IMPORTHTML("https://www.coingecko.com/en/coins/recently_added","table",1)
Let me know if that works for you.
hi but many alert bots in telegram using this method how find before add here
https://www.coingecko.com/en/coins/recently_added
i need help thank you
Sorry, I'm not sure how alert bots work, they might be scraping the page looking for changes rather than using the API.
Hi there
when I alter the cells for coin IDs on the 'Input' tab, it pulls the token name through but not the data to the Summary tab?
That's weird, did you click Run?
I get the following error when making a request. Rarely the request works but most of the times I get this error. Any help is appreciated
809: unexpected token at '
!--[if lt IE 7]> <![endif]-->
!--[if IE 7]> <![endif]-->
!--[if IE 8]> <![endif]-->
!--[if gt IE 8]>>--> <!--
Access denied | api.coingecko.com used Cloudflare to restrict access
Hmm I haven't come across this specific error before but CoinGecko writes about using Cloudflare here. On that page they write "However, occasionally there can be false positive situation where legitimate users may accidentally get flagged by Cloudflare. This can due to our security settings being too tight or incorrectly setup. It might also be because the user is making requests from an IP address pool that is deemed to be suspicious."
So it looks like they've erroneously flagged your request. You might need to contact their support or use a different crypto API that gives you a private key.
respected sir how can i find new listing coin api of coingecko
Please check my response here.
hi
ive got the site working perfect but it does not show the list of coins on a andriod browser, please can anyone help.
Sorry, I don't really understand your question, are you saying your requests work through a desktop browser but not through mobile, or something else?
hi yes they work through my desktop but not a andriod browser?
You mean you can't open the add-on? The mobile version of Google Sheets doesn't support add-ons for all phones, unfortunately we can't do anything about that.
Hey Ana, thanks for the tutorial. Quick question - I would like to include the 24H price change AND the 7 days price change of let's say BTC. How should I change the following path?
https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd&include_24hr_change=true
Hi there, their /simple/price endpoint doesn't support 7 days price change parameter. You can see all the parameters they support here: https://www.coingecko.com/en/api/documentation
Based on that, only the /coins/markets endpoint enables 7 days price change, so you'd make your URL like this:
https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=bitcoin&order=market_cap_desc&per_page=100&page=1&sparkline=false&price_change_percentage=24h,7d
Hey love this tool. It's pretty much perfect except it doesn't seem to refresh data very much. After successfully refreshing once, I only get this error:
Data: Request failed: Service invoked too many times for one day: urlfetch.
Has Coingecko throttled the API or something recently?
Thanks so much for this!
Hey Rick, that's an error message from Google Sheets itself, not from API Connector or CoinGecko. Google Sheets has a daily limit of 20,000 URL fetches (which includes API calls as well as functions like GOOGLEFINANCE). So it sounds like you're running a massive number of queries and hitting Google's limits. Assuming this isn't on purpose, you probably need to reconfigure your setup so it doesn't refresh so often. If you're using the IMPORTAPI function, please check this article, the section on Excess Recalculation has some suggestions for avoiding the urlfetch error.
Thanks. It was just using the API connector template form this article. I don't get what I could be doing wrong. Even today it still gives the error. Hmmm... I'll keep trying I guess.
That's strange, the template can't possibly run anywhere near 20K requests a day so I don't think it's related to that.
Could you be running any other scripts or add-ons, or "urlfetch" functions like IMPORTRANGE or GOOGLEFINANCE?
If you're not sure, please check https://script.google.com/home/executions to see which scripts are running under your Google account.
Why on Inputs/D8 only gives error?
What does the error say?
it simply appears #ERROR!
Usually there is some extra text when you hover over #ERROR. But anyway this error message is associated with a broken formula. You should be able to fix it by reverting to the original version of the sheet. If you're stuck please feel free to share a link to your sheet through the contact form and I'll check it out.
hi Ana,
thanks for the tutorial! however, I am wondering if it's possible to pull the market cap of the coins at a specified time on a date? ex. I'd like to know the market cap of all coins on my list at 2pm on 2. Sep 2018.
Hey, you can see all the data points provided by CoinGecko here: https://www.coingecko.com/en/api/documentation
The /coins/{id}/history endpoint gives you historical data (name, price, market cap) for a given date, so you could run a request like
https://api.coingecko.com/api/v3/coins/bitcoin/history?date=02-09-2018
They don't let you specify an hour though, so you might need to check out different crypto APIs for that.
Hi Ana
How can I get coin details using (coin_id )number
For example this coin :
{"id":"antimatter","coin_id":14112,"name":"AntiMatter","symbol":"MATTER"
So if I use (id) its works fine
https://api.coingecko.com/api/v3/coins/antimatter
but I want to get same details using ( coin_id":14112 )
Thanks
Based on CoinGecko's documentation, that endpoint only works with the coin ID, you can't substitute in a coin number.
Hello Ana,
I used the template provided. Now I'm wondering if there is an easy way to change the currency of all the coins that are already loaded in there?
Thanks!
Hey Konstantin, sure, just open up the API Connector sidebar, and edit the request called Data. It contains a URL like
https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=+++Inputs!D8+++
. To change that to, say, euros you can edit that to look like this instead:https://api.coingecko.com/api/v3/coins/markets?vs_currency=eur&ids=+++Inputs!D8+++
Hey Ana,
thank you for your quick reply. It worked for a minute but then I'm getting this error message:
"We received an error from the API server (429) show response
error code: 1015"
Do you know how I could resolve this?
Thanks!
Yep, unfortunately rate limits are pretty common with CoinGecko. Just wait and try again later, you can see some more info about it in the "limits" section above.
- How to remove the header from my requests to avoid situations like this: https://i.imgur.com/3zGGPph.png?
- For the situation above I'm doing 2 different requests because if I do it in the same request the tokens are ordered based on market cap (e.g. BTC --> ETH --> BNB), how can I maintain a custom order (e.g. BNB --> BTC --> ETH)?
If you use "append" mode the headers won't print out. But as for maintaining an order, I would just create a second sheet where you list the coins in the order you want, and then do a VLOOKUP to pull in the values from your data sheet. Then you can maintain your order regardless of how the API sends back the data.
Hi Ana, thanks for the tutorial. I'm wondering if there is a way to pull random currency prices from coingecko with an API regardless of their rank? Thanks in advance
I'm not really sure what you mean by random, do you mean get the price of a random coin? I don't think CoinGecko has any endpoint for that, you can either get all the coins or you can get coins that you specify. I suppose you could pull all the coins and then pick a random number yourself (maybe with a Sheets function) and then grab the associated coin, would that work?
Hi Ana, thanks for this! Let me try it out.
Hola, hay alguna manera de actualizar la información del fichero añadiendo un boton"update" asociado a una macro?
y segunda cuestión, se puede generar automaticamente ficheros "summary" historicos, correspondientes al número de veces que hayas actualizado el fichero original?
gracias!!
Hello, is there any way to update the file information by adding an "update" button associated to a macro?
and second question, is it possible to automatically generate historical "summary" files, corresponding to the number of times you have updated the original file?
Thank you!
Hey Manuel, you can look into our IMPORTAPI function, which lets you update data by clicking a checkbox (check the section called "Fast cell-based refresh").
As for summary files, I'm not totally sure what you're looking for, but my other (totally free) add-on Archive Data lets you automatically store historical data in your sheet, maybe that's what you're looking for?
Hey, I'd love to have the price data for a specific coin from a specific date until today. Is that possible?
Sure, but I'd use a different API than CoinGecko for this since they don't provide this data.
I like Coinpaprika, you can get a year's worth of open/high/low/close data at a time like this:
https://api.coinpaprika.com/v1/coins/btc-bitcoin/ohlcv/historical?start=2018-02-15&limit=366
This is a very good Job, thanks!
How can I calculate the value of all coins at 31/12/2021?
Thanks
Do you mean total market cap of all crypto on that date? I don't think CoinGecko provides that data, you can check for yourself here. If you're just looking for the value of specific coins, you can use their
/coins/{id}/history?date=31-12-2021
endpoint.Hello,
Is it possible to get the historic data of bitcoin dominance?
Thanks
Sorry, I'm not sure what you mean by Bitcoin dominance. You can see all of CoinGecko's data points here, does that contain what you're looking for?
Hi, how can i list all market by one response?
Do you mean list all coins? This is the URL for coins:
https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd
But they use pagination so you need to make a few requests to get all the data.Hello,
I tried to download the CoinGecko API: https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd but I still get the following error: 1) test: Completed with errors
- We received an error from coingecko.com (403) show responseerror code: 1020 ! What should I do to stop getting this error?
Hey, that’s a common error from CoinGecko, please see here for more info. You can now get an API key to avoid it.
Hi there. How I could get the ATH (e.g. BITCOIN) from a date range ?
It is possible to get the ATH from between 01.01.2023 and 31.01.2023 ?
I don't see ATH as one of CoinGecko's available data points in their docs, but you can use their
/market_chart/range
endpoint to get daily prices between a date range like this:https://api.coingecko.com/api/v3/coins/bitcoin/market_chart/range?vs_currency=usd&from=1680507951&to=1683099951
Hello Ana and Thanks for this article!
One Question regarding the HTTP 429 Rate Limit when using "Refresh All Requests" although I have an API (Demo) Key:
Is there a way to integrate an Pause/Wait within an Request or in between configured Requests?
Cheers
Jan
Hey Jan, API Connector automatically waits 2 seconds between requests so you normally shouldn't be in danger of hitting rate limits. Are these requests only running through the sidebar or are some through IMPORTAPI? Which endpoint(s) are you using?
Hy Ana and Thx for your feedback! I am using the sidebar and get multiple HTTP 429 everytime I am Running my 35 Requests against the endpoint /simple/price/
Instead of running 35 requests to the
/simple/price
endpoint, you should be able to enter list out your 35 coins and fetch them in a single request. To do this via the preset integration, select the/simple/price
endpoint, and enter your 35 coin symbols into theids
parameter. If you're running a custom request, your URL would look like this (replace the coins in bold with your own list):https://api.coingecko.com/api/v3/simple/price?ids=aave,algorand,apecoin,aptos&vs_currencies=usd
offer code no longer valid
Thank you for letting me know, I'll remove it.Edit: The code should still be valid, can you please try again?
I'm playing around with the get NFT request. It looks like that isn't available in API Connector from the dropdown. Is that the case?
Also do you know if it's possible to pull multiple NFT contracts in one request, or I would need separate requests/tabs for each collection?
Correct, we only added the most popular endpoints. Interest in NFTs seems to have declined a lot, but we'll add the NFT-based endpoints if there seems to be demand (I'll take your message as 1 vote for them). As for pulling multiple NFT contracts, CoinGecko only lets you fetch one contract per URL, but if you'd like to fetch multiple contracts you can run a multi-query request in API Connector that cycles through a list of URLs. There are a few ways to set that up, e.g. you could simply list your URLs one after the other in the request URL field, or you could list your contract addresses in your sheet and then reference those cells in your request, e.g.
https://pro-api.coingecko.com/api/v3/nfts/ethereum/contract/+++Sheet1!A1:A10+++
Hello, I am trying to fetch data from the Coin Historical Data by ID, but i get in my console portfolio:1 Access to XMLHttpRequest at 'https://pro-api.coingecko.com/api/v3/coins/bitcoin/history' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Is there a reason why this may be happening.
Many thanks,
Dan
I just ran that URL (including the required date parameter, so
https://pro-api.coingecko.com/api/v3/coins/bitcoin/history?date=30-12-2023&localization=false
) and received the response without issue. Were you running this in API Connector? If not, some people here say they fixed the issue by removing the trailing slash.Thank you for the response, I have changed the url export
const getPortfolioData = createAsyncThunk(
"portfolioData/getPortfolioData",
async (coinId: string, { rejectWithValue }) => {
try {
const { data } = await axios.get(
`https://pro-api.coingecko.com/api/v3/coins/${coinId}/history?date=30-12-2023&localization=false`
);
console.log(data);
return data;
} catch (error) {
return rejectWithValue(error);
}
}
);
i am using redux to fetch this data if that helps understanding how it is being used. But i still get the same response with it being blocked :/
It worked now, thank you it was a small typo error. that was a fun 4 hours
Oh nooo! But thank you for the update, and I'm glad you got it sorted in the end.