Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

OKX API Key Doesn't Exist? Here Are All the Fixes That Actually Work

You set up your trading bot, pasted in the API key, hit connect — and bam. "API key doesn't exist." Cool. Very cool.

This error has killed the vibe of more than a few traders who were ready to automate their OKX strategy. The frustrating part is that the key is right there in your account settings. It exists. You can see it. So why is OKX telling you otherwise?

Good news: there are a handful of known causes for this error, and every single one of them has a fix. Let's walk through them.


Why Does "OKX API Key Doesn't Exist" Happen?

Before diving into fixes, it helps to understand what's actually going on. When your bot or script calls OKX's API and gets back error 50119 — "API key doesn't exist" — it usually means one of the following:

  • The API key isn't reaching the right OKX server
  • The key was created for the wrong account type
  • Time sync between your machine and OKX's servers is off
  • The account doesn't meet the minimum requirements to use an API key
  • The key's permissions don't match what the request is trying to do

None of these are bugs in OKX's system. They're all configuration issues — which means they're all fixable.


Fix 1: EEA Users — Switch to my.okx.com

This one catches a lot of European traders off guard. If you're in the European Economic Area (EEA) and you're connecting to www.okx.com, you'll get the "API key doesn't exist" error — even if your key is perfectly valid.

Why it happens: OKX routes EEA users to a separate subdomain for regulatory compliance. API keys created on that subdomain only work on that subdomain.

The fix: Change your bot or trading software's base URL from www.okx.com to my.okx.com. This applies to both REST and WebSocket connections.

If you're using a third-party bot like Bitsgap, Cryptohopper, or Gunbot, check their OKX connection settings for a region or subdomain selector. Most of them have an option for EEA mode.


Fix 2: Your Account Needs at Least $100 AUM

This is an underdocumented requirement that trips people up constantly. OKX requires a minimum Assets Under Management (AUM) balance of $100 USD before you can create a working API key.

If your account balance is below $100 — or if you're trying to create an API key for a sub-account that doesn't meet this threshold — the key may appear to be created successfully, but it won't actually work when called.

The fix: Deposit or transfer funds so the account (or sub-account) has at least $100 in assets, then try recreating the API key. This applies to both master accounts and sub-accounts individually.

👉 Fund your OKX account and get started with a 20% fee rebate


Fix 3: Real Account Key on a Demo Account (or Vice Versa)

OKX has two separate environments: the live trading environment and the simulated trading (demo) environment. API keys from one do not work in the other.

If you're testing a bot in demo mode but copied your live API key — that's your problem. Same issue applies if you created a demo key and are now trying to connect to your real account.

The fix: Make sure your API key was created for the same environment you're connecting to. In OKX, when creating an API key, you'll see an option to specify whether it's for the live account or the simulated trading account. Match them up.


Fix 4: Time Synchronization Is Off

OKX requires that all API requests include a timestamp, and that timestamp must be within 30 seconds of OKX's server time. If your local machine's clock is out of sync, every request will fail — and you'll often see an error about an expired timestamp alongside or instead of "API key doesn't exist."

The fix:

  1. Check your system clock — make sure it's synced with an NTP server
  2. On Linux/Mac: run ntpdate -u pool.ntp.org or enable automatic time sync
  3. On Windows: go to Settings → Time & Language → Sync now
  4. In your code: use OKX's /api/v5/public/time endpoint to get the server's current timestamp, and offset your requests accordingly

Most API libraries (like ccxt) handle this automatically, but if you're building something custom, it's worth double-checking.


Fix 5: Check API Key Permissions

An API key with the wrong permissions won't throw a "wrong permissions" error — it'll often just fail silently or give you a cryptic response that looks like the key doesn't exist.

OKX API keys have three permission levels:

Permission What It Allows
Read View account info, balances, order history, bills
Trade Place orders, cancel orders, transfer funds between accounts
Withdraw Initiate withdrawals (enable only if absolutely necessary)

If your trading bot needs to place orders but the key only has Read permission, it won't work as expected.

The fix: Go to your OKX account → API → edit the key → enable the permissions your bot actually needs. For most trading bots, you need Read + Trade. Only enable Withdraw if you have a specific reason.


Fix 6: Recreate the Key Without IP Binding (For Initial Testing)

When you create an API key, OKX lets you bind it to specific IP addresses. This is great for security — but if you enter the wrong IP, the key will be rejected for any request coming from a different IP.

If you're not sure whether your server's IP is correct (or if it changes dynamically), your key will intermittently fail or fail completely.

The fix for testing: Create a new API key without IP binding, connect it to your bot, and verify the connection works. Once it does, add your server's IP address to the allowlist for security.

Note: API keys without IP binding that have Trade or Withdraw permissions will automatically expire after 14 days of inactivity. If you've had a key sitting around unused, it may have expired. Recreate it.


Step-by-Step: Creating an OKX API Key That Actually Works

Here's the full process to create a working API key from scratch, avoiding all the common pitfalls:

  1. Log into OKX and make sure your account has $100+ in assets
  2. Go to Profile → API (top-right menu)
  3. Click Create API key
  4. Fill in:
    • Name: Something descriptive like "MyBot-Main"
    • Account type: Live trading (or simulated — must match your bot's environment)
    • Purpose: Trading
    • IP allowlist: Leave blank for testing; add your server IP after confirming it works
    • Permissions: Enable Read + Trade (add Withdraw only if needed)
    • Passphrase: Create a strong passphrase — you'll need this alongside the API key and secret
  5. Save the API Key, Secret Key, and Passphrase — the secret is only shown once
  6. Connect to your bot using all three credentials

If you're an EEA user, set your bot's base URL to my.okx.com before connecting.

👉 Open an OKX account and trade with a 20% commission rebate


OKX Trading Fee Tiers (What You're Working With)

Once your API is connected and your bot is running, the fees you pay matter — a lot, especially for high-frequency strategies. Here's how OKX's fee structure breaks down:

Spot Trading Fees

Level Qualification Maker Fee Taker Fee
Regular Default 0.08% 0.10%
VIP 1 $100K+ assets OR $50M+ 30-day volume 0.07% 0.09%
VIP 2 Higher thresholds 0.06% 0.08%
VIP 3+ Increasing thresholds Continues declining Continues declining
VIP 8 High volume/assets −0.005% (rebate) 0.015%

Futures Trading Fees

Level Maker Fee Taker Fee
Regular 0.02% 0.05%
VIP 1 0.01% 0.03%
VIP 8+ Negative (rebate) ~0.015%

OKX's VIP tier system rewards high-volume traders with progressively lower — and eventually negative — maker fees. Negative maker fees mean OKX actually pays you for providing liquidity. For algo traders running market-making strategies, this is significant.

The fee structure was updated in late 2025 and early 2026, with OKX expanding to 9 VIP tiers and introducing separate fee frameworks for EEA and U.S. users.

👉 Sign up for OKX and get 20% off trading fees


Using OKX API with Third-Party Tools

Most popular trading tools support OKX out of the box. Here's what to know for each:

ccxt (Python/Node.js)

The ccxt library handles most of the tricky stuff automatically — timestamp sync, request signing, error parsing. If you're getting "API key doesn't exist" through ccxt, the most common cause is the EEA subdomain issue.

Set the base URL explicitly: python exchange = ccxt.okx({ 'apiKey': 'YOUR_KEY', 'secret': 'YOUR_SECRET', 'password': 'YOUR_PASSPHRASE', # OKX requires the passphrase 'hostname': 'my.okx.com', # For EEA users })

freqtrade

freqtrade users have reported error 50119 primarily due to the subdomain issue and the simulated vs. live account mismatch. In your config.json, make sure "dry_run": false if you're using a live key, and set the exchange URL appropriately.

Hummingbot, Cryptohopper, Bitsgap

These platforms typically have a dedicated OKX integration page where you enter your key, secret, and passphrase. If you're EEA-based, look for a region setting in the OKX connector — most updated versions of these platforms now include it.


Quick Diagnostic Checklist

Run through this before anything else:

  • Account balance is $100+ USD
  • API key was created for the correct environment (live vs. demo)
  • Connecting to my.okx.com if in EEA, www.okx.com otherwise
  • System clock is synced (time difference < 30 seconds)
  • Key has the right permissions (Read + Trade for most bots)
  • Passphrase is included in connection (OKX requires all three: key, secret, passphrase)
  • Key hasn't expired (14-day inactivity limit for unbound keys with trade permissions)
  • IP allowlist is correct (or blank for testing)

If you check all of these and the error persists, try deleting the key and creating a brand new one from scratch. There have been rare cases where a key gets into a broken state during creation, and a fresh key resolves it immediately.


Final Thoughts

The "OKX API key doesn't exist" error sounds dramatic but it's almost always one of a small set of fixable issues. The EEA subdomain switch and the $100 minimum balance requirement account for the majority of cases — check those two first and you'll probably be done in five minutes.

OKX's API itself is solid. Once it's connected properly, you get access to REST and WebSocket endpoints covering spot, futures, options, and more — all for free. The rate limits are generous for most strategies, and the documentation (at docs.okx.com) is thorough if you're building something custom.

Get it connected, verify the fix with a simple balance read call, and then you're off to the races.

👉 Start trading on OKX with a 20% fee rebate using invite code CASH20

About

OKX API Key Doesn't Exist? Here Are All the Fixes That Actually Work

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors