Skip to main content

Get ERC20 token price

GEThttps://deep-index.moralis.io/api/v2/erc20/:address/price

Get the token price denominated in the blockchain's native token and USD.

PATH PARAMS
addressstringrequired
The address of the token contract
QUERY PARAMS
chainstring
The chain to query
exchangestring
The factory name or address of the token exchange
to_blocknumber
The block number from which the token price should be checked
Responses
API KEY
import Moralis from 'moralis';

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

const response = await Moralis.EvmApi.token.getTokenPrice({
"chain": "0x1",
"exchange": "uniswap-v2",
"address": "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0"
});

console.log(response.raw);
} catch (e) {
console.error(e);
}
Response Example
{
"nativePrice": {
"value": "8409770570506626",
"decimals": "",
"name": "Ether",
"symbol": "ETH"
},
"usdPrice": "19.722370676",
"exchangeAddress": "0x1f98431c8ad98523631ae4a59f267346ea31f984",
"exchangeName": "Uniswap v3"
}