# OKX Market Data API

Public v5 endpoints for spot, swaps, futures and options — open, and tightly licensed.

*https://cryptomarkets.tools/tools/okx-api · Crypto Market Data APIs*

## Facts

### At a glance

| Field | Value |
| --- | --- |
| Vendor | OKX |
| Category | Crypto Market Data APIs |
| Job | realtime |
| Website | https://www.okx.com/okx-api |
| Pricing model | free |
| Free tier | true |
| Open source | false |
| Licence | none |
| Self-hosted | false |
| KYC required | false |
| Tested hands-on | false |
| Last updated | 2026-09-21 |

### Pricing

| Tier | USD | Period |
| --- | --- | --- |
| Public market data | 0 USD | — |

### Coverage

| Field | Value |
| --- | --- |
| Asset classes | spot, perpetuals, futures, options, indices |
| Chains | none |
| Venues | cex, derivatives |
| Data latency | realtime |
| Platforms | library |
| AI features | none |

### Interfaces

| Field | Value |
| --- | --- |
| API | true |
| Webhooks | false |
| Scripting | none |
| MCP server | true |
| Export | json |

### Capabilities

Yes: derivatives_analytics

No: charting, screening, backtesting, automation, live_trading, paper_trading, portfolio_tracking, exchange_import, tax_reporting, alerts, news, onchain_data, wallet_tracking

*Verified: pricing 2026-09-19; capabilities 2026-09-19; coverage 2026-09-19.*

## What it is

OKX's v5 REST and websocket endpoints for its own market — last price and 24-hour statistics,
order books at several depths, recent and historical trades, candles, index tickers, and on the
derivatives side mark price, funding rate and history, open interest, option greeks and a set of
aggregate trading-statistics series.

The card covers that data API only. The venue itself is out of scope — this catalogue does not
list places to trade — and so is everything that needs a key and a balance behind it. What is in
scope is what a developer with no OKX relationship can read, on the terms OKX publishes for it.

The access answer is the easy half and the licence answer is the hard half, and they point in
opposite directions. Reading the data requires nothing at all: the documentation states that the
Public Data endpoints do not require authentication and that public websocket channels need no
login, and every market endpoint checked answered HTTP 200 unauthenticated on 19 September 2026.
Using the data is governed by an agreement that reaches the public endpoints explicitly and is
narrower than most readers expect.

## Pricing

Free to read, with no registration, no key and no published price list.

The cost is elsewhere. The API Agreement points anyone with commercial or institutional volume at
"a separate data licensing agreement", and no figure for that is published. So for a hobby project
or a personal strategy the price is genuinely zero; for anything you charge for, the price is
whatever OKX quotes, and you find that out by asking rather than by reading a page.

## Data & coverage

**Limits are per endpoint, per IP, in requests per two seconds.** This is the structural
difference from Binance and it changes how you plan. There is no shared weight budget to drain and
no header counting down — each endpoint has its own small counter. Tickers allow 20 requests per
two seconds; order book and candles 40; trades 100; `history-candles` and `history-trades` 20.
Every rate-limit rule in the market-data section reads `IP`, not `User ID`, so registering a key
buys nothing.

Two of the derivatives endpoints are stricter in a way that is easy to misread as generous.
`funding-rate` and `funding-rate-history` allow 10 requests per two seconds under a rule of **IP
plus instrument ID**, and `open-interest` allows 20 under the same compound rule. Per instrument
that is roomy; across a hundred contracts it is a hundred separate small budgets you have to
schedule, and one runaway loop on one contract does not starve the others. Breaching returns error
code 50011, "Rate limit reached", over HTTP 429.

**Websocket connections are cheap to open and expensive to churn.** The connection limit is three
per second per IP, and each connection allows 480 subscribe, unsubscribe or login messages per
hour — a reconnect-and-resubscribe storm burns through that quickly. A connection is dropped if
nothing has been pushed for more than 30 seconds, so a heartbeat is not optional. Note that candle
channels live on the `business` websocket URL rather than the `public` one, which is the kind of
detail that costs an afternoon.

**Live candles are shallow; history is a second endpoint.** The regular candles endpoint returns
"the latest 1,440 data entries" — one day of one-minute bars — with a maximum of 300 per request.
Anything older comes from `history-candles`, which returned daily BTC-USDT candles for December
2017; a request reaching back to July 2017 returned an empty array, so the real start for that
pair is somewhere in the second half of 2017 rather than at the exchange's founding.

**There is a documented staleness caveat, and it is unusually honest.** The docs state that market
data is served by multiple services each holding an independent cache, that a request goes to a
random one, and that "for two requests, it's expected that the data obtained in the second request
is earlier than the first request". Successive REST polls can therefore go backwards in time. If
you are polling for a price rather than subscribing to a stream, your code needs to be monotonic
on timestamps or it will record ticks that never happened.

**Derivatives coverage goes past the tape.** Option instruments and a greeks/implied-volatility
summary are public, as are index tickers and a set of aggregate statistics series — open-interest
history, top-trader long/short account ratio, taker volume. These are the numbers usually sitting
behind a paid tier at a data vendor, and here they answer to an anonymous GET.

**Flat files exist and start much later than the API.** The historical-data portal lists tick
trade history from September 2021, candlesticks from July 2023, funding rate from March 2022,
order-book L2 from March 2023 and borrowing rate from December 2021. If you need trades from 2019,
the archive does not have them.

## Integrations

OKX's documentation links a Python SDK, `python-okx`, published to PyPI and updated to 0.4.4 on 7
September 2026. Worth being precise about what is verified there: the publishing account is
`okxv5api` rather than a verified OKX organisation, and what makes it the right package is that
OKX's own docs point at that project, not the name.

There is a genuine first-party MCP server — `okx/agent-trade-kit`, under the OKX GitHub
organisation, MIT licensed and pushed to on 14 September 2026. It runs locally rather than as a
hosted endpoint, exposes 167 tools across eleven modules, and its market module is marked as
requiring no authentication, which matches what the REST endpoints do. The other ten modules are
trading and account tools, which is to say most of that repository is outside what this card
covers.

## Limitations

**The licence is the reason to read this section.** The OKX API Agreement, last updated 28 July
2026, says at section 9.4 that Market Data may be accessed and used "solely for your own personal,
non-commercial trading and account management purposes". It then forbids, without prior written
consent, reselling, redistributing, publishing, displaying or otherwise making that data available
to any third party — "whether for commercial gain or otherwise", which catches the free hobby
dashboard as well as the paid product. It separately forbids using the data to build, operate or
contribute to any competing data product, market-data service, financial data aggregator, price
feed or analytics platform, and to train, fine-tune or evaluate any machine-learning model
intended to be commercialised.

And it closes the loophole most people assume exists: the restrictions "apply equally to Market
Data accessed through public endpoints as to Market Data accessed through authenticated
endpoints". Being able to read something without a key is not a licence to republish it. The same
section adds that anyone needing high-frequency or large-scale access for commercial or
institutional purposes must obtain a separate data licensing agreement — so the narrow grant and
the route out of it sit in the same paragraph.

The flat-file archive is licensed on the same footing — a revocable, non-exclusive, royalty-free
personal-use licence that expressly covers developing your own trading strategy, defines
commercial use to include any redistribution or sub-licensing to end users or business partners,
and requires you to delete all copies on revocation.

**One venue.** No aggregation, no cross-exchange symbology, no fallback when OKX is degraded. The
index tickers are OKX's own index, not an independent benchmark.

**Two endpoints where you expect one.** The 1,440-entry ceiling on live candles means any chart
longer than a day is a join between `candles` and `history-candles`, with different rate limits on
each and an off-by-one at the seam. That is design work the pricing page will never mention,
because there is no pricing page.

**Rate limits do not scale with anything you can buy.** They are per IP, so the only lever is more
egress addresses. A key, a VIP tier or a funded account changes nothing about the public
market-data budget.

**No SLA and a documented right to change the data.** A free unkeyed endpoint carries no uptime
commitment, the cache behaviour above is the vendor telling you the numbers may arrive out of
order, and nothing in the agreement obliges OKX to keep any particular endpoint available.

## Alternatives

The venue-direct feeds differ mostly in their licences and their geography.
[Binance API](https://cryptomarkets.tools/tools/binance-api) is the same free, unkeyed shape with a redistribution restriction
on both halves and a free archive under a non-commercial, ShareAlike licence.
[Bybit API](https://cryptomarkets.tools/tools/bybit-api) blocks US and mainland-China IP addresses outright, which settles it
before any endpoint comparison. [Coinbase Exchange API](https://cryptomarkets.tools/tools/coinbase-exchange-api) is spot only
and bars feeding the data to a model in a clause of its own.

Once you want more than one venue's own view of itself, the answer is a different kind of product:
[CCXT](https://cryptomarkets.tools/tools/ccxt) for one client over many exchanges, [CoinAPI](https://cryptomarkets.tools/tools/coinapi) for a single
symbol scheme across 400-plus, [Tardis.dev](https://cryptomarkets.tools/tools/tardis-dev) for the history none of the venue
APIs keep.

## FAQ

### Do I need an OKX account or API key for market data?

No. The docs state that the Public Data endpoints do not require authentication and that public websocket channels need no login. Tickers, order books, candles, trades, funding rate, open interest and option greeks all answered HTTP 200 to an unauthenticated client on 19 September 2026. Keys and an account are for the private endpoints, which this card does not cover.

### How are OKX rate limits counted?

Per endpoint, in requests per two seconds, against your IP — not against a shared weight pool the way Binance does it. Tickers allow 20 per 2s, order book and candles 40, trades 100, history-candles and history-trades 20. Funding rate and open interest are counted per IP and instrument together, so polling fifty contracts is fifty separate budgets.

### Can I republish OKX prices in my own app?

Not without written consent. The API Agreement limits Market Data to "your own personal, non-commercial trading and account management purposes" and forbids reselling, redistributing, publishing or displaying it to any third party without OKX's prior written consent — and it says the restriction applies to public endpoints exactly as it does to authenticated ones. Building a price feed, aggregator or analytics product on it is named separately and also prohibited.

### How far back does the free OKX candle history go?

Further than the live endpoint suggests. The regular candles endpoint returns only the latest 1,440 entries, so on a one-minute bar that is a day. Older data comes from history-candles, which returned daily BTC-USDT candles for December 2017 — at 300 results per request and 20 requests per two seconds, backfilling a long window is a paced job rather than a single pull.

## Also worth comparing

- [Binance Market Data API](https://cryptomarkets.tools/tools/binance-api.md) — One venue's own tape — prices, books, trades and funding, free and unkeyed.
- [Bybit Market Data API](https://cryptomarkets.tools/tools/bybit-api.md) — Venue-direct spot, perps and options data with no key — if your IP is not in the US.
- [Coinbase Exchange API](https://cryptomarkets.tools/tools/coinbase-exchange-api.md) — Free keyless spot data down to the order-by-order book — with a redistribution ban.
- [CoinAPI Market Data API](https://cryptomarkets.tools/tools/coinapi.md) — One symbol scheme over 400+ venues, metered in REST credits and WebSocket gigabytes.
- [CoinGecko API](https://cryptomarkets.tools/tools/coingecko-api.md) — Prices, market data and onchain DEX data for 18,000+ coins, via REST, websocket or MCP.
- [CoinMarketCap API](https://cryptomarkets.tools/tools/coinmarketcap-api.md) — Prices, rankings, DEX and derivatives data billed by data points returned, not by call.
