Master the complete process of connecting your OKX account through API integration—covering setup steps, data scope, troubleshooting tips, and key limitations. Whether you're tracking spot trades, derivatives, or staking rewards, this guide ensures seamless data synchronization for accurate portfolio management and tax reporting.
Setting up your OKX API connection is straightforward. Follow these steps to create and configure your API credentials:
Log in to your OKX account and navigate to the user icon in the upper-right corner.
From the drop-down menu, select API.
Click "+ Create APIs" and enter a descriptive name for your API key (e.g., "blockpit" or "portfolio-tracker").
Keep "API trading" as the purpose.
For now, skip IP whitelisting to avoid connection issues.
Grant the API key "Read" permissions only—this ensures secure, view-only access to your transaction history.
Important: Enter "Blockp!t1" as the passphrase (or choose your own secure passphrase and store it safely).
Select "Submit all" and complete the Two-factor authentication prompt.
Click "Show info" to reveal your API key and Secret. Copy both immediately—the Secret is displayed only once and cannot be recovered later.
To import your data into your tracking platform, create a new Integration and paste your API key and Secret into the designated fields. Confirm by clicking Create.
Critical limitation: OKX only provides the transaction history of the last 3 months via API. To maintain a continuous record, avoid deleting your integration after the initial setup. For older transactions, you'll need to manually import historical data using CSV files or Excel templates.
Your complete transaction history forms the foundation of accurate portfolio tracking and tax reporting. API integration automates this process, but it's important to understand what's included and what requires manual handling.
✅ Deposits & Withdrawals – Full history of funds moving in and out
✅ Fee Payments – Trading fees and transaction costs
✅ Spot Market Trades – Standard buy/sell orders (last 3 months only via API)
✅ Converts – Direct crypto-to-crypto swaps (last 3 months only via API)
✅ Derivative Trades PnL – Profit, loss, fees, and funding (last 1 year only via API)
✅ Airdrops, Bounties, Hard Forks – Free token distributions
✅ Earn (EU) – On-chain Earn products only
✅ Earn (non-EU) – Simple Earn, On-chain Earn, Lending
Important time restrictions:
⏱️ Spot Market Trades & Converts older than 3 months are not available via API and must be imported manually or via Excel template.
⏱️ Derivative Trades older than 1 year are not available via API and require manual import or template upload.
If you're serious about crypto portfolio management and tax compliance, having a reliable platform that seamlessly integrates with exchanges like OKX makes all the difference. Modern tracking solutions can automatically pull your trade history, calculate gains, and generate tax-ready reports—saving you hours of manual work.
👉 Start tracking your OKX portfolio automatically with 20% off fees forever
❌ Margin Trades – These require manual import
❌ Buy Crypto via Card (Express buy) – Card purchases must be added manually
If a transaction type isn't available via API, you can still add these records manually or by migrating your CSV data into an Excel template.
✅ Complete import scope – Your current balances across all OKX accounts are fully synced via API.
If your synced balance appears incomplete or doesn't match your exchange dashboard, reach out to your platform's support team. In most cases, technical limitations can be resolved with updates to the integration.
If you encounter issues with your OKX integration, follow this systematic approach:
Always start here:
Before analyzing any issues, synchronize all integrations using "Sync All" in your dashboard, then recalculate your transaction data. Many problems resolve automatically after a fresh sync.
Product updates don't automatically affect existing transaction data (to protect your historical records from unexpected changes). Creating a fresh integration often resolves import issues.
Recommended approach: Temporarily create a second integration to compare results, then delete the one you don't want to keep. This ensures you can verify data accuracy before committing to changes.
Alternatively, you can re-synchronize missing or incorrectly imported transactions—but be careful to avoid creating duplicate entries.
Unlabeled transactions can disrupt your portfolio calculations. You can:
Assign appropriate labels to individual transactions
Merge related transactions into Trades or Transfers by selecting transaction pairs
Use bulk edit to update multiple similar transactions at once
Incorrect or duplicate transactions can cause discrepancies. Review your transaction list and:
Edit incorrect data (amounts, dates, transaction types)
Exclude irrelevant transactions from calculations
Delete confirmed duplicates
If the API didn't capture all your activity (especially for data older than 3 months), you can:
Add transactions individually through your platform's interface
Upload historical data using an Excel template designed for your tracking platform
Setting up OKX API integration streamlines your crypto portfolio management by automating transaction imports for deposits, withdrawals, trades, and earnings. While the 3-month limitation for spot trades and 1-year limit for derivatives requires some manual work for historical data, maintaining an active integration ensures continuous tracking going forward. For anyone managing significant crypto activity, OKX's read-only API permissions offer a secure and efficient way to maintain accurate records for tax reporting and portfolio analysis.
👉 Get started with OKX using referral code SUPER20OFF for permanent 20% fee reduction