How to create a safe OKX API key for a trading bot
Last updated: 2 December 2026
A trading bot needs an API key to place orders on your OKX account. Set up properly, that key can trade but can never move money out of your account, and it only works from one server. This guide shows how, and what to check before you hand a key to anyone.

Don't have a OKX account yet? Create one with our referral link. Hytyde may earn a commission from OKX. It costs you nothing.
What a safe key looks like
- Trading on, withdrawals off. A bot never needs to withdraw. A key that can withdraw is a key that can empty your account if it leaks.
- Locked to one IP address. The key only works from the bot's server, so a copied key is useless anywhere else. On OKX it also keeps the key alive: trading keys without an IP address are deleted after 14 days without use.
- Only the permissions the bot needs. For a futures bot that's Read and Trade. Nothing else.
OKX keys come with three parts: the API key, the secret key and a passphrase you choose. A bot needs all three. Whoever runs the bot should never ask for your password, your two-factor codes, or a key with withdrawals switched on. If they do, stop there.
Before you start
- Consider a sub-account. On OKX, open Sub-accounts and create a standard one for the bot. It keeps the bot's trades separate from yours and makes its results easy to follow.
- Choose a futures account mode. In Settings → Account mode, choose a mode that can trade perpetual futures, such as Single-currency margin. The basic Spot mode can't trade perpetuals.
- Check the position mode the bot needs. In Settings → Position mode, OKX offers Long/short mode (OKX's name for hedge mode) and Buy/sell mode (one-way). Choose what the bot asks for, with no positions open.
- Move the USDT the bot will trade with into the account's Trading account (Assets → Transfer).
If you use a sub-account, create the key for that sub-account, so it belongs to the account the bot trades on.
Create the key
- Go to Profile → API keys and click Create API key.
- Choose API trading and give the key a name you'll recognise, such as the bot's name.
- Choose a passphrase and write it down somewhere safe. OKX won't show it again, and the bot needs it.
Set its permissions
- Tick Read and Trade.
- Leave Withdraw unticked.
- In the IP address field, enter the IP address of the bot's server. The bot's provider should give you this.
- Confirm, and complete OKX's security check.
OKX then shows the new API key and secret key. Copy the secret now: OKX only shows it once. If you lose the secret or the passphrase, delete the key and make a new one.
Check it before you use it
Look at the key under API keys and confirm:
- Its permissions are Read and Trade, with no Withdraw.
- It shows the IP address you entered.
A good bot provider checks this too when you connect the key, and refuses a key that can withdraw.
Keep it safe
- Paste the key, secret and passphrase only into the bot's own connection page, never into a chat, an email or a support ticket. No genuine support team needs them.
- Store them nowhere else. If you need to connect again, make a new key.
- Delete keys you no longer use under API keys. If you stop a bot, delete its key too.
- If you think a key has leaked, delete it straight away. Deleting a key stops it at once; your funds stay where they are.
Common problems
- The key disappeared: it had no IP address and wasn't used for 14 days. Create a new key with the bot server's IP.
- The bot says the key is invalid: check the secret and passphrase were copied exactly, with no spaces, that the IP is the bot server's address, and that the key belongs to the account the bot trades on.
- The bot can't open trades: make sure the USDT is in the Trading account, the account mode can trade perpetuals, and the position mode matches what the bot asks for.
Hytyde's bots connect with exactly this kind of key, trade-only and locked to our server, and we check it when you connect. You can see every bot's daily results, good days and bad, on the Futures Bots page.
Trading crypto futures can lose you money, including more than you expect when leverage is used. Past results don't guarantee future results. This article is general information, not financial advice.
Comments
No comments yet.