CoinPaprika Streaming API
The CoinPaprika Streaming API provides high-frequency cryptocurrency ticker data via WebSocket connections, allowing you to get live price updates, market cap changes, and volume data for your favorite cryptocurrencies.Getting Started
1. Endpoint
Connect to our WebSocket endpoint to start receiving live cryptocurrency data:2. Authentication
All requests require authentication using your API key. You must include it in theAuthorization header of your WebSocket connection request.
To get your API key, visit the CoinPaprika API page.
3. Finding IDs
- Currency IDs (
ids): To subscribe to a currency, you need its unique ID (e.g.,"btc-bitcoin"). You can find these IDs by using the Coins endpoint from our REST API. - Quote Currencies (
quotes): You can receive prices quoted in various currencies. The currently supported quote currencies are:USD,BTC,ETH,BNB,MATIC,SOL.
Subscribing to Tickers
Once connected, you can subscribe to or unsubscribe from ticker updates by sending JSON messages.Subscribe
To receive updates for one or more cryptocurrencies, send asubscribe message:
Unsubscribe
To stop receiving updates, send anunsubscribe message:
Connection Management (Heartbeat)
The API uses the standard WebSocket ping/pong mechanism to keep connections alive. Your client does not need to send any application-level ping messages. The server sends aping frame every 120 seconds. Most modern WebSocket client libraries will automatically respond with the required pong frame. If the server does not receive a pong response, it will assume the connection is stale and close it.
The client examples below demonstrate a robust pattern for handling this by setting a timeout that will terminate and reconnect if a server ping is not received within a certain window.
Code Examples
Node.js
Prerequisites: Make sure to add"type": "module" to your package.json file to enable ES6 imports.
Python
Prerequisites: Install the required dependency:Message Format
When subscribed, you’ll receive live updates in this format:id: CoinPaprika currency IDsym: Currency symbolts: Unix timestampquotes: Price data in requested quote currenciesm: Market capp: Current pricev24h: 24-hour volume
Rate Limits
- Quotes per subscription: Up to 5 quote currencies at once.
Best Practices
- Implement heartbeat monitoring to ensure a stable connection.
- Handle reconnections gracefully, for example with an exponential backoff strategy.
- Subscribe only to needed currencies to optimize bandwidth.
- Store your API token securely and never expose it in client-side code.
- Implement proper error handling for network issues and connection closures.
- Add proper JSON parsing with try-catch blocks to handle malformed messages.
Support
For technical support or questions about the Streaming API:- Contact: Fill out the form
- Discord: Join our community
FAQs
What is a crypto price WebSocket API?
What is a crypto price WebSocket API?
A WebSocket API streams real-time cryptocurrency market data over a persistent connection. Use it when you need low-latency price, volume, or market cap updates.
Do I need an API key for the streaming API?
Do I need an API key for the streaming API?
Yes. Pass your key in the
Authorization header when establishing the WebSocket connection.How often are tick updates sent?
How often are tick updates sent?
Ticks are pushed as markets change. There is no fixed interval; frequency depends on market activity.
Can I subscribe to multiple coins and quotes?
Can I subscribe to multiple coins and quotes?
Yes. Provide arrays for
ids (e.g., btc-bitcoin) and quotes (e.g., USD, BTC) in the subscribe payload. To discover IDs quickly, use the Coverage Checker.What’s the message format for prices and market cap?
What’s the message format for prices and market cap?
Each update includes
quotes.{QUOTE}.p (price), quotes.{QUOTE}.v24h (24h volume), and quotes.{QUOTE}.m (market cap), plus a UNIX ts timestamp.