ankr_getTokenPrice
Look up the USD price of a token or native coin
POST/?ankr_getTokenPrice
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).
Request
Responses
- 200
- 400
- 401
- 429
- 500
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.
Bad Request — malformed JSON-RPC envelope or invalid params. The gateway rejects before the JSON-RPC layer processes the call.
Unauthorized — missing or invalid API key in the server URL path. Verify that {API_KEY} is set to a valid project key.
Too Many Requests — the API key has exceeded its rate or quota limits. Back off and retry; consider upgrading the Premium tier for higher limits.
Server error — unexpected condition. Retry with exponential backoff; if it persists, file a ticket at https://www.ankr.com/support/.