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
Version: 2.0

Get Multiple ERC20 token prices

POSThttps://deep-index.moralis.io/api/v2/erc20/prices

Returns an array of token prices denominated in the blockchain's native token and USD for a given token contract address

QUERY PARAMS
chainstring
The chain to query
includestring
If the result should contain the 24hr percent change
BODY PARAM
tokensarrayrequired
The tokens to be fetched
tokens[0]
token_addressstring
The contract address
exchangestring
The exchange
to_blockstring
The block number
tokens[1]
token_addressstring
The contract address
exchangestring
The exchange
to_blockstring
The block number
tokens[2]
token_addressstring
The contract address
exchangestring
The exchange
to_blockstring
The block number
tokens[3]
token_addressstring
The contract address
exchangestring
The exchange
to_blockstring
The block number
Responses
API KEY
// Dependencies to install:
// $ npm install node-fetch --save
// add "type": "module" to package.json

import fetch from 'node-fetch';

const options = {
method: 'POST',
headers: {
accept: 'application/json',
'content-type': 'application/json',
'X-API-Key': 'YOUR_API_KEY'
},
body: JSON.stringify({
"tokens": [
{
"token_address": "0xdac17f958d2ee523a2206206994597c13d831ec7"
},
{
"token_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
},
{
"token_address": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84",
"exchange": "uniswapv2",
"to_block": "16314545"
},
{
"token_address": "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0"
}
]
})
};

fetch('https://deep-index.moralis.io/api/v2/erc20/prices?chain=eth&include=percent_change', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Response Example
Empty