Token API
Look up the USD price of a token or native coin
Returns Ankr's current USD price for the specified token. Pass a contractAddress for an ERC-20 token, or omit it to fetch the price of the chain's native coin.
Prices are normalized to decimal strings; treat them as USD per unit token. The same call returns the queried contract address so you can round-trip the result.
Part of the Token API product (700 compute units per call, $0.00007 at base rate).
post/?ankr_getTokenPrice
Request
- Base URLhttps://rpc.ankr.com/multichain/569ca1f392f7d3d0bb1073a1173ecb649af1d9249231fe59fa95db19d5ae41fe
- Authnone declared
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Request body
Example request
{
"id": 1,
"jsonrpc": "2.0",
"method": "ankr_getTokenPrice",
"params": {
"blockchain": "eth",
"contractAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7"
}
}Response
Success. JSON-RPC result contains chain, contract address, and a decimal-string USD price. JSON-RPC errors are returned with HTTP 200; check the response body for an error key.
Changes
No recorded changes to this operation across all 1 revision of this API.