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 • 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.

GET /api/v5/market/ticker
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

MethodEndpointPurposeAccess
GET/api/v5/market/tickerSingle instrument tickerPublic
GET/api/v5/market/booksOrder book depthPublic
GET/api/v5/market/candlesHistorical OHLCVPublic
GET/api/v5/public/instrumentsInstrument specificationsPublic
GET/api/v5/account/balanceAccount balancesRead
POST/api/v5/trade/orderPlace an orderTrade
POST/api/v5/trade/cancel-orderCancel an orderTrade
POST/api/v5/asset/withdrawalRequest withdrawalWithdraw

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.

OperationLimitScope
Market ticker20 requests / 2 secondsIP address
Order book40 requests / 2 secondsIP address
Account balance10 requests / 2 secondsUser ID
Place order60 requests / 2 secondsUser + instrument
WS subscribe / login480 requests / hourConnection

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.

No demo keys to display. Create a key to explore permission controls.