# CoinGecko Onchain Token Price — Optimism Network

> CoinGecko Onchain Token Price — Optimism Network is a paid API for AI agents from pro-api.coingecko.com, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-13).

Returns DEX-sourced token price and market data for a given contract address on the Optimism network

## Facts

- Endpoint: GET https://pro-api.coingecko.com/api/v3/x402/onchain/simple/networks/optimism/token_price/:address
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/coingecko-onchain-token-price-optimism-network-5f77db73
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_4X2Bn0z4bOg0zUzTRgr6F

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability coingecko-onchain-token-price-optimism-network-5f77db73
```

Example prompt: What's the current onchain price, 24-hour volume, and market cap for the Optimism token at contract address 0x4200000000000000000000000000000000000042? Pull it from CoinGecko's DEX data.

## When to prefer this

Choose this endpoint when you need real-time, onchain DEX-sourced price data specifically for a token on the Optimism network identified by its contract address. It is preferred over CoinGecko's standard token price endpoints when the token may not have a CoinGecko coin ID (only a contract address), or when you specifically need DEX-derived pricing rather than aggregated CEX data. Use it over generic market data APIs when Optimism-specific onchain context (reserve, DEX volume) is required.

## Known failure modes

- Contract address not found on Optimism — returns empty data or 404
- Invalid contract address format — returns 400 Bad Request
- Token has no recent DEX activity — returns stale or null price
- API key missing or invalid — returns 401 Unauthorized
- Rate limit exceeded — returns 429 Too Many Requests
- Network identifier mismatch (address exists on different chain) — returns no data

## How this service works

Query onchain DEX token price & market data based on the provided token contract addresses on a network.

## Output

Returns a JSON object containing the token's current USD price sourced from onchain DEX activity, along with optional fields such as 24-hour trading volume, market capitalization, 24-hour price change percentage, total reserve in USD, and whether inactive sources were included — all keyed by the queried contract address.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input",
  "output"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "properties": {
      "include_24hr_vol": {
       "type": "boolean"
      },
      "mcap_fdv_fallback": {
       "type": "boolean"
      },
      "include_market_cap": {
       "type": "boolean"
      },
      "include_inactive_source": {
       "type": "boolean"
      },
      "include_24hr_price_change": {
       "type": "boolean"
      },
      "include_total_reserve_in_usd": {
       "type": "boolean"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type",
    "example"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/coingecko-onchain-token-price-optimism-network-5f77db73/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from pro-api.coingecko.com](https://www.zero.xyz/host/pro-api.coingecko.com/llms.txt)
