OKX API
v5 unified REST + WebSocket · one account model across spot, swap and options
Create a key safely
- Profile → API → Create API key.
- OKX adds a passphrase on top of key + secret — you choose it at creation and send it with every signed request.
- Permissions: start with Read; add Trade only for a live engine; never enable Withdraw.
- Bind IPs — required for keys with Trade permission that you want long-lived.
- Use the demo-trading flag (x-simulated-trading: 1) to test against paper balances first.
Permissions: what to grant
- Read: account, positions, bills — enough for dashboards and trackers.
- Trade: places and cancels orders; combine with sub-accounts to sandbox exposure.
- Withdraw: never grant it to any third party, including us.
Worth knowing before you code
- v5 unifies spot/margin/swap/futures/options under one account and one API.
- Copy-trading has an official public endpoint — it powers our OKX leaders page.
- WebSocket for streams, REST for state — OKX documents both cleanly with per-endpoint rate limits.
Never grant withdrawal permission to anyone. Not to us, not to any service. Our connect flow refuses keys that have it. A trading key can lose a trade; a withdrawal key can lose the account.
Connect this key to our engine → Official API docs Create an OKX account
Other guides: Gate.io API · Bybit API · MEXC API · Compare their fees