Introduction
In this tutorial, you’ll learn how to find DEX liquidity pair addresses for any two tokens using the Moralis API. This is essential for getting trading data, liquidity information, and price data for token pairs on decentralized exchanges like Uniswap, PancakeSwap, and SushiSwap. We’ll use the following Moralis API endpoint: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 find the pair address:Example Response
Understanding the Response
| Field | Description |
|---|---|
token0 | First token in the pair with metadata |
token1 | Second token in the pair with metadata |
pairAddress | The liquidity pair contract address |
exchange | Name of the DEX (uniswapv2, uniswapv3, sushiswap, etc.) |
exchangeAddress | The DEX factory contract address |
exchangeLogo | URL to the exchange logo |
Next Steps
- Get Token Pairs and Liquidity - Get liquidity data for pairs
- Get OHLC Data - Fetch price history
- Build a DEX Screener - Create a trading dashboard
- API Reference - Full API documentation

