OKX+API.SH

OKX API

OKX market data as JSON: tickers, candles, order books, trades, funding and open interest, with no exchange account.

The API.SH OKX API returns public OKX market data as JSON. Get one instrument's ticker or every instrument of a type ranked by volume, change or price, full candle history at any bar size, the order book with spread, recent and older trades, funding rates with history, open interest with long/short ratio and taker volume, instrument specifications, and option greeks. It covers spot, margin, perpetual swaps, futures and options.

  • 8 endpoints
  • from $1 / 1,000 calls
  • 1,000 free credits / month
  • failed calls free
OKX candles
GET https://api.api.sh/okx/v1/candles
{ "success": true }
1 credit · $1 per 1,000 calls

What you can build with the OKX API

Price feeds and dashboards

Show last price, 24-hour change and volume for the coins you follow, or rank every spot pair by gainers and losers.

Backtesting

Download candle history at bar sizes from one minute to three months and page back to the instrument's start.

Derivatives research

Track funding rates, open interest, long/short ratio and taker volume on perpetual swaps and futures.

Market depth and liquidity

Read order book depth and spread and the latest trades to measure liquidity on a pair.

Options analytics

List options with greeks and implied volatility, and their strikes and expiries from the instrument list.

OKX data you get

Field names from real responses. Numbers come parsed, URLs absolute, dates in ISO 8601.

OKX API endpoints and prices

Every OKX endpoint costs 1 credit per call: credits are $1 per 1,000 on a monthly plan, $2 pay-as-you-go. Pricing

Products, listings and places1
OKX order book
/okx/v1/orderbook
$1 · $2 PAYG
1 credit
More data7
OKX candles
/okx/v1/candles
$1 · $2 PAYG
1 credit
OKX funding rate
/okx/v1/funding
$1 · $2 PAYG
1 credit
OKX instruments
/okx/v1/instruments
$1 · $2 PAYG
1 credit
OKX open interest
/okx/v1/open-interest
$1 · $2 PAYG
1 credit
OKX ticker
/okx/v1/ticker
$1 · $2 PAYG
1 credit
OKX market tickers
/okx/v1/tickers
$1 · $2 PAYG
1 credit
OKX recent trades
/okx/v1/trades
$1 · $2 PAYG
1 credit

Call the OKX API

OKX candles: GET https://api.api.sh/okx/v1/candles

curl "https://api.api.sh/okx/v1/candles?inst=BTC-USDT" \
  -H "x-api-key: $APISH_KEY"
  1. Create a free accountConfirm your email and get 1,000 free credits every month. No card needed.
  2. Create an API keyOne key works for all 482 platforms.
  3. Send the requestJSON back in one call. Add output=csv or output=ndjson for files.

Why API.SH for OKX data

  • Public data only: no OKX login, cookies or account needed
  • One key and one response shape for OKX and 481 other platforms
  • Built and maintained by API.SH, not third-party publishers
  • Pay per call; errors on our side cost nothing
  • Live status for every endpoint

API.SH vs the official OKX API

OKX has a free official API (v5, REST and WebSocket) whose public market data endpoints need no key; trading and account endpoints need API keys, and placing orders via the API now requires KYC level 2. API.SH covers only public market data and is for teams that want it in a ready, ranked JSON format alongside other data sources, or in Sheets, Zapier and AI agents without writing an exchange client.

If you only need OKX market data, API.SH saves you maintaining an SDK such as python-okx and handling its rate limits and pagination, at a fixed price per call.

OKX API questions

What OKX data can I get?+

Tickers for one instrument (/okx/v1/ticker) or all instruments of a type (/okx/v1/tickers), candles (/okx/v1/candles), order book (/okx/v1/orderbook), trades (/okx/v1/trades), funding rates (/okx/v1/funding), open interest (/okx/v1/open-interest) and instrument specs (/okx/v1/instruments).

How much does the OKX API cost?+

Every OKX endpoint costs 1 credit per call. On a monthly plan 1,000 credits cost $1 (Starter is $50/month for 50,000 credits). Pay-as-you-go is $2 per 1,000 credits, with top-ups from $15 that never expire.

Is the OKX API free?+

OKX's own API is free to use. API.SH is a paid service, and every account gets 1,000 free credits every month. That is 1,000 calls to /okx/v1/candles at 1 credit each.

Does OKX have an official API?+

Yes. OKX offers the v5 REST and WebSocket API for market data, trading and account management. API.SH does not trade or touch accounts; it returns OKX's public market data as JSON with one key.

Do I need an OKX account, API key or KYC?+

No. API.SH reads public market data only, so you need no OKX account, OKX API key or KYC. You only need your API.SH key.

Can I place orders or check balances?+

No. API.SH is read-only market data. To trade, use OKX's official API with your own keys.

How do I get historical candles and trades?+

Call /okx/v1/candles with inst and bar (for example 1H or 1D). Pass next_end back as end to page further into the past. /okx/v1/trades with history=true returns about the last three months of trades the same way.

How do I get started?+

1. Sign up at api.sh. 2. Copy your API key. 3. Call /okx/v1/ticker with inst=BTC-USDT. Docs and request examples are at https://api.sh/docs. You can also use the JS or Python SDK, Google Sheets, Zapier, Make, n8n or the MCP server at https://api.sh/mcp.

More finance & crypto APIs all financial & crypto APIs →

Start with 1,000 free credits
Every month, on every account. One key works for all 482 platforms.
Get a free API key