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

Request body

idinteger required

Client-supplied request ID echoed in the response.

jsonrpc'2.0' required
method'ankr_getTokenPrice' required

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.

idinteger required
jsonrpc'2.0' required

Changes

No recorded changes to this operation across all 1 revision of this API.