> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coingecko.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Delivery Methods

> REST API, WebSocket, and Webhooks — choose the right method for your use case

Three ways to access CoinGecko data. Pick the one that fits your application — or combine them.

<Frame>
  <img src="https://mintcdn.com/coingecko/i9l2MT4etZGYjSx8/assets/images/data-delivery-methods.gif?s=bbe69f44a42f8d5b4b98993231f3c7cb" alt="Diagram showing three data delivery methods: REST API uses HTTP request-response, WebSocket maintains a persistent connection, and Webhook sends event-driven HTTP callbacks" noZoom width="960" height="641" data-path="assets/images/data-delivery-methods.gif" />
</Frame>

|                   | REST API                   | WebSocket <sup>BETA</sup> | Webhooks <sup>NEW</sup>  |
| ----------------- | -------------------------- | ------------------------- | ------------------------ |
| **Communication** | Request → Response         | Persistent connection     | Event-driven callback    |
| **Data flow**     | You pull                   | Pushed to you             | Pushed to you            |
| **Latency**       | Per-request                | Real-time                 | Near real-time           |
| **Use case**      | On-demand queries, polling | Live streaming, trading   | Reacting to data changes |

<Card title="Share Feedback" icon="comment" href="https://docs.google.com/forms/d/e/1FAIpQLSf33wT9liXr7hfx3IPKnHs4zBR61zLv0rart6s27_6HND8Uwg/viewform">
  Tell us how you use CoinGecko's data delivery methods and what you'd like to see next.
</Card>

***

## REST API — You ask, we answer

Send an HTTP request, get a JSON response. The simplest way to query prices, market data, historical charts, and more.

<CodeGroup>
  ```bash Pro API theme={null}
  curl "https://pro-api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd" \
    -H "x-cg-pro-api-key: YOUR_API_KEY"
  ```

  ```bash Demo API theme={null}
  curl "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd" \
    -H "x-cg-demo-api-key: YOUR_API_KEY"
  ```
</CodeGroup>

<CardGroup cols={2}>
  <Card title="Best for" icon="bullseye-arrow">
    * On-demand data fetches (prices, coin info, historical charts)
    * Periodic polling on a schedule
    * Backfilling or one-time data pulls
    * Prototyping and quick integrations
  </Card>

  <Card title="Coverage" icon="grid-2">
    * 50+ endpoints on Demo & Basic plans
    * 80+ endpoints on Analyst plan & above
    * Prices, market data, exchanges, NFTs, onchain DEX data, and more
  </Card>
</CardGroup>

<Note>
  Available on **all plans**, including the free Demo plan.
</Note>

<Card title="Explore REST API Endpoints" icon="arrow-right" href="/reference/endpoint-overview">
  Browse all available endpoints across CoinGecko and Onchain APIs.
</Card>

***

## WebSocket — Stream data in real time

A persistent connection that pushes updates to your application as they happen. Subscribe once, receive continuous data — no repeated requests.

<CardGroup cols={2}>
  <Card title="Best for" icon="bullseye-arrow">
    * Live price tickers and trading dashboards
    * Real-time DEX trade monitoring
    * Streaming OHLCV candlestick charts
    * Any application where latency matters
  </Card>

  <Card title="Channels" icon="tower-broadcast">
    * `C1` — CoinGecko coin prices
    * `G1` — Onchain token prices
    * `G2` — Onchain trades
    * `G3` — Onchain OHLCV candles
  </Card>
</CardGroup>

<Note>
  Requires [Analyst plan & above](https://www.coingecko.com/en/api/pricing).
</Note>

<Card title="Explore WebSocket Channels" icon="arrow-right" href="/websocket">
  Stream real-time prices, trades, and OHLCV data.
</Card>

***

## Webhooks — Get notified when data changes

Event-driven callbacks that push notifications to your server when specific changes happen on CoinGecko — no polling required.

<CardGroup cols={2}>
  <Card title="Best for" icon="bullseye-arrow">
    * Keeping your database in sync with CoinGecko
    * Reacting to coin metadata changes (rebrands, new chains, alerts)
    * Compliance and risk monitoring
    * Replacing cron jobs with event-driven updates
  </Card>

  <Card title="Events" icon="bell">
    * `cg.coin.info.updated` — coin metadata changes across all active coins
    * `cg.coin.price.updated` — price target alerts *(Private Beta)*
    * `cg.coin.listed` — new token listings *(Private Beta)*
  </Card>
</CardGroup>

<Note>
  Requires [Analyst plan & above](https://www.coingecko.com/en/api/pricing).
</Note>

<Card title="Explore Webhook Events" icon="arrow-right" href="/webhooks">
  Set up event-driven notifications for coin data changes.
</Card>

***

## Plan Access

|                     |    REST API   | WebSocket <sup>BETA</sup> | Webhooks <sup>NEW</sup> |
| ------------------- | :-----------: | :-----------------------: | :---------------------: |
| **Demo** (Free)     | 50+ endpoints |             —             |            —            |
| **Basic**           | 50+ endpoints |             —             |            —            |
| **Analyst & above** | 80+ endpoints |             ✅             |            ✅            |
| **Enterprise**      | 80+ endpoints |             ✅             |            ✅            |
| **Credit cost**     |   1 per call  |      0.1 per response     |       10 per event      |

<Tip>
  Not sure which plan to choose? Check out the [pricing page](https://www.coingecko.com/en/api/pricing) for a full breakdown.
</Tip>

## Which Method Should You Use?

<AccordionGroup>
  <Accordion title="I want to build a portfolio tracker">
    Use **REST API** to fetch prices and historical data on a schedule. Add **WebSocket** if you need live price updates on a dashboard.
  </Accordion>

  <Accordion title="I'm building a trading bot">
    Use **WebSocket** for real-time price feeds and trade data. Supplement with **REST API** for reference data like coin metadata or historical OHLC.
  </Accordion>

  <Accordion title="I need to keep my database in sync with CoinGecko">
    Use **Webhooks** to receive notifications when data changes — no constant polling. Use **REST API** to backfill or fetch full records on demand.
  </Accordion>

  <Accordion title="I'm just getting started">
    Start with **REST API** — available on all plans including the free Demo. Add WebSocket or Webhooks later as your needs grow.
  </Accordion>
</AccordionGroup>

***

<Card title="Share Feedback" icon="comment" href="https://docs.google.com/forms/d/e/1FAIpQLSf33wT9liXr7hfx3IPKnHs4zBR61zLv0rart6s27_6HND8Uwg/viewform">
  Tell us how you use CoinGecko's data delivery methods and what you'd like to see next.
</Card>
