Binance candlesticks (klines)
OHLCV candlesticks for a spot pair: open time, open, high, low, close, base volume, close time, quote volume, trade count, taker-buy base and quote volume. Up to 1,000 candles per call between optional start and end. To page forward, pass next_start back as start; null when the range is done. With market=usdm|coinm, futures candles, and with price_type=mark|index, mark-price or index-price candles.
Every response includes credits_used: the credits this call cost.
Parameters
| name | type | description |
|---|---|---|
symbolrequired | string | Trading pair symbol, e.g. BTCUSDT, ETHBTC (a slash, dash or underscore between the assets is accepted). Example: BTCUSDT |
interval | 1s | 1m | 3m | 5m | 15m | 30m | 1h | 2h | 4h | 6h | 8h | 12h | 1d | 3d | 1w | 1M | Candle size (default 1d). Example: 1d |
start | string | Start time: ISO date/time or unix seconds/milliseconds. Example: 2024-01-01 |
end | string | End time: ISO date/time or unix seconds/milliseconds. Example: 2024-03-01 |
limit | integer | Candles per call, 1-1000 (default 500). |
timezone | string | UTC offset that sets where day/week/month candles start, e.g. +5:30 or -8 (default UTC). |
market | spot | usdm | futures | coinm | spot (default), usdm (USDⓈ-M futures; futures also works) or coinm (COIN-M futures, e.g. BTCUSD or BTCUSD_PERP). Futures allow up to 1,500 candles per call; timezone and the 1s interval are spot only. |
price_type | last | mark | index | Futures only: last (default, traded price with volumes), mark (mark price) or index (index price of the underlying pair). Mark and index candles have null volume fields. The answer then adds market and price_type. |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/binance/v1/klines?symbol=BTCUSDT" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/binance/v1/klines",
params={"symbol": "BTCUSDT"},
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/binance/v1/klines");
url.searchParams.set("symbol", "BTCUSDT");
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).