Coins: 17,656
Exchanges: 1,455
Market Cap: $2.508T 2.3%
24h Vol: $71.89B
Gas: 0.107 GWEI
Upgrade to Premium
API
TABLE OF CONTENTS

How to Fetch Real-Time Crypto News with Python Using the CoinGecko API

Brian Lee -

Real-time crypto data is incredibly useful, but most of the time, price movements happen because of specific events or news. Understanding the news behind a price action is equally as important as catching the price movement itself. This is where a crypto news API becomes essential for any developer building trading tools, portfolio trackers, or market dashboards.

In this guide, we'll show you how to use the CoinGecko API's crypto news endpoint to fetch real-time crypto news data, including the latest headlines and news specific to individual coins. We'll also walk through how to practically use it to build a trending crypto news dashboard and run sentiment analysis with a large language model. Let's dive in!

How to Fetch Real-Time Crypto News with Python Using The CoinGecko API


What Is a Crypto News API?

A crypto news API is an endpoint that returns structured, machine-readable news articles about cryptocurrencies without requiring you to build or maintain your own scrapers. Each response includes the article title, source, publication timestamp, URL, and thumbnail image, giving you everything you need to display or process news programmatically.

Unlike a generic news API, a cryptocurrency news API is designed specifically for the crypto ecosystem. The CoinGecko API, for example, provides a crypto news endpoint where you can filter news based on specific coins and also see which other coins each article is related to. You also get real-time curated news from over 100+ trusted sources like CoinTelegraph, Decrypt, and Lookonchain, which helps filter out the noise in a fast-moving market.

One important thing to note is that the CoinGecko crypto news API endpoint returns article headlines, metadata, and URLs to the original source. It does not return the full text content of each article. This makes it ideal for building news feeds, dashboards, and notification systems where you surface headlines and link out to the full news article.


Prerequisites

Before getting started, you will need a CoinGecko API key. The CoinGecko API crypto news endpoint is available on the Analyst plan and above, which also gives you access to 500,000 monthly API call credits, 500 calls per minute, and exclusive endpoints for market data, on-chain analytics, and more. If you do not have one yet, you can subscribe to an Analyst API plan to get started.

You will also need Python 3.8+ installed on your machine. Install the required dependencies with pip.

pip install requests python-dotenv

Next, create a .env file in your project root to store your API key securely.

💡 Pro Tip: Never commit your .env file to version control. Add it to your .gitignore to keep your API key secure.

Setting Up Your API Configuration

Before making any API calls, create a shared configuration module that loads your API key and provides reusable helper functions for all the scripts in this tutorial.

Every script in this tutorial imports from config.py, so your API key and base URL are defined in one place. If you ever need to rotate your key or change your setup, you only update this file.


How to Fetch the Latest Crypto News in Python

The CoinGecko crypto news API endpoint returns the latest cryptocurrency news articles from over 100+ sources, including CoinTelegraph, Decrypt, and Lookonchain. Each article includes the title, source name, publication timestamp, URL, thumbnail image, and a list of related coins. By default, the endpoint returns 10 articles in English and updates every minute.

Let's make our first API call.

Running this script produces output like the following:

Each article in the response includes the headline, source publisher, timestamp, article URL, thumbnail image, and a list of CoinGecko coin IDs that the article mentions. This structured data makes it straightforward to build news feeds, filter articles by coin, or feed headlines into downstream pipelines without any parsing or scraping.


How to Filter Crypto News by Coin

To filter crypto news for a specific cryptocurrency, pass the coin's CoinGecko ID to the CoinGecko crypto news API endpoint and it will return only articles relevant to that coin. For example, passing bitcoin as the coin ID returns news that mentions Bitcoin, while passing ethereum returns Ethereum-specific coverage.

The important prerequisite here is that the endpoint requires the CoinGecko ID string (such as "bitcoin") rather than the ticker symbol (such as "BTC"). Most developers work with ticker symbols in their applications, so you need a way to convert symbols into CoinGecko IDs before making news queries. There are two approaches for this.

  • Approach 1 (Recommended): Using the /search endpoint. This returns results sorted by market cap rank, so searching for "BTC" returns Bitcoin (rank #1) first.

  • Approach 2: Using the /coins/list endpoint. This returns all coins alphabetically. Searching for "btc" may return other tokens before Bitcoin because the results are not ranked by popularity.

For production use, /search is the recommended approach for correct symbol resolution. Here is a helper function that takes a ticker symbol and returns the correct CoinGecko ID.

Fetching News for a Specific Coin

Now combine the resolver with the news fetcher to pull Bitcoin-specific headlines.

One behavior worth noting is that the related coins field in the response can include coins beyond the one you filtered for. A single article tagging both ETH and BTC will appear in both queries. This is useful to know if you are building a pipeline that deduplicates articles across multiple coin watchlists.

Fetching Guides Instead of News

The type parameter also supports "guides", which returns CoinGecko's own editorial guides rather than third-party news articles. This is useful for building an educational content section in a wallet or portfolio app where users can learn about specific assets they hold. Note that using type="guides" requires a coin ID parameter. Calling it without one returns a 400 error.

# Fetch CoinGecko editorial guides for Ethereum
params = {
    "coin_id": "ethereum",
    "type": "guides",
    "per_page": 5,
}

Paginating Through More Results

If you need more than the default 10 articles, the CoinGecko crypto news API endpoint supports up to 20 results per page and up to 20 pages. Below is an example of how you can easily paginate through the results.


To build a real-time trending crypto news dashboard, we will combine the CoinGecko crypto news API endpoint with the trending coins and top gainers/losers endpoints to create a unified interface that shows not just what is trending, but why it is trending.

Step 1: Fetch Trending Coins, Gainers, and Losers

We use /search/trending to get the most-searched coins in the last 24 hours, and /coins/top_gainers_losers to get the biggest market movers by price change.

Step 2: Fetch News for Each Coin

Next, loop through the trending coins, gainers, and losers, and fetch related news for each one. We also call the /coins/{id} endpoint to fetch coin logo URLs for the dashboard display.

Step 3: Build the Dashboard

The build_dashboard method ties everything together by collecting trending coins, gainers, losers, and their related news into a single data structure.

Run the dashboard builder with:

python market_trends_dashboard.py

Frontend Demo

The GitHub repository includes a full interactive HTML dashboard that renders the trending crypto news data as a web page. Generate it with:

python market_trends_dashboard.py --html

This produces output/html/market_trends_demo.html with the following features:

  • Trending Coins section where you can click any coin to expand and see its related news headlines

  • Top Gainers (24h) section showing the biggest price movers, each with expandable news explaining why they are moving

  • Top Losers (24h) section showing the steepest decliners, each with expandable news for context

  • Latest Crypto News grid displaying a list of real-time articles with thumbnails, hyperlinked titles, source names, and related coin logos

  • Filter by coin dropdown that dynamically fetches and displays news for a selected coin

Trending Crypto News Dashboard Demo

This is a complete, production-ready example of what a crypto news dashboard integration looks like, combining CoinGecko's trending, market movers, and crypto news endpoints into a unified view.


How to Use Crypto News for Sentiment Analysis

To build a crypto news sentiment analysis pipeline, you can use the CoinGecko crypto news API endpoint to fetch the latest article titles and source names for any coin, then pass them directly into a large language model prompt. The endpoint also returns a related coins field for each article, which lists all the cryptocurrencies mentioned in that story. This is helpful because you can batch-process news across an entire watchlist and automatically tag each article to every relevant coin in a single pass, rather than querying one coin at a time.

Here is a minimal pattern that fetches headlines for a coin and builds a prompt ready for any LLM API or SDK.

This script intentionally does not include a specific LLM SDK as a dependency. It generates the prompt string, which you can pass to OpenAI, Anthropic, Google, or any other provider your stack already uses.

Crypto News-based Sentiment Analysis Bot Using CoinGecko API Crypto News Endpoint


Conclusion

You now have a working Python integration that pulls structured, coin-specific crypto news from over 100+ sources, filtered to whatever coins you care about, and ready to feed into any interface or pipeline you are building.

The dashboard example shows how powerful this becomes when you combine trending data, market movers, and news into a single view. Whether you are building a portfolio tracker, a trading terminal, or an AI sentiment pipeline, the CoinGecko crypto news API endpoint provides the content layer that compliments real-time price data for a more informed understanding of the fast moving markets.

To get started quickly with all the code from this tutorial, you can clone the GitHub repository which includes every script and the interactive HTML dashboard.

If you built the trending news dashboard and want to push those headlines to users automatically, building a crypto Telegram bot is the most natural next step since you already have the data layer and the bot is simply the delivery mechanism on top of it. If the sentiment analysis section caught your attention, our guide on developing a trading strategy based on sentiment signals goes much deeper into scoring and acting on those signals rather than just generating a summary.

Ready to start building? Subscribe to a CoinGecko API Analyst plan to unlock the crypto news endpoint, top gainers and losers data, and production-grade rate limits with 500,000 monthly API call credits. If you are not ready to subscribe yet, you can get a free Demo API key to explore over 50 crypto data endpoints with 10,000 free monthly API calls and see whether the CoinGecko API is the right fit for what you are building.

CoinGecko's Content Editorial Guidelines
CoinGecko’s content aims to demystify the crypto industry. While certain posts you see may be sponsored, we strive to uphold the highest standards of editorial quality and integrity, and do not publish any content that has not been vetted by our editors.
Learn more
Want to be the first to know about upcoming airdrops?
Subscribe to the CoinGecko Daily Newsletter!
Join 600,000+ crypto enthusiasts, traders, and degens in getting the latest crypto news, articles, videos, and reports by subscribing to our FREE newsletter.
Tell us how much you like this article!
Brian Lee
Brian Lee
Brian is a Growth Marketer at CoinGecko, helping developers, traders, and crypto businesses discover and use CoinGecko API to build, track, and scale smarter with real-time crypto market data.

Related Articles

New Portfolio
Icon & name
Select Currency
Suggested Currencies
USD
US Dollar
IDR
Indonesian Rupiah
TWD
New Taiwan Dollar
EUR
Euro
KRW
South Korean Won
JPY
Japanese Yen
RUB
Russian Ruble
CNY
Chinese Yuan
Fiat Currencies
AED
United Arab Emirates Dirham
ARS
Argentine Peso
AUD
Australian Dollar
BDT
Bangladeshi Taka
BHD
Bahraini Dinar
BMD
Bermudian Dollar
BRL
Brazil Real
CAD
Canadian Dollar
CHF
Swiss Franc
CLP
Chilean Peso
CZK
Czech Koruna
DKK
Danish Krone
GBP
British Pound Sterling
GEL
Georgian Lari
HKD
Hong Kong Dollar
HUF
Hungarian Forint
ILS
Israeli New Shekel
INR
Indian Rupee
KWD
Kuwaiti Dinar
LKR
Sri Lankan Rupee
MMK
Burmese Kyat
MXN
Mexican Peso
MYR
Malaysian Ringgit
NGN
Nigerian Naira
NOK
Norwegian Krone
NZD
New Zealand Dollar
PHP
Philippine Peso
PKR
Pakistani Rupee
PLN
Polish Zloty
SAR
Saudi Riyal
SEK
Swedish Krona
SGD
Singapore Dollar
THB
Thai Baht
TRY
Turkish Lira
UAH
Ukrainian hryvnia
VEF
Venezuelan bolívar fuerte
VND
Vietnamese đồng
ZAR
South African Rand
XDR
IMF Special Drawing Rights
Cryptocurrencies
BTC
Bitcoin
ETH
Ether
LTC
Litecoin
BCH
Bitcoin Cash
BNB
Binance Coin
EOS
EOS
XRP
XRP
XLM
Lumens
LINK
Chainlink
DOT
Polkadot
YFI
Yearn.finance
SOL
Solana
Bitcoin Units
BITS
Bits
SATS
Satoshi
Commodities
XAG
Silver - Troy Ounce
XAU
Gold - Troy Ounce
Select Language
Popular Languages
EN
English
RU
Русский
DE
Deutsch
PL
język polski
ES
Español
VI
Tiếng việt
FR
Français
PT-BR
Português
All Languages
AR
العربية
BG
български
CS
čeština
DA
dansk
EL
Ελληνικά
FI
suomen kieli
HE
עִבְרִית
HI
हिंदी
HR
hrvatski
HU
Magyar nyelv
ID
Bahasa Indonesia
IT
Italiano
JA
日本語
KO
한국어
LT
lietuvių kalba
NL
Nederlands
NO
norsk
RO
Limba română
SK
slovenský jazyk
SL
slovenski jezik
SV
Svenska
TH
ภาษาไทย
TR
Türkçe
UK
украї́нська мо́ва
ZH
简体中文
ZH-TW
繁體中文
Welcome to CoinGecko
Welcome back!
Login or Sign up in seconds
or
Sign in with . Not you?
Forgot your password?
Didn't receive confirmation instructions?
Resend confirmation instructions
Password must contain at least 8 characters including 1 uppercase letter, 1 lowercase letter, 1 number, and 1 special character
By continuing, you acknowledge that you've read and agree fully to our Terms of Service and Privacy Policy.
Get Price Alerts with CoinGecko App
Forgot your password?
You will receive an email with instructions on how to reset your password in a few minutes.
Resend confirmation instructions
You will receive an email with instructions for how to confirm your email address in a few minutes.
Get the CoinGecko app.
Scan this QR code to download the app now App QR Code Or check it out in the app stores
Add NFT
Track wallet address
Paste
We only display assets from supported networks.
Ethereum Mainnet
Base Mainnet
BNB Smart Chain
Arbitrum
Avalanche
Fantom
Flare
Gnosis
Linea
Optimism
Polygon
Polygon zkEVM
Scroll
Stellar
Story
Syscoin
Telos
X Layer
Xai
Read-only access
We only fetch public data. No private keys, no signing, and we can't make any changes to your wallet.
Create Portfolio
Select icon
💎
🔥
👀
🚀
💰
🦍
🌱
💩
🌙
🪂
💚
CoinGecko
Better on the app
Real-time price alerts and a faster, smoother experience.
You’ve reached the limit.
Guest portfolios are limited to 10 coins. Sign up or log in to keep the coins listed below.