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';
import { EvmChain } from '@moralisweb3/evm-utils';

try {
const chain = EvmChain.ETHEREUM;

const address = '0x1234567890123456789012345678901234567890';

await Moralis.start({
apiKey: 'YOUR_API_KEY',
// ...and any other configuration
});

const response = await Moralis.EvmApi.token.getTokenPrice({
address,
chain,
});

console.log(response?.result);
} catch (e) {
console.error(e);
}

Response Example
{
"nativePrice": {
"value": "8409770570506626",
"decimals": "",
"name": "Ether",
"symbol": "ETH"
},
"usdPrice": "19.722370676",
"exchangeAddress": "0x1f98431c8ad98523631ae4a59f267346ea31f984",
"exchangeName": "Uniswap v3"
}