WEBSOCKET API
Stop polling. The CoinMarketCap WebSocket API pushes live crypto prices and on-chain DEX events to your product over a single persistent connection. Sub-5-second market quotes, event-driven swaps and liquidity, all through one WSS endpoint.

Subscribe to live market data and on-chain DEX events through the same WebSocket. Branch on the channel name and route each push where it belongs.
Both Market Data and On-Chain Data channels share the same WSS endpoint. All connections require a valid CoinMarketCap API key.
// Node.js server-side authentication (recommended). Install: npm install ws
import WebSocket from 'ws';
const ws = new WebSocket(
'wss://pro-stream.coinmarketcap.com/v1',
{ headers: { 'X-CMC_PRO_API_KEY': 'your-api-key' } }
);Channel Category
Subscribe to market@crypto_latest_price. The crypto_ids parameter is required; omitting it returns error 2401. WebSocket access requires a Startup plan or above (Startup, Growth, Professional, and Enterprise). The feature is in Beta and excluded from SLA.
{
"id": 1,
"method": "subscribe",
"channel": "market@crypto_latest_price",
"params": {
"crypto_ids": [1, 1027, 1839]
}
}Channel Category
DEX WebSocket streams real-time on-chain events: aggregated prices, swaps, liquidity, kline, rolling token and pool metrics, unique traders, and holder analytics.
token_agg_event, transaction, liquidity_event, kline, token_metric, pool_metric, and unique_trader stream on every chain CoinMarketCap indexes.holders_metrics, holder_wallet_update Limited to the following EVM chains, Solana, and Tron20:Shared across every channel — message format, subscription commands, quick start, errors, and best practices.
Every server message dispatches on a type field, so routing logic stays simple. Data pushes always include channel and params, and never rely on the client id for routing. The optional request id is echoed only on ack and error.
ackResponse to subscribe / unsubscribe / unsubscribe_alldataChannel pusherrorError (optional id echo)pongResponse to ping{
"type": "data",
"channel": "market@crypto_latest_price",
"params": { "crypto_ids": 1 },
"data": { "cid": 1, "p": 81187.93, "vu": 29932025976.79,
"mc": 1626089237758.0, "p24h": 2.41 },
"ts": 1778663880111
}Use the ping_interval_ms from the welcome message (typically 10 seconds). Idle connections may be closed after prolonged inactivity if neither pings nor data are flowing.
{ "id": 1, "method": "ping" }{ "type": "pong", "id": 1, "code": 0, "ts": 1778659200000 }Manage subscriptions with methods.
subscribeSpecific subscription of channel and/or paramsunsubscribeSpecific unsubscription of channel and/or paramsunsubscribe_allUnsubscribe everything{
"id": 2,
"method": "unsubscribe",
"channel": "onchain@kline",
"params": {
"platform_id": 14,
"address": ["0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d"]
}
}Open a connection, subscribe to a channel, and branch on msg.type. The same pattern works in any language with a WebSocket client.
// Node.js. Install: npm install ws
import WebSocket from 'ws';
const ws = new WebSocket('wss://pro-stream.coinmarketcap.com/v1', {
headers: { 'X-CMC_PRO_API_KEY': 'your-api-key' }
});
ws.onopen = () => {
ws.send(JSON.stringify({
id: 1, method: 'subscribe',
channel: 'market@crypto_latest_price',
params: { crypto_ids: [1, 1027] }
}));
};
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
if (msg.type === 'data') {
const { cid, p, p24h } = msg.data;
console.log(`#${cid}: $${p} (${p24h}% 24h)`);
}
};# Requires websockets >= 14.0
import asyncio, json, websockets
async def subscribe():
uri = 'wss://pro-stream.coinmarketcap.com/v1'
headers = {'X-CMC_PRO_API_KEY': 'your-api-key'}
async with websockets.connect(uri, additional_headers=headers) as ws:
await ws.send(json.dumps({
'id': 1, 'method': 'subscribe',
'channel': 'market@crypto_latest_price',
'params': {'crypto_ids': [1, 1027]},
}))
async for raw in ws:
m = json.loads(raw)
if m.get('type') != 'data': continue
d = m['data']
print(f"#{d['cid']}: ${d['p']:.2f}")
asyncio.run(subscribe())market@crypto_latest_price channel is designed for pushed latest-price updates, so products do not need to repeatedly poll REST endpoints for the same live market view. Freshness depends on the channel behavior documented by CoinMarketCap — check the WebSocket channel reference for the current push timing before using it in latency-sensitive workflows.wss://pro-stream.coinmarketcap.com/v1. Both CEX latest-price streams and DEX/on-chain channels use that endpoint. All connections require a valid CoinMarketCap API key.X-CMC_PRO_API_KEY header during the WebSocket handshake. This is the same key used for the Pro REST API. Server-side header authentication is the cleaner production approach because it keeps the key out of browser-visible URLs.ping/pong keep-alive handling, structured error handling and duplicate-event handling. Route messages by type, channel and params, not only by the client request ID. Numeric fields can be null when unavailable, and on-chain payloads can use channel-specific params such as pool_address and wallet_address.READY TO STREAM?
One persistent connection. Sub-5-second prices. Event-driven on-chain feeds.