If you're tracking your crypto trades for tax purposes or portfolio management, you'll need to connect your exchange account via API. This guide walks you through getting your OKX API key step-by-step—so you can automatically sync your transaction history without manual uploads. Plus, when you sign up with referral code SUPER20OFF, you'll get a permanent 20% fee reduction on all trades.
Before diving into the API setup, here's what you should know about OKX's data limitations:
Supported Transaction Types:
Spot trading history
Futures and perpetual swaps
Earning products (staking, savings)
Distribution records
Important Limitations:
Margin trading: "Borrow" and "repay" records aren't available via API. You'll need to upload these manually using a custom file format.
Shark Fin products: As of March 31, 2025, API doesn't provide enough data for "Shark Fin" and "Seagull" features, so these transactions can't be automatically imported.
Time Period Restrictions:
Distribution history: Available from February 1, 2025 onward
Other transactions: Only the past 3 months are accessible
Important: You need to re-sync your API manually at least once every 3 months, or older transactions will disappear from the available data
Think of it this way—OKX's API is like a rolling window that only shows recent activity. If you wait too long between syncs, some transactions will fall off the edge.
If you're serious about maximizing your trading efficiency while minimizing costs, 👉 Join OKX with SUPER20OFF and enjoy permanent 20% off on all trading fees—it's one of the easiest ways to keep more of your profits.
Getting your API key takes about 5 minutes. Here's how:
Step 1: Access API Settings
Log into your OKX account, click your profile icon in the top right corner, and select "API" from the dropdown menu.
Step 2: Create a New API Key
Click the "Create V5 API key" button. (Make sure you're creating a V5 key, not an older version—V5 is the current standard.)
Step 3: Configure Your API Settings
This is where you set up the security parameters:
API Type: Select "API trading"
API Name: Give it a descriptive name (like "Portfolio Tracker" or "Tax Tool")
Passphrase: Create a passphrase you'll remember—you'll need this later
IP Allowlist (Optional but Recommended): Add these IP addresses for enhanced security:
52.69.115.51
52.193.138.38
18.179.74.94
Permissions: Select "Read" only—this ensures the API can view your transaction history but can't execute trades or withdrawals
Click "Confirm"
Step 4: Two-Factor Authentication
You'll need to verify via:
Email code (sent to your registered email)
Authentication app code (from Google Authenticator or similar)
Enter both codes and click "Confirm".
Step 5: Save Your Credentials
OKX will display three critical pieces of information:
API Key
Secret Key
Passphrase (the one you created)
Write these down immediately. The secret key is only shown once—if you lose it, you'll need to create a new API key from scratch.
Once you have your API credentials, here's how to sync them:
Navigate to your crypto tax or portfolio tracking platform's exchange connection page
Select OKX from the list of supported exchanges
Enter your three credentials:
API Key
Secret Key
Passphrase
Click "Submit" to initiate the first sync
After the initial sync, your transaction history will be automatically imported. However, for new transactions going forward, you'll need to manually click the "Sync" button to update your records.
For traders who want the most cost-effective exchange experience, 👉 Sign up for OKX with code SUPER20OFF to secure your permanent 20% trading fee discount—it makes a real difference when you're actively trading.
A quick word about API safety: Always use read-only permissions when connecting to third-party platforms. This means your API key can only view transaction data—it can't place trades, make withdrawals, or change account settings.
If you're ever unsure about a platform's security, check whether they allow IP whitelisting and require only read permissions. These are standard safety features.
Getting your OKX API key is straightforward—just remember to re-sync at least every 3 months to avoid missing transaction data. For margin trading and Shark Fin products, you'll need to manually upload those records using custom file formats.
If you haven't signed up for OKX yet, using referral code SUPER20OFF gives you a permanent 20% fee reduction—one of the best ways to optimize your trading costs over the long term. Whether you're tracking for taxes or managing a portfolio, having clean, complete transaction data makes everything easier.