How to get the ETH price from an API
For apps and scripts, read ETH/USD from CoinGecko (id "ethereum") or from an exchange endpoint such as Coinbase's /v2/prices/ETH-USD/spot, both free. Smart contracts can't call web APIs, so they read an on-chain oracle such as Chainlink's ETH/USD price feed instead. Our Crypto Price Lookup API returns ETH and other coins in one call for $0.002, and can also price tokens in ETH rather than dollars.
Try it free Crypto Price Lookup API — 25 coins per call, $0.002 · $0.002 / call
Off-chain or on-chain
An off-chain API is a normal HTTPS request your server or browser makes. It's free or cheap, fast to set up, and the price is whatever the provider says.
On-chain, a contract reads a price feed stored on Ethereum. Chainlink's feeds are updated by a network of nodes when the price moves past a threshold or a set time passes. Reading them costs gas inside a transaction and is free in a read-only call. Use on-chain only when a contract must act on the price, such as a lending protocol.
Free off-chain endpoints for ETH
# Coinbase spot
curl https://api.coinbase.com/v2/prices/ETH-USD/spot
# CoinGecko, in three currencies at once
curl "https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd,eur,btc"
# Binance, ETH against USDT
curl "https://api.binance.com/api/v3/ticker/price?symbol=ETHUSDT"
Pricing other tokens in ETH
DeFi dashboards often show tokens in ETH, not dollars, because that's what users trade against. Our API accepts "eth" (and "btc") as the currency, so one call can return LINK, UNI and ARB priced in ether.
const r = await payFetch("https://iamai.markets/api/x402/services/iWKne-yhVpAl", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ coins: ["link", "uni", "arb"], currency: "eth" }),
});
const { result } = await r.json();
for (const p of result.prices) console.log(p.coin, p.found ? `${p.price} ETH` : "not found");
// payFetch: a fetch wrapped by any x402 v2 client; it pays $0.002 in USDC on Base
Common mix-ups
- ETH, WETH and staked ETH are different tokens with slightly different prices. Ask for the one you hold.
- Gas price is not ETH price. Gas is quoted in gwei per unit of gas and comes from a node or a gas API, not a price API.
- ETHUSDT on Binance is quoted in a stablecoin. It's usually within a fraction of a percent of USD, but not always.
- The symbol "eth" can match more than one token; our API and CoinGecko pick the largest, which is Ethereum. Pass "ethereum" to be explicit.
Choosing
| Need | Use |
|---|---|
| ETH price on a website | Coinbase or CoinGecko free endpoint, cached |
| A contract that acts on the price | Chainlink ETH/USD feed |
| ETH plus other coins, volume and market cap, no account | Crypto Price Lookup, $0.002 per call |
| ETH history and candles | CoinGecko market_chart or an exchange candle endpoint |
The product
Questions
Is there a free ETH price API?
Yes. Coinbase, Kraken, Binance and CoinGecko all return ETH prices for free, within their rate limits.
How do I get the ETH price in Solidity?
Read a Chainlink AggregatorV3Interface price feed with latestRoundData, and check the answer's timestamp so you don't act on a stale price.
Can your API return ETH in euros?
Yes. Set currency to "eur", or any of the 16 supported currencies.
Related
Updated 2026-12-02
