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

# CoinGecko

> Connect to CoinGecko streams through Uniblock WebSockets.

CoinGecko WebSockets are available through Uniblock with separate validation and
WSS endpoints.

## Endpoints

* WebSocket (WSS): `wss://websocket.uniblock.dev/coingecko`
* HTTP (Validation): `https://websocket.uniblock.dev/coingecko/validate`

## Authentication

* Include the `X-API-KEY` header in both validation and connection requests.

## Workflow

1. Validate the request with the HTTP endpoint.
2. Connect to the WSS endpoint.
3. Send your CoinGecko message payload after the connection is established.

## Connection heartbeat

CoinGecko requires a heartbeat to keep the stream open and detect idle
connections:

* Server ping: CoinGecko sends a ping frame every 10 seconds.
* Client pong: Your client must respond with a pong frame within 20 seconds.
* Termination: If no pong is received within that 20-second window, the
  connection is closed automatically.
* Library behavior: Most WebSocket libraries handle ping/pong control frames
  automatically, but you should verify your client is not blocking or
  suppressing them.

<Note>
  CoinGecko uses different message types than standard JSON-RPC-style WebSocket
  flows. Refer to the official
  [CoinGecko WebSocket documentation](https://docs.coingecko.com/websocket) for the
  expected message formats.
</Note>

## Example validation request

```bash theme={null}
curl --request GET \
  --url 'https://websocket.uniblock.dev/coingecko/validate' \
  --header 'X-API-KEY: YOUR_UNIBLOCK_API_KEY'
```

## Pricing

CoinGecko WebSocket usage is billed with a one-time connection charge plus a
per-response formula:

* Connection Setup: `1 CU * 3181.819` (3,181.82 CUs)
* Data Transfer: `0.1 CU * 3181.819` per response returned (318.18 CUs)

## Resources

* [CoinGecko WebSocket Documentation](https://docs.coingecko.com/websocket)
