OKX trading bot and API key setup: connect OKX safely
Run an OKX trading bot on spot with a trade-only API key: what agents can automate, key setup with a passphrase, a security checklist and fees.
Short answer
You can connect OKX to TradeCorgi with a trade-only API key, so an agent can place spot orders on your own account but never withdraw. TradeCorgi rejects any key with withdrawal permission, asks you to limit the key to its server addresses, and checks your limits before every order.
What you can automate on OKX
Describe a rule in plain words and an agent runs it on your OKX spot account, checking the market at most once a minute.
Dip buys
Buy a set amount when a coin falls a set percentage within a window, such as 5% in 24 hours.
Recurring buys
Buy a fixed amount on a schedule, with a rule that pauses buying after a deep fall.
Take-profit and stop-loss
Sell at a set gain or a set loss from your buy price, on every position the agent opens.
Indicator rules
Act on indicator levels such as RSI, alone or combined with price moves and schedules.
On Copilot you get an alert with a link to OKX instead, and you place the order yourself.
Create a trade-only OKX API key
- Log in to OKX and open API from your profile menu, then choose Create API key.
- Name the key something you will recognise, such as TradeCorgi, and set a passphrase. OKX cannot recover a lost passphrase, so keep it safe.
- Give the key the Read and Trade permissions only. Leave Withdraw off: TradeCorgi rejects any key that can withdraw.
- Add TradeCorgi's server IP addresses, shown in the app, to the key's IP allowlist.
- Copy the API key, secret key and passphrase into TradeCorgi. We check the permissions before saving it.
What TradeCorgi checks when you connect OKX
- The key can trade but cannot withdraw. A key with withdrawal permission is rejected.
- The key is limited to TradeCorgi’s server addresses, where OKX supports it.
- The key works and can read your balances, so the agent knows what it may spend.
- The same checks run again every day. If one fails, your OKX agents pause and you are told why.
Keys are encrypted with a key unique to you, and are decrypted only inside the service that places orders.
Security checklist for your OKX key
- Create a separate key just for TradeCorgi, so you can delete it without affecting anything else.
- Allow spot trading only. Leave withdrawals and transfers off.
- Turn on IP whitelisting with the addresses shown in the app.
- Keep two-factor authentication on for your OKX login.
- Never paste your key or secret into a chat, email or support form.
- Start with a small live budget; in its first week a live agent uses at most 20% of the amount you plan.
- Delete the key on OKX if you stop using TradeCorgi.
OKX fees
Every backtest and paper trade uses OKX’s fee for your account tier and its minimum order size, so a rule that only works before fees never looks good. Your agent pays the same trading fees you would pay placing the orders by hand.
Fees checked on October 27, 2026. OKX fee schedule
Why traders run agents on OKX
OKX is strong in Southeast Asia, Turkey and Latin America, and it serves users in the EU. For traders in those markets it is often the main account, which makes it a natural home for an agent. It is not available in the United States or, for TradeCorgi users, in India, because OKX is not registered with India's Financial Intelligence Unit.
OKX's own agent tools, and where TradeCorgi fits
In March 2026 OKX released its Agent Trade Kit, which lets AI agents place trades on OKX. Like the other exchange agent platforms that arrived in 2026, it is built for developers and covers one exchange.
TradeCorgi adds what an exchange toolkit does not:
- Hard limits before every order. A rules engine with no AI in it checks the budget, stop-loss, daily loss limit and open positions before any order reaches OKX.
- The reasoning, written down. OKX sees the orders. TradeCorgi's decision log records the rule behind each one, the fill price, and the times the agent chose to stay out.
- Honest testing. Backtests use OKX's fee for your tier and its minimum order size, and show the worst drop next to the result.
- No code. You describe the rule in plain words, in English, Spanish, Portuguese or Hindi, and confirm the exact rules on a strategy card.
The OKX passphrase
OKX API keys have a third part that most exchanges do not: a passphrase you choose when you create the key. Keep it somewhere safe when you create the key: TradeCorgi needs it together with the key and the secret. All three are encrypted with a key unique to you.
A worked example on OKX
A common rule for OKX users in Turkey and Latin America is a weekly buy with a safety stop: "Buy $40 of BTC every Monday, and pause buying if BTC is 15% below my average price." TradeCorgi turns that into a strategy card, backtests it on OKX's BTC/USDT history with OKX's fees, and runs it on paper with live OKX prices.
When you go live, the agent places a spot order on your OKX account each Monday, checks the budget and the pause rule first, and writes each buy into the decision log. This is an illustrative example, not a real result.
Who OKX suits on TradeCorgi
- Traders in Southeast Asia, Turkey, Latin America and the EU who already keep their main account on OKX.
- People who want to run the same strategy on OKX and another exchange, side by side, with one kill switch.
If you are in India, use Binance or Bybit. In the United States, use Coinbase or Kraken.
Before you connect
Run your strategy on paper first. When you go live, the agent trades on your own OKX account with the amount you allow, and in its first week it uses at most 20% of that amount. One tap pauses the agent; "Pause and close" also sells its open positions at market price on OKX.
How a live agent behaves on OKX
Paper first
Every strategy runs on paper with OKX’s live prices before it can trade real money.
Limits before every order
Budget, stop-loss, daily loss limit and open positions are checked before each order reaches OKX.
A reason for every trade
The decision log records the rule behind each order and the price OKX actually filled it at.
One tap to stop
Pause an agent, or pause it and sell its open positions at market price on OKX.
Troubleshooting
- The key was rejected when I connected it
- The key most likely has withdrawal permission, or no trading permission. Create a new key with spot trading only and try again.
- The connection fails after I added IP whitelisting
- Check that every address shown in the app is on the key exactly, with nothing else. A missing address blocks some requests.
- My agent paused and says the key failed
- The key was deleted, expired or changed on OKX. Your funds and positions stay on OKX. Connect a new key to resume.
- My agent paused during maintenance
- Agents pause when OKX is under maintenance or prices are more than 2 minutes old, and tell you why. Check OKX’s status page, then resume.
- My agent paused with a position mismatch
- The agent’s record no longer matches your OKX account, for example after a trade placed by hand on the same coin. Review the positions, then resume.
- An order was skipped as too small
- OKX sets a minimum order size for each market. Raise the amount per order in your strategy card.
OKX questions
Can TradeCorgi withdraw from my OKX account?
No. A key with withdrawal permission is rejected when you connect it and on every daily check. Your funds stay on your OKX account.
Why does OKX ask for a passphrase?
OKX protects each API key with a passphrase you choose when you create it. TradeCorgi needs the key, the secret and the passphrase to connect, and stores all three encrypted.
Can I use OKX from India?
No. OKX is not registered with India's Financial Intelligence Unit, so TradeCorgi does not show it to users in India. Indian users can connect Binance or Bybit.
Is OKX available in the United States?
No. OKX's global exchange does not serve US users, so TradeCorgi does not show it there. US users can connect Coinbase or Kraken.
Can agents trade OKX futures or margin?
No. Agents trade spot only, with no leverage, on every exchange.
Why use TradeCorgi instead of the OKX Agent Trade Kit?
The Agent Trade Kit is a developer tool for one exchange. TradeCorgi adds limits checked before every order, a reason for each trade, backtests with fees, and agents across exchanges, without code.
Does TradeCorgi earn anything from OKX?
OKX may pay TradeCorgi a share of trading fees when you open an account through our links. It never changes your fees and never changes how your agents trade.