Kraken API
Public market data and (with keys) trading for the Kraken exchange.
What it does
The Kraken REST API covers public market data (ticker, order book, OHLC, recent trades, asset info) and private account operations (balances, orders, funding, staking). A WebSocket API streams live prices and order books.
Base URL
Authentication
Public endpoints under /0/public/ need nothing. Private endpoints under /0/private/ require an API key in the API-Key header and a base64 HMAC-SHA512 API-Sign computed from the path, a nonce and the POST body.
Code examples
curl -s "https://api.kraken.com/0/public/Ticker?pair=XBTUSD" curl -s "https://api.kraken.com/0/public/OHLC?pair=ETHUSD&interval=60"
import requests
r = requests.get("https://api.kraken.com/0/public/Ticker",
params={"pair": "XBTUSD"}, timeout=10)
data = r.json()
if data["error"]:
raise SystemExit(data["error"])
pair = next(iter(data["result"]))
print("last trade:", data["result"][pair]["c"][0])Rate limits & quotas
Public calls are limited to roughly 1 request/second per IP. Private calls use a counter that decays over time and whose ceiling depends on your verification tier (Starter/Intermediate/Pro). Every response has an error array — check it even on HTTP 200; EAPI:Rate limit exceeded means slow down.
Key response fields
| result.<pair>.c | [last_price, lot_volume] |
| result.<pair>.v | 24h volume [today, last_24h] |
| result.<pair> (OHLC) | Arrays of [time, open, high, low, close, vwap, volume, count] |
| error[] | Kraken error strings — empty means success |
Common errors
| EAPI:Invalid key / EAPI:Invalid signature | Key, secret, nonce or signing base string is wrong. |
| EAPI:Rate limit exceeded | Public 1/s or private counter exceeded. |
| EQuery:Unknown asset pair | Use Kraken’s pair codes — Bitcoin is XBT, not BTC. |
| EGeneral:Invalid arguments | Missing or malformed parameter. |
When to use it (and alternatives)
Use Kraken for exchange-native data and trading, especially if you already hold funds there. For simple aggregated prices, CoinGecko is less fiddly; Binance is the other big exchange API.
FAQ
Why does my pair not exist?
Kraken uses XBT for Bitcoin and prefixes some legacy assets with X/Z (e.g. XXBTZUSD). Call /0/public/AssetPairs to get the exact codes.
The HTTP status is 200 but I have no data — why?
Kraken returns errors in a JSON error array with a 200 status. Always check if resp['error']: before using result.
How is the private rate limit calculated?
It is a leaky-bucket counter: each call adds points, the counter decays every few seconds, and your maximum depends on account tier. Space out order and ledger queries accordingly.
New to APIs?
Short guides for working with this API — and any other.