Introduction
In this tutorial, you’ll learn how to retrieve all trading pairs and liquidity data for any ERC20 token using the Moralis API. This includes pair addresses, liquidity amounts, volume data, and exchange information. This is essential for building token analytics, DEX aggregators, or trading interfaces. We’ll use the following Moralis API endpoint:- Get Token Pairs - Fetch all trading pairs and liquidity data for a token
Prerequisites
- Node.js v18+ installed
- A Moralis API key (get one free)
Step 1: Set Up Your Project
Create a new directory for your project and initialize it:Step 2: Create the Script
Create a file calledindex.js and add the following code:
YOUR_API_KEY with your actual Moralis API key.
Step 3: Run the Script
Execute the script to fetch the token pairs:Example Response
Understanding the Response
| Field | Description |
|---|---|
pairAddress | The liquidity pair contract address |
pairLabel | Human-readable pair name (e.g., WETH/USDC) |
exchange | DEX name (uniswapv2, uniswapv3, sushiswap) |
token0 / token1 | Token metadata for both sides of the pair |
usdPrice | Current price in USD |
liquidityUsd | Total liquidity in USD |
volume24h | 24-hour trading volume in USD |
priceChange24h | 24-hour price change percentage |
Next Steps
- Get OHLC Data - Get price history
- Get Pair Stats - detailed market data
- Build a DEX Screener - Build a trading dashboard
- API Reference - Full API documentation

