Query DEX Trading Pairs with DEXScreener Pairs API
The DEXScreener Pairs API lets you search for decentralized exchange (DEX) trading pairs in real-time. Get price, volume, liquidity, and other critical market data without building your own blockchain indexer.
What You Get
This API searches across multiple DEX networks and returns matching trading pairs. Use it to:
- Find token pairs by symbol or contract address
- Track price movements and trading volume
- Monitor liquidity metrics
- Build portfolio trackers or trading dashboards
Quick Start with Fetch
Here's a working example to search for trading pairs:
const options = {
method: 'GET',
headers: {
'x-rapidapi-key': 'YOUR_RAPIDAPI_KEY',
'x-rapidapi-host': 'dexscreener-pairs-api-production.up.railway.app'
}
};
fetch('https://dexscreener-pairs-api-production.up.railway.app/api/search?query=USDC', options)
.then(res => res.json())
.then(data => {
console.log(data.pairs);
// Output: Array of matching trading pairs
data.pairs.forEach(pair => {
console.log(`${pair.baseToken.symbol}/${pair.quoteToken.symbol}: $${pair.priceUsd}`);
});
})
.catch(err => console.error(err));
Understanding the Response
The API returns an array of matching pairs. Each pair includes:
{
"pairAddress": "0x...",
"baseToken": {
"symbol": "USDC",
"name": "USD Coin",
"address": "0x..."
},
"quoteToken": {
"symbol": "WETH",
"name": "Wrapped Ether",
"address": "0x..."
},
"priceUsd": "1.00",
"volume": {
"h24": 1500000
},
"liquidity": {
"usd": 5000000
},
"dexId": "uniswap"
}
Search Parameters
- query (required): Token symbol, name, or contract address to search for
Real-World Use Case
Build a price tracker:
async function trackToken(symbol) {
const res = await fetch(
`https://dexscreener-pairs-api-production.up.railway.app/api/search?query=${symbol}`,
{ headers: { 'x-rapidapi-key': 'YOUR_KEY', 'x-rapidapi-host': 'dexscreener-pairs-api-production.up.railway.app' } }
);
const data = await res.json();
if (data.pairs.length > 0) {
const topPair = data.pairs[0];
console.log(`${topPair.baseToken.symbol}: $${topPair.priceUsd} (24h vol: $${topPair.volume.h24})`);
}
}
trackToken('MATIC');
Get Started Now
Ready to integrate live DEX data? Head to the DEXScreener Pairs API on RapidAPI, grab your API key, and start querying. Most plans include generous free tier quotas—no credit card required to test.
Top comments (0)