> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://okx-demo.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://okx-demo.ferndocs.com/_mcp/server.

# OKX API

OKX API · v5

Trade like a pro.\
Build like one too.
===================

Programmatic access to trading, market data, and account management on one of
the world's largest crypto exchanges — over REST and WebSocket.

[Get started →](/docs/get-started/create-an-api-key)

[API reference](/api)

₿ **BTC / USD***Bitcoin*

67,912.40 +2.18%

LIVE

24h High**68,540**

24h Low**66,120**

24h Vol**1.24B**

Powered by the API

## The same API behind the OKX app

Every quote, balance, and trade you see in the OKX app flows through the same REST and
WebSocket API documented here. Subscribe to live tickers, order books, and account updates,
and build the same real-time experiences into your own product.

[Explore WebSocket →](/docs/realtime/web-socket)

## Start building

#### [Create an API Key](/docs/get-started/create-an-api-key)

Generate your key, secret, and passphrase and set permissions.

#### [REST Authentication](/docs/authentication/rest-authentication)

Sign private requests with HMAC-SHA256 in a few lines of code.

#### [WebSocket](/docs/realtime/web-socket)

Stream tickers, order books, and private account channels.

#### [Market Data](/api)

Public tickers, order books, candlesticks, and trades — no auth required.

#### [API Reference](/api)

Browse all 260+ REST endpoints with schemas, examples, and code snippets.

#### [Demo Trading](/docs/get-started/demo-trading)

Test everything risk-free with simulated funds before going live.