Skip to main content

Tutorial overview

Efficiently fetch real-time prices for up to 10 tokens in a single API request using the DexPaprika multi-asset endpoint. This guide shows you why batching matters and how to implement it effectively.
The multi-asset endpoint is optimized for efficiency. Learn why batching is critical for sustainable API usage and how to structure your requests.

Why batch requests? The math behind it

Single request vs. batching

Let’s say you need to monitor prices for 50 tokens on Ethereum. Scenario 1: Individual Requests (❌ Inefficient)
Scenario 2: Using Multi-Asset Endpoint (✅ Efficient)
Result: You reduce API calls by 90%

Real-world impact

The Key Insight: Using the multi-asset endpoint instead of individual token calls reduces your request count by up to 90%. This means you can monitor more tokens, update more frequently, and stay well within rate limits.

Understanding rate limits

The DexPaprika API is public with no formal limits currently enforced. Best practices like batching ensure sustainable usage as the service matures.
By batching requests:
  • Reduce server load — Fewer HTTP connections
  • Improve latency — Single network round-trip for multiple tokens
  • Future-proof your app — When rate limits are introduced, you’re already optimized
  • Scale effortlessly — Monitor hundreds of tokens without performance degradation

Step 1: Understanding the endpoint

The multi-asset pricing endpoint accepts:
  • Network (path parameter): e.g., ethereum, solana, base
  • Tokens (query parameter): Comma-separated list of up to 10 token addresses
  • Constraint: Maximum 10 tokens per request, 2000 character limit

Step 2: Simple batch request

Fetch prices for 3 tokens on Ethereum in a single request:
Response:
Response
Duplicate input addresses may produce duplicate entries in the response. Dedupe client-side if required.

Step 3: Batching larger token lists in Node.js

If you need to monitor more than 10 tokens, split them into chunks:

Axios variant (node.js)

Key Observation: 12 tokens require only 2 API calls instead of 12! This is an 83% reduction in network requests.

Step 4: Python implementation with real-time monitoring

Build a simple price monitor that updates every 30 seconds:

Step 5: Error handling & edge cases

Handling Invalid or Unpriced Tokens

Some tokens may not have prices. The endpoint returns only valid tokens:
Response (only the priced token is returned):

Edge-case requests

Best Practice: Always validate the response. Check that the number of returned tokens matches your expectations. Handle missing tokens gracefully in your application.

Step 6: Comparison: Single vs. batch requests

Request 100 tokens for a dashboard

❌ Without Batching:
✅ With Batching:
Impact:
  • 90% fewer requests
  • 10x faster execution (single network round-trip per batch vs. 100 individual calls) ✅
  • Lower latency for your users ✅
  • Future-proof against rate limits ✅

Performance metrics

Benchmark: Fetching prices for 50 tokens on Ethereum
Result: Batching achieves 10x faster responses while reducing server load and bandwidth by 90%.

Next steps

API Reference

Explore the complete multi-asset endpoint documentation.

Fetch Single Token Prices

Learn how to fetch detailed data for individual tokens.

Best practices summary

  1. Always batch — Use the multi-asset endpoint instead of individual calls
  2. Chunk large lists — Split more than 10 tokens into multiple batches (max 10 per call)
  3. Validate responses — Not all requested tokens may have prices; handle missing data
  4. Cache results — Store prices and update on a schedule instead of on every request
  5. Handle errors gracefully — Network timeouts and invalid tokens are normal; retry with backoff
  6. Monitor performance — Track API call counts to measure your optimization improvements

Get support

Join Discord

Connect with our community and get real-time support.

Give Feedback

Share your experience and help us improve.

FAQs

10 tokens per request. Requests with more than 10 tokens will return HTTP 400.
Duplicate inputs may yield duplicate entries in the response. Dedupe client-side if needed.
Tokens without prices are silently omitted from the response. Only priced tokens are returned.
No. The response order is not guaranteed to match your input order. Use the id field to identify each token.
No. Each batch must be for a single network. Use separate calls for different networks.
It depends on your use case. For dashboards, every 30-60 seconds is common. For trading bots, every 1-5 seconds. Batching enables frequent updates without excessive API calls.
Yes. The single token endpoint (GET /networks/{network}/tokens/{token_address}) provides detailed metadata like liquidity, volume, and holdings. Use it for deep analysis; use multi-asset for just prices.
No. At least one valid token is required. The endpoint returns HTTP 400 if the tokens list is empty.