WebSockets

Connect to our WebSockets to receive real-time cryptocurrency data streams for rates, exchange rates, and tickers. WebSockets provide instant, continuous updates without the need for polling, making them ideal for trading platforms, portfolio trackers, and financial applications that require live market data.

API Usage

Please note that each WebSocket connection consumes one API request from your plan. After the initial connection is established, the data stream itself does not consume any additional API requests, unless a subscription message is sent, in which case one additional API request will be consumed.

Real-Time DEX Data

For exchange rates and tickers data from decentralized exchanges (DEX), you'll need the Real-time DEX data add-on. This add-on is only available on professional plan and provides access to live trading data from major DEX platforms, enabling you to track decentralized market activity alongside centralized exchange data.

WebSocket Paths

  • Rates
    /rates - Get real-time cryptocurrency rates.
  • Exchange Rates
    /exchange-rates - Get real-time cryptocurrency rates from specific exchanges.
  • Tickers
    /tickers - Get real-time trading data including price, volume, and market statistics.

The base URL format is: wss://api.coinranking.com/v2/real-time/<path>

Errors

A missing or unknown API key, a plan without real-time access, or an exhausted rate limit is refused during the HTTP upgrade, before any WebSocket exists: the response is a normal 401, 403, or 429 with the same JSON body as on the Server-Sent Events endpoint. Once the connection is open, an invalid URL parameter or subscription message is refused with an error frame that carries a machine-readable code next to the human-readable messages, for example {"type":"error","code":"INVALID_THROTTLE","errors":["Throttle \"5s\" is not supported"]}. The codes are the same on both transports, so match on code rather than on the message text.

Server-Sent Events

Prefer plain HTTP? The same three topics are also available as Server-Sent Events, with the same subscriptions, plan requirements, and messages. This lets you stream from curl, the browser's built-in EventSource, or any HTTP client that can read a streaming response, without a WebSocket library.