Coins: 17,540
Exchanges: 1,475
Market Cap: $2.669T 0.1%
24h Vol: $51.358B
Gas: 0.292 GWEI
Go Ad-free
API
TABLE OF CONTENTS

How to Fetch Crypto Logos and Metadata with Python

Brian Lee -

The number of tokens and coins in the crypto market has grown significantly over the years, and that pace shows no sign of slowing down. Building anything user-facing in this space, whether a simple price feed, a watchlist, or a full-fledged analytics platform, requires more than just market data. Users expect to see logos, read descriptions, find social handles, and verify contract addresses. That kind of metadata is what turns raw data into something that actually feels like a product.

In this guide, you'll build a set of reusable Python functions that fetch coin logos, resolve token contract addresses to their full metadata profile, save images to disk, and handle bulk requests efficiently using the CoinGecko API. By the end, you'll have a working toolkit ready to plug into any crypto-facing application. You can also clone the GitHub repository below in case you want to jump ahead and get started immediately.

How To Fetch Crypto Logos & Metadata with Python | CoinGecko API


Prerequisites

Before writing any code, make sure you have the following ready.

Install the dependencies with pip.

pip install -r requirements.txt

You'll also need a CoinGecko API key. If you don't have one yet, follow this guide on how to get your free Demo API key. The Demo plan provides 30 calls per minute, which is enough for everything covered here.


Setting Up Your Configuration

Start by creating a config file that stores your API key and base URL. This setup makes it easy to switch between the Demo and Pro environments without touching your business logic.

Create a .env file in your project root.


How to Map Any Coin Symbol to a CoinGecko Coin ID

Every endpoint in the CoinGecko API uses a coin ID (a lowercase slug like "bitcoin" or "chainlink"), not a ticker symbol like "BTC" or "LINK". The first step in fetching coin metadata is building a reliable mapping between the two.

The /coins/list endpoint returns the ID, name, and symbol for every coin on CoinGecko in a single request. No pagination needed. You can build a local lookup table from this response and cache it to disk so you're not fetching it on every run.

The build_coin_lookup() function below handles fetching, caching, and returning the mapping in a single run.

💡 Pro Tip: Each coin on CoinGecko has a unique Coin ID that is used across all API requests. These IDs often differ from ticker symbols (e.g. BTC is bitcoin, ETH is ethereum). If you only need the ID for a specific coin rather than the full list, you can find it by visiting the coin's page on the CoinGecko website and looking for the "API ID" label, or by referencing this list of CoinGecko API IDs.

How to Fetch a Single Coin's Logo and Full Metadata Profile

Once you have a coin ID, the /coins/{id} endpoint is the richest source of metadata available in the API. It returns an image object with three sizes, a text description, homepage URLs, social media links, genesis date, and on-chain contract addresses. Everything you need for a full coin profile page.

The get_coin_metadata() function below calls this endpoint with only the fields we need, then extracts and returns everything into a clean, flat mapping.

The output looks something like this:

💡 Pro Tip: The CoinGecko API returns description fields with \r\n escape sequences to represent line breaks. If you're rendering descriptions in a web UI, remember to replace them with <br> tags before displaying.

How to Bulk-Fetch Cryptocurrency Logos for Feeds and Watchlists

For a typical watchlist with more than just a few coins, calling /coins/{id} once per coin is not efficient. Each token requires its own request, which adds up quickly and is wasteful on API credits when all you actually need are the image URLs.

The /coins/markets endpoint is the better approach for bulk logo fetching. A single request returns data for up to 250 coins, including an image URL for each one. This is one URL per coin rather than three sizes, which is the right fit for list and grid views.

The get_bulk_logos() function below handles the batching automatically, chunking your coin list and returning a clean mapping of coin ID to image URL.

Here is a minimal HTML example showing how you might wire that data directly into a price feed UI.

crypto watchlist with logo image and metadata from CoinGecko API

💡 Pro Tip: If your project needs thumb, small, and large images in bulk rather than a single URL per coin, loop /coins/{id} with time.sleep() between calls. For production-scale traffic, upgrading to a paid API plan raises your rate limit and removes the need for artificial delays entirely.
Subscribe to CoinGecko API

How to Fetch a Coin Logo and Metadata Using a Contract Address

Aside from querying by CoinGecko coin ID, there is another way to retrieve the same logo and metadata that tends to feel more natural if you are building in Web3: fetching directly by contract address. The /coins/{id}/contract/{contract_address} endpoint returns the full metadata profile, including the thumb, small, and large image URLs, using only the asset’s contract address.

This is particularly useful when your upstream data already carries contract addresses, such as from an on-chain event, a DEX integration, or an external data source. Rather than maintaining a separate ID mapping layer, you can pass the address directly and continue from there.

In this endpoint, {id} refers to the asset platform (the blockchain network), not the coin itself. Common values include ethereum, solana, polygon-pos, and base. The full list is available via calling the /asset_platforms endpoint.

The get_token_metadata_by_contract() function below follows the same extraction pattern as fetching a single coin's logo and metadata as shown above, and returns an identically structured dictionary mapping.

💡 Pro tip: You can refer to the CoinGecko API platform and network IDs sheet for the full list of platform IDs supported.

How to Bulk Download Cryptocurrency Coin Logos

You now have image URLs. This step shows how to bulk download them to your local device, name them consistently by coin ID, and cache them locally so repeat runs skip files you've already saved.

The download_coin_logo() function below handles each of those steps, including directory creation and an existence check before any network call is made.


How to Fetch Onchain Token Metadata from GeckoTerminal

The endpoints above cover every coin indexed on CoinGecko. For tokens listed exclusively on GeckoTerminal, such as newer launches, meme coins, and DEX-native projects, the onchain endpoints provide metadata directly from the chain.

For a single token, use /onchain/networks/{network}/tokens/{address}/info. For multiple tokens in one call, use /onchain/networks/{network}/tokens/multi/{addresses}, which accepts up to 30 contract addresses as a comma-separated string.

The two functions below cover both cases using the same response structure.

Note: GeckoTerminal network IDs differ from CoinGecko asset platform IDs. For example, Ethereum is eth on GeckoTerminal but ethereum on CoinGecko. Use /onchain/networks to retrieve the full list of supported GeckoTerminal network IDs.

The Github repository prepared below also includes additional CLI flags for fetching trending tokens and recently updated token metadata across all networks, using the /onchain/tokens/info_recently_updated endpoint. These are available on the free Demo API plan and make it easy for you to monitor what's active on-chain without needing to know specific addresses in advance. Example of how the output will look like in CSV:


Conclusion

You now have a working Python script for fetching crypto logos and metadata from the CoinGecko API. Each module in this guide is self-contained and can be dropped into any project independently, whether you are building a coin profile backend, populating a React watchlist with live logos, powering a Discord bot's embed thumbnails, or seeding a token database at scale.

⚡ To get started quickly, you can clone this GitHub repository, add your Demo API key, and run any module directly.

From here, you may also want to consider enriching your coin profiles with historical price data for sparklines, or combining logos with live prices to build a complete portfolio tracker. Our guides on how to fetch crypto historical data with Python and how to build a crypto portfolio dashboard cover both in full.

Ready to start building? Get your free Demo API key and try fetching logos and metadata for your favorite coins and tokens. When your project grows and you need higher rate limits and access to more comprehensive crypto data, consider upgrading to a paid API plan.

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!
Vote count: 1
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.

More 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.