> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://coingecko.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://coingecko.ferndocs.com/_mcp/server.

# 4. Get On-chain Data

Here are some of the important parameters to take note of while using Onchain DEX API Endpoints:

* Blockchain Networks
* DEXs
* Pool Contract Address
* Token Contract Address

## Blockchain Networks

> **Note**
>
> ### Notes
>
> * Please do not use CoinGecko Asset Platform ID as the Network ID in Onchain DEX API Endpoints (CoinGecko Asset Platform ID ≠ GT Network ID)
>
> * Example:
>
>   * Asset Platform on CoinGecko: `ethereum`
>   * Onchain Network ID: `eth`

**How to obtain Network ID?**

* Use [/onchain/networks](/api-reference/api-reference/onchain/networks/get) endpoint, example of response:

  **`JSON`**

  ```json JSON theme={null}
  {
    "data": [
      {
        "id": "eth",  👈 Network ID
        "type": "network",
        "attributes": {
          "name": "Ethereum",
          "coingecko_asset_platform_id": "ethereum" 👈 CoinGecko Asset Platform ID
        }
      },
     ......
    ]
  }
  ```

* Go to [GeckoTerminal](https://www.geckoterminal.com/)

  1. Select or search for a blockchain network.

  2. Copy the slug from the URL:

  ![](https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/5b9a903-image.png?fit=max\&auto=format\&n=a7cplMjqO5fc2v5e\&q=85\&s=3d58e3708238e2c869afeb50f36ba74a)

## DEXs

Some of the pools endpoints require you to provide a DEX ID along with a Network ID to query the pools on a particular DEX (Decentralized Exchange).

Using the [/onchain/networks/\{network}/dexes/\{dex}/pools](/api-reference/api-reference/onchain/networks/dexes/get-pools) endpoint as an example:

* `https://pro-api.coingecko.com/api/v3/onchain/networks/eth/dexes/uniswap_v3/pools?x_cg_pro_api_key=YOUR_API_KEY`

There are 2 parameter values required for this endpoint:

* `network`: `eth` (network ID)
* `dex`: `uniswap_v3` (DEX ID)

**How to obtain DEX ID?**

* Use [/onchain/networks/\{network}/dexes](/api-reference/api-reference/onchain/networks/dexes/get) endpoint, example of response:

  **`JSON`**

  ```json JSON theme={null}
  {
    "data": [
      {
        "id": "uniswap_v2", 👈 DEX ID
        "type": "dex",
        "attributes": {
          "name": "Uniswap V2"
        }
      },
    ......
    ]
  }
  ```

* Go to [GeckoTerminal](https://www.geckoterminal.com/)

  1. Select or search for a blockchain network.

  2. Choose the DEX from the DEXs List on the top (e.g. Uniswap V3).

  3. Copy the slug from the URL:

  ![](https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/f68325c-image.png?fit=max\&auto=format\&n=a7cplMjqO5fc2v5e\&q=85\&s=58ed481ea98687173a3cbf9493c73669)

## Methods to query Onchain Data

### a. Pool Contract Address

Most of the time, you will need a pool contract address along with a Network ID to query the onchain data, especially when using the Pools Endpoints.

Using the [/onchain/networks/\{network}/pools/\{address}](/api-reference/api-reference/onchain/networks/pools/get-address) endpoint as an example:

* `https://pro-api.coingecko.com/api/v3/onchain/networks/eth/pools/0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc?x_cg_pro_api_key=YOUR_API_KEY`

There are 2 parameter values required for this endpoint:

* `network`: `eth` (network ID)
* `address`: `0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc` (pool contract address)

**How to obtain the pool contract address? (e.g. `WETH/USDC`)**

* Look for the contract address section of the pool page on [GeckoTerminal](https://www.geckoterminal.com/eth/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640):

  ![](https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/741fbc7-image.png?fit=max\&auto=format\&n=a7cplMjqO5fc2v5e\&q=85\&s=a80b0dafe3d5db5a527e02ea18fcc2ad)

* Get the pool contract address from the project website, white-paper, documentation, or block explorer site:

  * [Block Explorer (Etherscan)](https://etherscan.io/address/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640)
  * [DEX (Uniswap)](https://info.uniswap.org/#/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640)

### b. Token Contract Address

Apart from the pool contract address, you also have the option to query onchain data by using the token contract address, using the [/onchain/networks/\{network}/tokens/\{token\_address}/pools](/api-reference/api-reference/onchain/networks/tokens/pools/get) endpoint as an example:

* `https://pro-api.coingecko.com/api/v3/onchain/networks/eth/tokens/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48/pools?x_cg_pro_api_key=YOUR_API_KEY`

There are 2 parameter values required for this endpoint:

* `network`: `eth` (network ID)
* `address`: `0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48` (token contract address)

**How to obtain token contract address (e.g. UNI):**

* Look for the contract address section of the token page on GeckoTerminal:

  ![](https://mintcdn.com/coingecko/a7cplMjqO5fc2v5e/images/docs/56f6c15-image.png?fit=max\&auto=format\&n=a7cplMjqO5fc2v5e\&q=85\&s=f889558b4ea90de11cb582a6b7de0abc)

* Get the token contract address from the project website, white-paper, documentation, or block explorer site. For example:

  * [Uniswap Documentation](https://docs.uniswap.org/protocol/concepts/governance/overview#uni-address)
  * [DEX (Uniswap)](https://info.uniswap.org/#/tokens/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984)
  * [Block Explorer (Etherscan)](https://etherscan.io/token/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984)