How to Create and Bind an OKX API Key: Permissions and Hedge Mode
Step by step: create an OKX API key for automated trading with read and trade permission only (no withdrawals), save the passphrase, switch to long/short (hedge) mode, isolate funds in a sub-account, and fix common binding errors.
Three things matter: tick only Read and Trade, never Withdraw; the secret key and passphrase are shown only once, so save them yourself; and the position mode must be long/short (hedge) mode.
Before you start: create a sub-account
The platform only manages positions it opened. If the bound account already holds futures positions, it refuses to take over, so it never closes your manual trades by mistake. We strongly recommend a dedicated OKX sub-account for the strategy, funded separately from your manual trading.
For a first run you can also use OKX demo trading: create a separate demo-trading API key. Signals and risk controls are identical to live, so you can learn the flow before switching to a live key.
Step 1: create the API key
Log in to OKX (switch to the sub-account if you use one), open API management from the avatar menu, click Create API key, choose API trading as the purpose and give it a recognizable name.
Tick only Read and Trade. Do not tick Withdraw. Without withdrawal permission, the platform cannot move your funds.
Set a passphrase and complete security verification. The page then shows the API key, secret key and passphrase. The secret key is shown only this once; save it somewhere safe right away.
Step 2: switch to hedge mode
The system manages long and short positions and their stops separately. In OKX trading settings, set the position mode to long/short mode (hedge mode). Switching may be blocked while you hold positions or open orders, so clear them first.
The platform never changes account settings for you. If the mode is wrong, binding fails with a message that hedge mode is required.
Step 3: bind on the platform and size your margin
On the Account page, choose OKX and enter the API key, secret key and passphrase. The platform verifies them directly with the exchange, then stores them encrypted per user; the page and API never return them in plain text again.
Then open the funding check on the Strategy page. It reads your live balance, checks whether worst-case margin usage would exceed available funds, and offers one-click suggested values if not. Finally, make sure the strategy is switched on and the mode is auto-execute.
Common binding errors
Hedge mode required: go back to step 2, switch the position mode and verify again.
Unknown positions in the account: the account holds positions the platform didn't open. Close them or bind a clean sub-account.
Signals appear but no order is placed: usually insufficient funds, the maximum number of positions reached, or the strategy set to observe-only. Apply the funding check's suggestions.
- Does the OKX API key need withdrawal permission?
- No, and it shouldn't have it. Read and Trade are enough; without withdrawal permission nobody can move funds through the platform.
- What if I lose the secret key or passphrase?
- OKX will not show the secret key again. Delete the old key, create a new one and bind it again on the Account page.
- How do I revoke access later?
- Unbind it on the Account page at any time, or delete the API key on OKX; it stops working immediately.