OK Trade Developer platform
Build your edge.
Market data, automated strategies and real-time connections. The tools to turn your ideas into execution.
API v5 reference
Public examples use OKX market data. OK Trade keys are demo-only.
REST
Request-response access to tickers, order books, account balances and order management.
WebSocket
Stream public market channels and receive incremental updates without polling.
FIX
Institutional session-based connectivity for order entry and execution reports.
REST • Start with a ticker
Public market endpoints need no authentication. The examples below call the actual OKX v5 public API used by this demo. Inspect the response code as well as HTTP status; code “0” indicates success.
curl 'https://www.okx.com/api/v5/market/ticker?instId=BTC-USDT'Authenticated requests
Private requests use OK-ACCESS-KEY, OK-ACCESS-SIGN, OK-ACCESS-TIMESTAMP and OK-ACCESS-PASSPHRASE headers. The signature is Base64-encoded HMAC-SHA256 of timestamp + uppercase method + request path (including query) + body, signed with your secret. Use the exact transmitted body and keep clocks synchronized. Never put credentials in browser code or URLs.
Demo keys created here cannot authenticate to OKX or place real orders.
Endpoint directory
| Method | Endpoint | Purpose | Access |
|---|---|---|---|
| GET | /api/v5/market/ticker | Single instrument ticker | Public |
| GET | /api/v5/market/books | Order book depth | Public |
| GET | /api/v5/market/candles | Historical OHLCV | Public |
| GET | /api/v5/public/instruments | Instrument specifications | Public |
| GET | /api/v5/account/balance | Account balances | Read |
| POST | /api/v5/trade/order | Place an order | Trade |
| POST | /api/v5/trade/cancel-order | Cancel an order | Trade |
| POST | /api/v5/asset/withdrawal | Request withdrawal | Withdraw |
WebSocket • Stay in sync
Connect to the public endpoint below, then send the subscription message. Send “ping” after an idle period and expect “pong”. Reconnect with exponential backoff and resubscribe after interruptions. Book consumers should validate sequence numbers and rebuild state after a gap.
wss://ws.okx.com:8443/ws/v5/public
{
"op": "subscribe",
"args": [
{
"channel": "tickers",
"instId": "BTC-USDT"
}
]
}FIX • Institutional workflows
FIX connectivity requires institutional onboarding, approved network access and separately provisioned session credentials. Negotiate sender/target IDs, heartbeat intervals and sequence recovery before certification. Use unique client order IDs, reconcile execution reports and never treat a network timeout as an order rejection.
This demo does not operate a FIX gateway. Ask support about eligibility, certification environments, supported message types and production access before integration.
Rate limits & resilient clients
Illustrative planning limits based on common v5 endpoints. Limits vary by endpoint and account tier; verify current provider documentation before deployment.
| Operation | Limit | Scope |
|---|---|---|
| Market ticker | 20 requests / 2 seconds | IP address |
| Order book | 40 requests / 2 seconds | IP address |
| Account balance | 10 requests / 2 seconds | User ID |
| Place order | 60 requests / 2 seconds | User + instrument |
| WS subscribe / login | 480 requests / hour | Connection |
Queue requests, apply backoff with jitter, and reconcile order state before retrying a timed-out write. A successful transport response is not a guarantee of an accepted order.
Your demo API keys
Keys exist only in this page's memory and disappear on reload. Never enter a real passphrase or use these credentials in production.