Skip to main content
Version: 2.2

Get DEX token pair address

Don't have an API key yet?

Start using this API for your project today.

Get your free API key
GEThttps://deep-index.moralis.io/api/v2.2/:token0_address/:token1_address/pairAddress

Fetch the pair data of the provided token0+token1 combination. The token0 and token1 options are interchangable (ie. there is no different outcome in "token0=WETH and token1=USDT" or "token0=USDT and token1=WETH")

PATH PARAMS
token0_addressstringrequired
The token0 address
token1_addressstringrequired
The token1 address
QUERY PARAMS
chainstring
The chain to query
to_blockstring
The block number to get the reserves from
to_datestring

Get the reserves up to this date (any format that is accepted by momentjs)

  • Provide the param 'to_block' or 'to_date'
  • If 'to_date' and 'to_block' are provided, 'to_block' will be used.
exchangestringrequired
The factory name or address of the token exchange
Responses
API KEY
import Moralis from 'moralis';

try {
await Moralis.start({
apiKey: "YOUR_API_KEY"
});

const response = await Moralis.EvmApi.defi.getPairAddress({
"chain": "0x1",
"exchange": "uniswapv2",
"token0Address": "0x2b591e99afe9f32eaa6214f7b7629768c40eeb39",
"token1Address": "0xdac17f958d2ee523a2206206994597c13d831ec7"
});

console.log(response.raw);
} catch (e) {
console.error(e);
}
Response Example
{
"token0": "",
"token1": "",
"pairAddress": "0xbbb9bf440d0f686487925fef3b0a0f9aa67753f6"
}