Skip to main content

Don't have an RPC Node yet?

Start using RPC Nodes in your project today.

Get your free RPC Node

eth_getTokenPrice

Get ERC-20 Token Price by Token Address

POSThttps://site1.moralis-nodes.com/:chain/:apiKey

Retrieves the current price of an ERC20 token based on its contract address. Optional parameters include specifying an exchange address, retrieving data at a specific block number, and including percentage change in price over the last 24 hours.

Note

Please refer to RPC schema page for more details on the RPC params and RPC response definitions of the RPC method.

PATH PARAMS
chainstringrequired
The blockchain to interact with.
apiKeystringrequired
Your API key for authentication.
BODY PARAM
Request Bodyobjectrequired
The request payload for retrieving the price of an ERC20 token by its contract address.
Responses
200Returns the price data for the specified ERC20 token.
400Bad Request
404Not Found
429Too Many Requests
500Internal Server Error
curl --request POST \
--url 'https://site1.moralis-nodes.com/eth/YOUR_API_KEY' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getTokenPrice"
}
'
Response Example
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tokenName": "Kylin Network",
"tokenSymbol": "KYL",
"tokenLogo": "https://cdn.moralis.io/eth/0x67b6d479c7bb412c54e03dca8e1bc6740ce6b99c.png",
"tokenDecimals": "18",
"nativePrice": {
"value": "8409770570506626",
"decimals": 18,
"name": "Ether",
"symbol": "ETH",
"address": "string"
},
"usdPrice": 19.722370676,
"usdPriceFormatted": "19.722370676",
"24hrPercentChange": "-0.8842730258590583",
"exchangeAddress": "0x1f98431c8ad98523631ae4a59f267346ea31f984",
"exchangeName": "Uniswap v3",
"tokenAddress": "0x67b6d479c7bb412c54e03dca8e1bc6740ce6b99c",
"toBlock": "16314545",
"possibleSpam": "",
"verifiedContract": true,
"pairAddress": "0x1f98431c8ad98523631ae4a59f267346ea31f984",
"pairTotalLiquidityUsd": "123.45"
}
}