Skip to main content
WSS
wss://stream.coingecko.com
/
v1
Messages
x_cg_pro_api_key
type:httpApiKey

Insert CoinGecko Pro API key to establish WebSocket connection

Subscribe to CGSimplePrice
type:object

Subscribe to the CGSimplePrice channel

Stream CGSimplePrice Data
type:object

Set coins to receive price updates

CGSimplePrice Update
type:object

Real-time price update

This Websocket channel allows you to subscribe to real-time updates of price changes for token.
  • Lookup by Coin ID
  • It will return price & market data of the top pool of the specified token
Update Frequency: as fast as ~10s, for large cap and actively traded coins.

Data Payload

FieldTypeDescriptionExample
cchannel_typestringIndicates the type of channel subscribed to.C1
icoin_idstringIdentifier of the coins. Check full list of IDs here.ethereum, usd-coin
pusd_pricestringCurrent token price in USD.3639.78228844745
ppusd_price_24h_change_percentagefloatPercentage change in token price over the last 24 hours.3.566
musd_market_capfloatMarket capitalization in USD.123
vusd_24h_volfloat24-hour trading volume in USD.31233333.33
tlast_updated_atintegerTimestamp of the last data update in UNIX time.1709542750
Tips: The Websocket payload will use the value null when specific data is unavailable. Ensure your application is capable of handling null values for fields that may not always have data.

1. Establish Connection to Websocket

wss://stream.coingecko.com/v1?x_cg_pro_api_key=YOUR_KEY

OR

wss://stream.coingecko.com/v1  
x-cg-pro-api-key: YOUR_KEY

2. Subscribe to a specific channel - CGSimplePrice

Input Example:
{"command":"subscribe","identifier":"{\"channel\":\"CGSimplePrice\"}"}
Output Example:
{"type":"confirm_subscription","identifier":"{\"channel\":\"CGSimplePrice\"}"}

3. Stream CGSimplePrice

Input Example:
{"command":"message","identifier":"{\"channel\":\"CGSimplePrice\"}","data":"{\"coin_id\":[\"ethereum\",\"bitcoin\"],\"action\":\"set_tokens\"}"}
Output Example:
{
    "code": 2000,
    "message": "Subscription is successful for ethereum"
}
Output Example:
{
    "c": "C1",
    "i": "ethereum",
    "m": 312938652962.8005,
    "p": 2591.080889351465,
    "pp": 1.3763793110454519,
    "t": 1747808150.269067,
    "v": 20460612214.801384
}
The output keys will be in random order.

Tips:

Un-subscribe to stop streaming CGSimplePrice data

Input Example: Unsubscribe for 1 specific token data:
{"command":"message","identifier":"{\"channel\":\"CGSimplePrice\"}","data":"{\"coin_id\":[\"ethereum\"],\"action\":\"unset_tokens\"}"}
Output Example:
{
    "code": 2000,
    "message": "Unsubscription is successful for ethereum"
}
Input Example: Unsubscribe from CGSimplePrice channel and all token data:
{"command":"unsubscribe","identifier":"{\"channel\":\"CGSimplePrice\"}"}
Output Example:
{
    "code": 2000,
    "message": "Unsubscription is successful for all tokens"
}
I