Binance API
Public market data from the Binance exchange — prices, order books and klines.
What it does
Binance’s API exposes full spot, margin and futures trading plus deep market data. The public market-data endpoints — price ticker, order book, recent trades, candlesticks — need no account and are what most read-only apps use. Real-time streaming is available over WebSocket.
Base URL
Authentication
Market data (/api/v3/ticker/*, /api/v3/klines, /api/v3/depth) is public. Account and trading endpoints need an API key in the X-MBX-APIKEY header plus an HMAC-SHA256 signature of the query string using your secret. Note api.binance.com is geoblocked in some countries (use api.binance.us there).
Code examples
curl -s "https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT" curl -s "https://api.binance.com/api/v3/klines?symbol=ETHUSDT&interval=1h&limit=24"
import requests
r = requests.get("https://api.binance.com/api/v3/klines",
params={"symbol": "BTCUSDT", "interval": "1d", "limit": 7}, timeout=10)
for k in r.json():
open_time, o, h, l, c = k[0], k[1], k[2], k[3], k[4]
print(open_time, o, c)Rate limits & quotas
Rate limits are weight-based per IP: roughly 6,000 request-weight per minute on spot, where a simple ticker costs 1–2 and a deep order book costs more. Order placement has a separate per-10-second and per-day count. Response headers (X-MBX-USED-WEIGHT-1M) track your usage; exceed it and you get HTTP 429, then a temporary IP ban (418) if you keep going.
Key response fields
| price | Last trade price for the symbol |
| klines[] | [openTime, open, high, low, close, volume, closeTime, …] |
| bids / asks | Order book levels as [price, qty] |
| X-MBX-USED-WEIGHT-1M | Header: request weight consumed this minute |
Common errors
| 429 | Rate-limit weight exceeded — back off immediately. |
| 418 | IP auto-banned for ignoring 429s — wait out the ban. |
| 401 / -2015 | Bad API key, IP not whitelisted, or wrong permissions. |
| 400 / -1121 | Invalid symbol (must be e.g. BTCUSDT, no dash). |
When to use it (and alternatives)
Best when you need exchange-grade real-time prices, order books or actual trading. For aggregated cross-exchange market data and metadata use CoinGecko or CoinPaprika; Kraken is a comparable exchange API.
FAQ
Do I need an API key for prices?
No. All the market-data endpoints under /api/v3/ (ticker, klines, depth, trades) are public. Keys are only for balances and trading.
How do rate limits work?
By weight, not request count. Each endpoint has a documented weight; you get about 6,000 weight per minute per IP on spot. Read X-MBX-USED-WEIGHT-1M and stop before you hit 429 — repeated 429s escalate to a timed IP ban (418).
Why do I get a 451 or connection block?
api.binance.com is not available in some jurisdictions. Use the regional host (e.g. api.binance.us) or an aggregator instead.
New to APIs?
Short guides for working with this API — and any other.