Current or historical USD prices of tokens by contract address or CoinGecko id, with symbol, decimals, price time and confidence. Optionally each coin's percentage change over a period (change_percent) and a price chart (chart: time and price points) ending at date or now.
Every response includes credits_used: the credits this call cost.
Parameters
name
type
description
coinsrequired
string
Up to 100, comma-separated: chain:address (ethereum:0x..., solana:...) or coingecko:<id>. Example: coingecko:ethereum,coingecko:bitcoin
date
string
Price at this time instead of now (ISO date or unix time).
search_width
string
How far from the requested time a price may be taken, e.g. 30m, 6h (default), 1d.
change_period
string
Adds change_percent per coin: the price change over this period ending at date or now, e.g. 1h, 24h, 7d, 4w.
chart_period
string
Adds chart per coin: one price every this interval, e.g. 1h, 1d, 1w, ending at date or now.
chart_points
integer
With chart_period: number of points (1-500, default 30).
import os, requests
res = requests.get(
"https://api.api.sh/defillama/v1/prices",
params={"coins": "coingecko:ethereum,coingecko:bitcoin"},
headers={"x-api-key": os.environ["APISH_KEY"]},
timeout=120,
)
res.raise_for_status()
data = res.json()
const url = new URL("https://api.api.sh/defillama/v1/prices");
url.searchParams.set("coins", "coingecko:ethereum,coingecko:bitcoin");
const res = await fetch(url, { headers: { "x-api-key": process.env.APISH_KEY } });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json();
Response
A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).
The fastest way to see the full response is the playground: it runs this endpoint with your account and shows the exact JSON.