π‘ Live Example: Multi-Asset Streaming
See POST /stream in action! Our live dashboard uses this exact endpoint to stream 6 tokens simultaneously across Ethereum, Solana, and BSC. Watch real-time updates, connection metrics, and see the code in practice. View Live Demo β
Overview
The POST method is the recommended way to stream multiple token prices simultaneously via Server-Sent Events (SSE). Send a single request to track up to 2,000 assets across different blockchain networks with no API key required. Base URL:https://streaming.dexpaprika.com
Endpoint: POST /stream
Protocol: HTTP/1.1 with text/event-stream (SSE)
Getting started
Connect in seconds - no authentication required. Stream multiple assets in a single connection.
Quick example
Request format
Method:POST
Endpoint: /stream
Required headers:
Accept: text/event-streamContent-Type: application/json
Request parameters
Each asset object in the array requires the following fields:| Parameter | Type | Required | Description |
|---|---|---|---|
chain | string | Yes | Blockchain network ID from the Networks endpoint (e.g., ethereum, solana, bsc, arbitrum, zksync) |
address | string | Yes | Token contract address or canonical address on the chain |
method | string | Yes | Streaming method. Must be t_p (token price) |
Example request body
Limits and restrictions
| Limit | Value | Description |
|---|---|---|
| Assets per request | 2,000 | Maximum number of assets in a single POST request |
| Global stream limit | 10,000 | Total concurrent streams per server instance |
| Minimum assets | 1 | At least one asset is required |
| Asset validation | Required | All assets must exist and be valid; otherwise the entire stream is cancelled |
If you exceed the global stream limit, you will receive:
Cannot create new subscriptions, global stream limit exceeded. Retry with exponential backoff or reduce the number of assets.Response format
Status:200 OK on success
Content-Type: text/event-stream
Format: Newline-delimited SSE events
Event structure
The server attempts to send all subscribed asset updates approximately every 1 second in batches.Response fields
| Field | Type | Description |
|---|---|---|
a | string | Token address |
c | string | Chain slug |
p | string | Price in USD (numeric string for precision) |
t | integer | Server send timestamp (Unix seconds) |
t_p | integer | Price event timestamp (Unix seconds) |
Understanding timestamps
Two timestamps are provided to help you measure latency:t(send timestamp): Unix timestamp when the server sent the eventt_p(price timestamp): Unix timestamp when the price event occurred
now() - t= Network latency between server and clientnow() - t_p= Total price data latency- For Ethereum,
tincreases every ~1 second, butt_pincreases every ~12 seconds (block time)
Example response stream
Code examples
Error handling
HTTP status codes
| Status | Reason | Resolution |
|---|---|---|
400 Bad Request | Missing/invalid parameters or validation failure | Check all required fields and ensure all assets exist |
400 Unsupported chain | Chain not supported | Use /networks endpoint to find valid chains |
400 Asset not found | One or more token addresses invalid | Verify all addresses belong to their specified chains |
400 Global limit exceeded | Too many concurrent streams | Retry with exponential backoff or reduce number of assets |
Common error messages
All validation errors return a JSON response with amessage field:
All assets in the request must be valid. If any single asset is invalid, the entire stream is cancelled with a
400 error and detailed message.SSE error events
Errors can also occur during an active stream and are sent as SSE error events:Best practices
Many Small Requests Over One Large
Instead of one request with thousands of assets, create multiple smaller requests. This distributes load for better performance.
Validate Assets First
All assets must exist and be valid. Use the
/networks endpoint to verify supported chains before streaming.Handle Precision Correctly
Parse the
p field as a numeric string to preserve full price precision in your application.Implement Reconnection Logic
Use standard SSE reconnection patterns with exponential backoff to handle network interruptions gracefully.
Monitor Latency
Use the
t and t_p timestamps to monitor both network latency and price data freshness.Handle Both Error Types
Implement error handling for both HTTP errors (before stream starts) and SSE error events (during streaming).
Integration tips
Supported networks
Use the Networks endpoint to get the complete list of supported blockchain networks and their chain IDs. Important: Thechain parameter must use the exact id value from the networks endpoint. For example:
bscfor Binance Smart Chainzksyncfor zkSyncarbitrumfor Arbitrum
Performance considerations
- Batch size: While the limits are quite high, consider your actual needs
- Distribution: Multiple smaller requests distribute load better than one large request
- Server selection: Different requests may be handled by different server instances for better performance
- Update frequency: Events are sent approximately every 1 second, but actual frequency depends on server load and blockchain block times
Optimal request sizing
Based on the engineering teamβs recommendations:Next steps
π Live Dashboard Reference
See a production-ready implementation of POST /stream with React. Perfect reference for building your own dashboard.
Stream Single Asset (GET)
Learn about the GET method for streaming a single asset.
React Integration Guide
Build React hooks and components for streaming prices.
Networks Endpoint
Find supported blockchain networks for streaming.
Get support
Join Discord
Connect with our community and get real-time support.
Give Feedback
Share your experience and help us improve.
FAQs
Do I need an API key?
Do I need an API key?
No. The streaming endpoint is public; no API keys or registration required.
When should I use POST instead of GET?
When should I use POST instead of GET?
Use POST when you need to stream 2 or more assets simultaneously. For a single asset, you can use either method, but GET is simpler. POST provides better performance and load distribution for multiple assets.
How many assets can I stream at once?
How many assets can I stream at once?
You can stream up to 2,000 assets in a single POST request. However, multiple smaller requests (distributed across servers) often perform better than one large request.
What happens if one asset in my POST request is invalid?
What happens if one asset in my POST request is invalid?
The entire stream is cancelled and you receive a 400 error with a detailed message. All assets must exist and be valid before the stream starts.
What is the price update frequency?
What is the price update frequency?
The server attempts to send all events approximately every 1 second. Actual frequency depends on server load, network conditions, and blockchain block times.
How do I handle connection drops?
How do I handle connection drops?
Implement standard SSE reconnection logic with exponential backoff on network failures. Monitor both HTTP errors and SSE error events.
Are prices in USD only?
Are prices in USD only?
Yes, this endpoint provides prices in USD. Numeric values are provided as strings to preserve precision.
What's the difference between 't' and 't_p' timestamps?
What's the difference between 't' and 't_p' timestamps?
t is when the server sent the event, t_p is when the price event actually occurred on-chain. Use now() - t for network latency and now() - t_p for total price data latency.Can I subscribe to the same asset multiple times in one request?
Can I subscribe to the same asset multiple times in one request?
While technically possible, itβs not recommended. Duplicate subscriptions will send duplicate events and count against your limits.
What's the recommended batch size for requests?
What's the recommended batch size for requests?
Instead of maxing out at 2,000 assets per request, use multiple smaller requests (e.g., 100-500 assets each). This distributes load across servers and provides better overall performance.