Skip to main content

Don't have an API key yet?

Sign-up to Moralis to get your free API key and start building today.

Get Your Free API Key

Get DEX token pair address

GEThttps://deep-index.moralis.io/api/v2.2/:token0_address/:token1_address/pairAddress

Get the pair address for a token0/token1 combination on a DEX, interchangeable order.

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 (format in seconds or datestring 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
200Returns the pair address of the two tokens.
400Bad Request
404Not Found
429Too Many Requests
500Internal Server Error
API KEY
curl --request GET \
--url 'https://deep-index.moralis.io/api/v2.2/0x2b591e99afe9f32eaa6214f7b7629768c40eeb39/0xdac17f958d2ee523a2206206994597c13d831ec7/pairAddress?chain=eth&exchange=uniswapv2' \
--header 'accept: application/json' \
--header 'X-API-Key: YOUR_API_KEY'
Response Example
{
"token0": {
"address": "0x2b591e99afe9f32eaa6214f7b7629768c40eeb39",
"name": "HEX",
"symbol": "HEX",
"decimals": 9,
"logo": "https://cdn.moralis.io/eth/0x2b591e99afe9f32eaa6214f7b7629768c40eeb39.png",
"logo_hash": "b3bd1b5512965d7b6aeee903dcc6d28b116d58c788eb41e9c1690baed878beaa",
"thumbnail": "https://cdn.moralis.io/eth/0x2b591e99afe9f32eaa6214f7b7629768c40eeb39_thumb.png",
"block_number": 14836562,
"validated": "",
"created_at": "2022-01-20T09:39:55.818Z"
},
"token1": {
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"name": "Tether USD",
"symbol": "USDT",
"decimals": 6,
"logo": "https://cdn.moralis.io/eth/0xdac17f958d2ee523a2206206994597c13d831ec7.png",
"logo_hash": "ee7aa2cdf100649a3521a082116258e862e6971261a39b5cd4e4354fcccbc54d",
"thumbnail": "https://cdn.moralis.io/eth/0xdac17f958d2ee523a2206206994597c13d831ec7_thumb.png",
"block_number": "4638568",
"validated": 1,
"created_at": "2022-01-20T09:39:55.818Z"
},
"pairAddress": "0xbbb9bf440d0f686487925fef3b0a0f9aa67753f6"
}