TL;DR
OKX provides a public REST API endpoint for market tickers covering spot, margin, futures, perpetual swaps, and options trading. The tickers endpoint returns 24-hour trading statistics including open/high/low/last prices, volume, and price change percentages for every listed instrument. No API key is needed for public market data, making it one of the most accessible exchange APIs for crypto price monitoring.
Quick start: https://www.okx.com/api/v5/market/tickers?instType=SPOT
No API key needed — just make a request!
How to Use This API
1. Get All Spot Market Tickers
https://www.okx.com/api/v5/market/tickers?instType=SPOT
Returns all spot trading pairs with their current stats. Other instType values: SWAP, FUTURES, OPTION.
2. JavaScript — Monitor BTC/USDT
fetch('https://www.okx.com/api/v5/market/tickers?instType=SPOT')
.then(r => r.json())
.then(data => {
const btc = data.data.find(t => t.instId === 'BTC-USDT');
console.log('BTC/USDT:', btc.last, 'Vol:', btc.vol24h);
});
3. Python — List Top Gainers
import requests
data = requests.get(
'https://www.okx.com/api/v5/market/tickers',
params={'instType': 'SPOT'}
).json()
top = sorted(data['data'], key=lambda x: float(x['change24h']), reverse=True)[:5]
for t in top:
print(f"{t['instId']}: {float(t['change24h'])*100:.2f}%")
https://www.okx.com/api/v5/market/tickers?instType=SPOT
Frequently Asked Questions
- What instrument types are available?
- The API supports
SPOT(spot trading),SWAP(perpetual swaps),FUTURES(delivery futures), andOPTION(options). Each has its own ticker data structure. - What fields are in each ticker?
- Each ticker includes:
instId,last,lastSz,askPx,bidPx,open24h,high24h,low24h,vol24h,change24h, andts(timestamp). - Do I need an API key?
- No. The public ticker endpoints are freely accessible without any authentication. Only private endpoints (trading, account info) require keys.
- How often is the data updated?
- Ticker data is updated in real-time as trades happen on the OKX exchange. The 24-hour rolling stats update with each new trade.
- Can I query a single instrument?
- Yes. Use the
/api/v5/market/ticker(singular) endpoint with aninstIdparameter like?instId=BTC-USDTto get data for a single pair. - Is there a rate limit?
- OKX imposes rate limits on public endpoints, but they are generous for basic market data polling. Check OKX API documentation for current limits.
API Details
- API URL
https://www.okx.com/api/v5/market/tickers- Documentation
- www.okx.com/api-v5
- Category
- Finance
- Authentication
- Not Required (public endpoints)
- Geographic Coverage
- Global — cryptocurrency markets
What You Can Build
- Real-time cryptocurrency price ticker widget for websites
- 24-hour market movers scanner identifying biggest gainers and losers
- Multi-exchange price comparison tool (OKX vs Binance vs Kraken)
- Trading volume analysis dashboard for spot and derivatives markets
- Alert bot that monitors price thresholds across all spot pairs