---
title: "CoinGecko API: Crypto Prices and Markets as JSON"
description: "Seven CoinGecko endpoints as JSON at 1 credit each: listings with price, market_cap and change_24h, daily history, exchange pairs and trending coins."
url: https://perceptlayer.com/blog/coingecko-api-json
---

[Blog](https://perceptlayer.com/blog) / [API guides](https://perceptlayer.com/blog/category/api-guides)

# CoinGecko API: Crypto Prices and Markets as JSON

21 Nov 2026 Perceptlayer 7 min read

To get CoinGecko data as JSON, call one of seven `GET` endpoints under `/v1/coingecko/`, each 1 credit per successful call. `listings` returns ranked coins with `price`, `market_cap`, `volume_24h` and `change_24h`; `coin` returns one coin by `id`; `history` returns daily points; `markets` returns trading pairs; and `search`, `trending` and `exchanges` cover discovery. This guide shows each request, the parameters, recorded responses, a Python snapshot job and the cost per coin tracked.

## Key takeaways

-   All seven CoinGecko endpoints cost 1 credit per successful call; `coin`, `history` and `markets` require an `id`, and `search` requires `q`.
-   The `id` you pass is the `id` field from `search` or `listings`: the recorded search for "bitcoin" returned `id: "bitcoin"`, the value the recorded `coin`, `history` and `markets` calls used.
-   `currency` accepts `USD`, `EUR`, `GBP` or `BTC` on `coin`, `history`, `listings`, `markets` and `trending`.
-   The recorded `history` call with `days=30` returned `points: 31`, each with `timestamp`, `price`, `market_cap` and `volume`.
-   A daily snapshot of 500 coins at the recorded page size of 100 is 5 calls a day, 5 × 30 × 1 credit = 150 credits a month.

## What does the CoinGecko API on Perceptlayer cover?

The CoinGecko API on Perceptlayer has seven endpoints: a ranked list of coins, one coin's details, a coin's price history, the trading pairs for a coin, a coin search, trending coins and a list of exchanges. All are `GET` requests that return JSON, and all cost 1 credit per successful call. Most jobs start with `listings` or `search` to get coin IDs, then call the per-coin endpoints with those IDs.

| Method | Path | Returns | Required | Optional |
| --- | --- | --- | --- | --- |
| `GET` | `/v1/coingecko/listings` | Ranked coins with prices | none | `page`, `per_page`, `currency`, `order`, `category` |
| `GET` | `/v1/coingecko/coin` | One coin | `id` | `currency` |
| `GET` | `/v1/coingecko/history` | Price, market cap and volume points | `id` | `days`, `currency` |
| `GET` | `/v1/coingecko/markets` | Trading pairs for a coin | `id` | `page`, `currency` |
| `GET` | `/v1/coingecko/search` | Coins matching a query | `q` | `page`, `per_page` |
| `GET` | `/v1/coingecko/trending` | Trending coins | none | `currency` |
| `GET` | `/v1/coingecko/exchanges` | Exchanges | none | `page`, `per_page` |

The data is collected from publicly available sources and returned as found at the time of the call. This isn't CoinGecko's own developer API, and this guide makes no claims about that one; if you're comparing the two, read CoinGecko's documentation and terms yourself. Nothing here is investment advice: the endpoints return market data, and what you do with it is your call. The [CoinGecko API page](https://perceptlayer.com/apis/coingecko) has every endpoint and a playground.

## How do you find a coin's ID?

Call `search` with a `q` and read the `id` of each result. The `id` is a lowercase slug, not a ticker: the recorded search for "bitcoin" returned `bitcoin` and `bitcoin-cash`, with symbols `btc` and `bch`. Symbols don't identify a coin on their own here, so store the `id` and pass it to `coin`, `history` and `markets`, which all take an `id` up to 100 characters.

```bash
curl "https://api.perceptlayer.com/v1/coingecko/search?q=bitcoin" \
  -H "X-API-Key: $API_KEY"
```

```json
{
  "success": true,
  "data": {
    "query": "bitcoin",
    "search": [
      {
        "id": "bitcoin",
        "name": "Bitcoin",
        "symbol": "btc",
        …
        "rank": 1
      },
      {
        "id": "bitcoin-cash",
        "name": "Bitcoin Cash",
        "symbol": "bch",
        …
        "rank": 23
      }
    ],
    "pagination": {
      "page": 1,
      "per_page": 100,
      "total": 25,
      "total_pages": 1,
      "has_more": false
    }
  },
  "meta": {
    "endpoint_family": "search",
    …
    "credits_charged": 1,
    "credits_remaining": 999
  }
}
```

The search matched 25 coins on one page, so `has_more` is `false`. Keys start with `sk_live_` and go in the `X-API-Key` header, or in the `api_key` query parameter where headers aren't possible; the [authentication docs](https://docs.perceptlayer.com/authentication) cover both.

### Which parameters do the endpoints take?

Seven parameters appear across the endpoints. The table lists each with the constraints the API documents. Nothing else is documented, including defaults and page-size limits, so check behaviour in the playground before you depend on it.

| Parameter | Endpoints | Type | Documented constraint |
| --- | --- | --- | --- |
| `id` | `coin`, `history`, `markets` (required) | string | Up to 100 characters |
| `q` | `search` (required) | string | Up to 100 characters |
| `currency` | `coin`, `history`, `listings`, `markets`, `trending` | string | One of `USD`, `EUR`, `GBP`, `BTC` |
| `days` | `history` | integer | None documented |
| `order` | `listings` | string | One of `market_cap_desc`, `volume_desc`, `volume_asc`, `id_asc`, `id_desc` |
| `category` | `listings` | string | Up to 60 characters |
| `page`, `per_page` | `listings`, `search`, `exchanges` ( `markets` takes `page` only) | integer | None documented |

The paged endpoints return a `pagination` object. In every recording it showed `per_page: 100` and a `has_more` flag, so loop on `page` until `has_more` is `false`.

## What does a listings response contain?

`listings` returns a `listings` array of ranked coins plus `pagination`. Each coin carries its `id`, `symbol`, `name` and `rank`, the price in the requested `currency`, changes over 1 hour, 24 hours and 7 days, market cap, 24-hour volume, high and low, supply figures and all-time high and low. This is the recorded `page=1&currency=USD` call, trimmed to the first coin and parts of the second:

```json
{
  "success": true,
  "data": {
    "listings": [
      {
        "id": "bitcoin",
        "symbol": "btc",
        "name": "Bitcoin",
        …
        "rank": 1,
        "price": 64508,
        "currency": "USD",
        "change_1h": 0.2268,
        "change_24h": -0.64141,
        "change_7d": -12.439,
        "market_cap": 1297493177878,
        "volume_24h": 33883117301,
        "high_24h": 65268,
        "low_24h": 63361,
        "circulating_supply": 20113584,
        "total_supply": 20113584,
        "max_supply": 21000000,
        "ath": 126080,
        "ath_date": "2025-10-06T10:57:42+00:00",
        …
        "last_updated": "2026-11-18T04:20:51+00:00"
      },
      {
        "id": "ethereum",
        "symbol": "eth",
        …
        "rank": 2,
        "price": 1806.73,
        …
        "circulating_supply": 122230379.06395556,
        "total_supply": 122230379.06395556,
        "ath": 4946.05,
        …
      }
    ],
    "pagination": {
      "page": 1,
      "per_page": 100,
      "has_more": true
    }
  },
  …
}
```

Two things to notice. The second coin has no `max_supply` field at all, so treat every field as optional and don't assume `null`. And the `change_*` fields are percentages as numbers ( `-0.64141`), while `last_updated` tells you when the figure was current, which matters more than when you called. The `coin` endpoint returns the same price and supply fields for one coin, plus `categories`, a `description` and `urls`.

## How do you get price history?

Call `history` with an `id` and `days`. The recorded call for `bitcoin` with `days=30` returned `points: 31` and a `history` array of daily points, each with a `timestamp`, `price`, `market_cap`, `volume` and `currency`. The timestamps in the recording fall at midnight UTC, one day apart.

```bash
curl "https://api.perceptlayer.com/v1/coingecko/history?id=bitcoin&days=30" \
  -H "X-API-Key: $API_KEY"
```

```json
{
  "success": true,
  "data": {
    "id": "bitcoin",
    "days": 30,
    "currency": "USD",
    "points": 31,
    "history": [
      {
        "timestamp": "2026-10-20T00:00:00Z",
        "price": 81875.26391574314,
        "market_cap": 1645751918646.9844,
        "volume": 25801005531.152863,
        "currency": "USD"
      },
      …
    ]
  },
  …
}
```

The recording only shows `days=30` with daily points. The spacing for other `days` values isn't documented, so check the timestamps in a playground call before you mix ranges in one table.

### What do markets and exchanges return?

`markets` lists the trading pairs for one coin: the recorded call for `bitcoin` returned pairs with `exchange`, `exchange_id`, `pair`, `base`, `target`, `price`, `volume_24h`, `volume_usd`, `is_stale`, `is_anomaly` and `last_updated`. Filter on `is_stale` and `is_anomaly` before you compare prices across venues. `exchanges` lists venues with `trust_score`, `trust_score_rank` and `volume_24h`; in the recording that volume came with `volume_currency: "BTC"`, so read the unit before you add it to USD figures.

`trending` returns coins with `rank`, `price`, `price_btc` and `change_24h`. Its `symbol` was uppercase in the recording ( `BREV`), while `listings` and `search` returned lowercase ( `btc`), so normalise symbols before you join on them, or better, join on `id`.

## How do you build a daily snapshot in Python?

A daily snapshot pages through `listings` and appends one row per coin with the call time. Over weeks, that gives you your own ranked table to chart or compare, at one credit per 100 coins in the recorded page size. The script below uses `requests` and `csv` and reads only fields in the recorded response.

```python
import csv
import datetime
import os
import time

import requests

API_KEY = os.environ["API_KEY"]
URL = "https://api.perceptlayer.com/v1/coingecko/listings"
PAGES = 5

def get_page(page, attempts=3):
    for _ in range(attempts):
        r = requests.get(
            URL,
            params={"page": page, "currency": "USD"},
            headers={"X-API-Key": API_KEY},
            timeout=60,
        )
        if r.status_code in (429, 503):
            time.sleep(int(r.headers.get("Retry-After", "5")))
            continue
        r.raise_for_status()
        return r.json()["data"]
    raise RuntimeError(f"gave up on page {page}")

now = datetime.datetime.now(datetime.timezone.utc).isoformat()
with open("coingecko-listings.csv", "a", newline="") as f:
    out = csv.writer(f)
    for page in range(1, PAGES + 1):
        data = get_page(page)
        for c in data.get("listings", []):
            out.writerow([
                now, c.get("id"), c.get("symbol"), c.get("rank"), c.get("price"),
                c.get("currency"), c.get("change_24h"), c.get("market_cap"),
                c.get("volume_24h"), c.get("circulating_supply"), c.get("last_updated"),
            ])
        if not data.get("pagination", {}).get("has_more"):
            break
        time.sleep(1)
```

The pause keeps a free account within its 1 request a second. Every error returns an HTTP status and a JSON body with `code`, `message` and `request_id`, and costs nothing: retry `rate_limited` (429) and `temporarily_unavailable` (503) after `Retry-After`, and treat `invalid_parameters` (422), such as a `currency` outside the four allowed values, as a bug. Requests have no idempotency key, so a client timeout can hide a billed call; keep the timeout generous. The [errors docs](https://docs.perceptlayer.com/errors) list every code.

## What does tracking CoinGecko data cost?

Every successful call costs 1 credit, so cost depends on how many calls your job makes, not how many coins each call returns. `listings` spreads one credit across a page of coins, while `coin`, `history` and `markets` cost one credit per coin per call. Failed calls cost nothing and return `X-Credits-Used: 0`.

| Job | Arithmetic | Credits a month |
| --- | --- | --- |
| 500 coins daily via `listings` | 5 pages × 30 days × 1 credit | 150 |
| Top 100 hourly via `listings` | 24 calls × 30 days × 1 credit | 720 |
| 30-day `history` for 50 coins, daily | 50 × 30 days × 1 credit | 1,500 |
| `markets` page 1 for 100 coins, daily | 100 × 30 days × 1 credit | 3,000 |

All four fit the Starter pack's 10,000 credits, even together (5,370 credits). The 100 free credits on signup cover the first job for 20 days, or 100 calls of any kind. Purchased credits last 12 months. See [pricing](https://perceptlayer.com/pricing) for what credits cost and the [credits docs](https://docs.perceptlayer.com/credits) for how calls are debited.

To try it, run `listings` with `currency=USD` in the playground on the [listings endpoint page](https://perceptlayer.com/apis/coingecko/listings), then [get a free API key](https://perceptlayer.com/signup) and schedule the script. Market data from other sources is on the [finance APIs](https://perceptlayer.com/verticals/finance) page, and the [Yahoo Finance API guide](https://perceptlayer.com/blog/yahoo-finance-api-json) and [TradingView API guide](https://perceptlayer.com/blog/tradingview-api-json) cover stocks the same way.

## APIs in this post

-   [CoinGecko **1 credit per call** · 7 endpoints](https://perceptlayer.com/apis/coingecko)

## Frequently asked questions

### Is this CoinGecko's official API?

No. These are Perceptlayer endpoints that return public CoinGecko data, collected from publicly available sources and returned as found at the time of the call. This guide makes no claims about CoinGecko's own API, its plans or its terms. If you're choosing between them, read CoinGecko's documentation and compare them yourself.

### How much does one CoinGecko call cost?

Every successful call to any of the seven endpoints costs 1 credit, whatever it returns. A `listings` page of 100 coins costs the same as one `coin` lookup. Failed calls cost nothing and return `X-Credits-Used: 0`. The 100 free credits on signup cover 100 calls. See the pricing page for what credits cost.

### Which currencies can prices be returned in?

`currency` accepts `USD`, `EUR`, `GBP` or `BTC` on `coin`, `history`, `listings`, `markets` and `trending`. The recorded responses all used USD and echo the currency in a `currency` field on each item, so store that field with each price.

### How far back does price history go?

`history` takes a `days` integer, and the API doesn't document a maximum. The recorded call used `days=30` and returned 31 daily points. Try the range you need in the playground and check the `points` count and the spacing of the timestamps before you build on it.

### Can I use this data to decide what to buy?

This guide and these endpoints don't give investment advice. They return market data as found at the time of the call, such as `price`, `change_24h` and `market_cap`. Each figure carries a `last_updated` time, and the `markets` endpoint flags pairs with `is_stale` and `is_anomaly`. Decisions about buying or selling are yours, and a qualified adviser is the right person to ask.

coingecko crypto prices market data price history python

## More from the blog

1.  [API guides](https://perceptlayer.com/blog/category/api-guides) 20 Nov 2026 Perceptlayer 7 min read
    
    ## [TradingView API: Screener and Symbol Data as JSON](https://perceptlayer.com/blog/tradingview-api-json)
    
    Three TradingView endpoints return symbol search, screener snapshots and published ideas as JSON. One POST prices a list of symbols for 1 credit.
    
2.  [API guides](https://perceptlayer.com/blog/category/api-guides) 26 Nov 2026 Perceptlayer 7 min read
    
    ## [Depop API: Resale Listings as JSON](https://perceptlayer.com/blog/depop-api-json)
    
    Search Depop listings as JSON with brand, condition, sizes and price.amount per item; the recorded jacket search had a total\_count of 6,815,522. 1 credit.
    
3.  [API guides](https://perceptlayer.com/blog/category/api-guides) 26 Nov 2026 Perceptlayer 7 min read
    
    ## [Similarweb API: Website Traffic Data as JSON](https://perceptlayer.com/blog/similarweb-api-json)
    
    Get Similarweb traffic estimates as JSON: visits, bounce\_rate, traffic\_sources, top\_countries and top\_keywords for a domain, at 1 credit a call.
