A Complete Step-by-Step Guide for Beginners
OKX is one of the world’s largest cryptocurrency exchanges — and one of the most bot-friendly platforms available today. Its API system is robust, well-documented, and designed with automated trading in mind.
This guide walks you through everything you need to do to create an API key on OKX and connect it to your BitcoinEra bot — safely, correctly, and without any prior technical experience.
If you’re new to the concept of API keys entirely, we recommend quickly reading our [What Is an API Key →] explanation before diving in. If you already understand the basics — let’s get started.
What Makes OKX Slightly Different
OKX has a few unique characteristics worth knowing before you begin:
- OKX uses a three-part credential system — API Key, Secret Key, and a Passphrase that you create yourself. This is different from Binance and Bybit which only use two parts.
- The Passphrase is not generated by OKX — you choose it yourself, like a password
- OKX’s permission system is slightly more detailed than other exchanges
- OKX supports both Unified Account and Classic Account structures — the process is the same for both
The three-part system actually makes OKX one of the more secure exchanges for API-based trading — the extra Passphrase adds an additional layer of protection.
Before You Start — What You’ll Need
- ✅ A verified OKX account (identity verification completed)
- ✅ Two-Factor Authentication (2FA) enabled on your OKX account
- ✅ A BitcoinEra account with a bot selected and ready to connect
- ✅ A Passphrase ready — think of a unique phrase you’ll remember and store securely
- ✅ About 10 minutes of uninterrupted time
💡 Don’t have an OKX account yet? Go to okx.com and complete the registration and identity verification process first. API keys cannot be created without a verified account.
The Golden Rules — Read Before You Touch Anything
🔒 Never enable withdrawal permissions on any trading bot API key
🔒 Never share your API Key, Secret Key, or Passphrase with anyone
🔒 Create a separate API key for each bot you run
🔒 Store your Passphrase in a password manager — it cannot be recovered if lost
Step-by-Step: Creating Your OKX API Key
Step 1 — Log In to Your OKX Account
Go to okx.com and log in with your email and password. Complete your 2FA verification when prompted.
Make sure you’re in your main account — not a demo or sub-account — unless you specifically intend to run the bot in a sub-account environment.
Step 2 — Navigate to API Management
Once logged in, click on your profile avatar or icon in the top right corner of the screen.
From the dropdown menu, select “Account” to go to your account settings page.
On the account settings page, look for the “API” option in the left-hand sidebar. Click on it.
You can also navigate directly to: okx.com/account/my-api
Step 3 — Click “Create API Key”
On the API Management page, click the “Create API Key” button.
OKX will ask you to choose what the API key is for. You’ll see options like:
- Trading — for automated trading bots and algorithmic systems
- Read only — for portfolio tracking apps that only need to view data
Select “Trading” — this is the correct option for connecting a bot through BitcoinEra.
Step 4 — Name Your API Key
Enter a descriptive name for your API key. This label is only for your own reference and helps you identify which key belongs to which bot later.
Good examples:
BitcoinEra_GridBotOKX_TrendRider_2024BitcoinEra_Bot1
Pick something clear and specific — you’ll thank yourself later when managing multiple keys.
Step 5 — Create Your Passphrase
This is the step that makes OKX unique. You need to create a Passphrase — a custom security phrase that acts as an additional password for your API key.
Your Passphrase should:
- Be at least 8 characters long
- Include uppercase and lowercase letters
- Include at least one number
- Include at least one special character
- Be completely unique — not used anywhere else
Examples of strong Passphrases:
OKX$Bot#2024SecureTr@ding!Safe99
⚠️ Critical: Save your Passphrase immediately in your password manager. OKX cannot recover it for you if you forget it. If you lose your Passphrase, you’ll need to delete this key and create a new one.
Type your Passphrase into the field and confirm it by typing it again.
Step 6 — Set the API Key Permissions
Now comes the most important security step — choosing exactly what this API key is allowed to do.
OKX gives you granular control over permissions. Here is exactly what to enable and what to leave off:
✅ Enable these permissions:
- Read — allows the bot to view your balance, positions and trade history
- Trade — allows the bot to place and cancel orders on spot markets
❌ Leave these disabled:
- Withdraw — NEVER enable this. Under any circumstances. For any reason.
- Transfer — not needed for bot trading
- Earn — not needed
- Sub-account transfer — not needed
🔒 The withdrawal permission is the one that matters most. With it disabled, no funds can ever leave your OKX account through the API — no matter what happens.
Step 7 — Set IP Restriction (Recommended)
OKX allows you to lock your API key to specific IP addresses — meaning the key can only be used from locations you approve.
You’ll see an “IP Restriction” field where you can enter one or more IP addresses.
If your bot runs from a dedicated server with a fixed IP: Enter that server’s IP address here. This is the most secure configuration possible.
If your bot runs from a home computer or a location with a changing IP: Leave this field empty for now. You can add IP restrictions later once you have a stable setup.
Step 8 — Complete Security Verification
Before OKX creates your API key, you’ll need to verify your identity. This typically involves:
- Email verification — a 6-digit code sent to your registered email address
- 2FA verification — a code from your Google Authenticator or Authy app
- Phone verification — an SMS code if you have phone 2FA enabled
Enter all required codes and click “Confirm”.
Step 9 — Save Your Three Credentials Immediately
After verification, OKX will display your newly created API credentials. Unlike Binance and Bybit, OKX gives you three pieces of information to save:
API Key — a long alphanumeric string generated by OKX Secret Key — another long alphanumeric string generated by OKX Passphrase — the custom phrase you created in Step 5
⚠️ CRITICAL: The Secret Key is shown ONLY ONCE. It cannot be viewed or recovered after you close this screen.
Do this right now before anything else:
- Copy the API Key and paste it into your password manager
- Copy the Secret Key and paste it alongside the API Key
- Add your Passphrase to the same entry
- Label it clearly — for example: “OKX API — BitcoinEra GridBot”
- Double-check all three are saved correctly
- Only then close or proceed past this screen
Losing any one of these three credentials means you’ll need to delete this key and start over.
Step 10 — Connect Your OKX API Key to BitcoinEra
With all three credentials safely saved, it’s time to connect them to your bot.
Here’s how:
- Log in to your BitcoinEra dashboard
- Navigate to the bot you’ve selected from the catalog
- Click “Connect Exchange” or “Add API Key”
- Select OKX from the exchange dropdown menu
- Paste your API Key into the first field
- Paste your Secret Key into the second field
- Enter your Passphrase in the third field
- Click “Connect” or “Save”
BitcoinEra will immediately verify the connection by attempting to read your OKX account balance. A green confirmation message means everything is working correctly.
Verifying That the Connection Is Working
After connecting, check the following in both platforms:
In your BitcoinEra dashboard:
- Your OKX balance is visible and shows the correct amount
- The bot status shows as “Connected” or “Active”
- No error messages are displayed anywhere on the page
In your OKX API Management page:
- The API key shows a recent “Last Used” timestamp
- No unexpected or suspicious access attempts are logged
Troubleshooting Common OKX API Errors
“Invalid API Key” or “Authentication Failed”
- Check that you copied all three credentials correctly — API Key, Secret Key, and Passphrase
- Make sure there are no extra spaces before or after any of the values
- Verify that the key type was set to “Trading” when created
- Try disconnecting and reconnecting in BitcoinEra
“Wrong Passphrase” error
- This means the Passphrase you entered in BitcoinEra doesn’t match what you set when creating the key
- Go back to your password manager and copy the Passphrase carefully
- Note that Passphrases are case-sensitive — check for capitalization errors
- If you’ve genuinely forgotten your Passphrase, delete the key and create a new one
“Insufficient permissions” error
- Go to OKX API Management and click on your key to edit it
- Verify that both “Read” and “Trade” permissions are enabled
- Save the updated permissions and try connecting again
“IP address not authorized” error
- You’ve added IP restrictions but the bot’s server IP isn’t on the approved list
- Go to API Management, edit the key, and add the correct IP address
- Or remove the IP restriction temporarily while you identify the correct IP
“This feature is not available in your region”
- OKX has geographic restrictions in some countries
- If you’re in a restricted region, OKX may limit API functionality
- Check OKX’s official list of supported countries and regions
Secret Key or Passphrase is lost
- Neither can be recovered once the screen is closed
- Go to OKX API Management and delete the existing key
- Create a brand new key following this guide from Step 3
- Reconnect the new credentials in your BitcoinEra dashboard
How to Delete an OKX API Key
If you want to stop a bot, rotate your credentials, or disconnect from OKX entirely:
- Go to okx.com/account/my-api
- Find the API key you want to remove
- Click the “Delete” or “Revoke” button next to it
- Complete security verification (email + 2FA)
- The key is immediately invalidated
Your OKX account and all your funds remain completely unaffected. The bot simply loses its ability to place trades — nothing else changes.
Quick Reference — Correct OKX API Permissions
| Permission | Should Be Enabled? |
|---|---|
| Read | ✅ Yes |
| Trade | ✅ Yes |
| Withdraw | ❌ Never |
| Transfer | ❌ No |
| Earn | ❌ No |
| Sub-account transfer | ❌ No |
Summary
Here’s everything we covered in this guide:
- What makes OKX unique — the three-part credential system with a custom Passphrase
- How to navigate to OKX API Management
- How to create a Trading API key with the correct settings
- How to create a strong, secure Passphrase
- Which permissions to enable and which to never touch
- How to save all three credentials safely before closing the screen
- How to connect your OKX API key to BitcoinEra
- How to troubleshoot the most common OKX connection errors
⚠️ Risk Disclaimer: Trading cryptocurrencies involves significant risk of financial loss. Never enable withdrawal permissions on any API key connected to a trading bot. Past performance of any trading bot does not guarantee future results. Never invest more than you can afford to lose.