Skip to main content

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)
Why POST? Streaming multiple assets with POST provides better performance and load distribution across servers compared to opening separate GET connections.

Getting started

Connect in seconds - no authentication required. Stream multiple assets in a single connection.

Quick example

curl -X POST "https://streaming.dexpaprika.com/stream" \
    -H "Accept: text/event-stream" \
    -H "Content-Type: application/json" \
    -d '[
          {
            "chain": "solana",
            "address": "So11111111111111111111111111111111111111112",
            "method": "t_p"
          },
          {
            "chain": "ethereum",
            "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
            "method": "t_p"
          }
]'
This opens a streaming connection that delivers price updates for both Solana SOL and Ethereum USDC.

Request format

Method: POST Endpoint: /stream Required headers:
  • Accept: text/event-stream
  • Content-Type: application/json
Body: JSON array of asset subscription objects
[
  {
    "chain": "string",
    "address": "string",
    "method": "t_p"
  }
]

Request parameters

Each asset object in the array requires the following fields:
ParameterTypeRequiredDescription
chainstringYesBlockchain network ID from the Networks endpoint (e.g., ethereum, solana, bsc, arbitrum, zksync)
addressstringYesToken contract address or canonical address on the chain
methodstringYesStreaming method. Must be t_p (token price)

Example request body

[
  {
    "chain": "solana",
    "address": "So11111111111111111111111111111111111111112",
    "method": "t_p"
  },
  {
    "chain": "ethereum",
    "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
    "method": "t_p"
  },
  {
    "chain": "ethereum",
    "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    "method": "t_p"
  }
]

Limits and restrictions

LimitValueDescription
Assets per request2,000Maximum number of assets in a single POST request
Global stream limit10,000Total concurrent streams per server instance
Minimum assets1At least one asset is required
Asset validationRequiredAll assets must exist and be valid; otherwise the entire stream is cancelled
Important: All assets in your request must be valid. If any single asset is invalid, the entire stream is cancelled with a 400 error. Validate your assets before streaming.
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.
data: {"a":"<token_address>","c":"<chain>","p":"<price_usd>","t":<unix_timestamp>,"t_p":<price_timestamp>}
event: t_p

Response fields

FieldTypeDescription
astringToken address
cstringChain slug
pstringPrice in USD (numeric string for precision)
tintegerServer send timestamp (Unix seconds)
t_pintegerPrice 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 event
  • t_p (price timestamp): Unix timestamp when the price event occurred
Latency calculations:
  • now() - t = Network latency between server and client
  • now() - t_p = Total price data latency
  • For Ethereum, t increases every ~1 second, but t_p increases every ~12 seconds (block time)

Example response stream

{"a":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","c":"ethereum","p":"1.0003171482406676","t":1769778218,"t_p":1769778216}
{"a":"So11111111111111111111111111111111111111112","c":"solana","p":"116.37481886827172","t":1769778218,"t_p":1769778216}
{"a":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","c":"ethereum","p":"1.0003177179594651","t":1769778219,"t_p":1769778218}
{"a":"So11111111111111111111111111111111111111112","c":"solana","p":"116.37481886827172","t":1769778219,"t_p":1769778218}

Code examples

curl -X POST "https://streaming.dexpaprika.com/stream" \
    -H "Accept: text/event-stream" \
    -H "Content-Type: application/json" \
    -d '[
          {
            "chain": "solana",
            "address": "So11111111111111111111111111111111111111112",
            "method": "t_p"
          },
          {
            "chain": "ethereum",
            "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
            "method": "t_p"
          }
]'

Error handling

HTTP status codes

StatusReasonResolution
400 Bad RequestMissing/invalid parameters or validation failureCheck all required fields and ensure all assets exist
400 Unsupported chainChain not supportedUse /networks endpoint to find valid chains
400 Asset not foundOne or more token addresses invalidVerify all addresses belong to their specified chains
400 Global limit exceededToo many concurrent streamsRetry with exponential backoff or reduce number of assets

Common error messages

All validation errors return a JSON response with a message field:
{"message": "error description"}
Validation errors:
at least one asset is required
invalid query param
asset not found
unsupported chain
Cannot create new subscriptions, global stream limit exceeded
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:
event: error
data: {"message": "error description"}
Make sure to handle both HTTP errors (before stream starts) and SSE error events (during streaming).

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: The chain parameter must use the exact id value from the networks endpoint. For example:
  • bsc for Binance Smart Chain
  • zksync for zkSync
  • arbitrum for Arbitrum
Get the latest list:
curl https://api.dexpaprika.com/networks

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:
Best practice: Use multiple smaller requests rather than one massive request. For example, instead of streaming 5,000 assets in one request, consider splitting it into 10 requests of 500 assets each. This distributes load across servers and improves overall performance.

Next steps


Get support


FAQs

No. The streaming endpoint is public; no API keys or registration required.
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.
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.
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.
The server attempts to send all events approximately every 1 second. Actual frequency depends on server load, network conditions, and blockchain block times.
Implement standard SSE reconnection logic with exponential backoff on network failures. Monitor both HTTP errors and SSE error events.
Yes, this endpoint provides prices in USD. Numeric values are provided as strings to preserve precision.
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.
While technically possible, it’s not recommended. Duplicate subscriptions will send duplicate events and count against your limits.