
Connect to OKX via Vezgo API
Accounts
Positions
Transactions
Support for Accounts, Positions and Transactions enabled.
Support for Positions & Balances:
- Spot
- Staking (beta)
Supported Transaction Types:
- Spot: deposits/withdrawals, converts, and trades (last 3 months only available in the OKX API).
Additional Notes:
- There are no limitations for deposits/withdrawals and convert trades.
- Trade fills are limited to the last 3 months in the OKX API.
Data mapping
A field-level guide to the Vezgo API data for OKX — what each attribute means and where to read it — so you can map it into your own system.
| Data | Where to read it | Source on OKX |
|---|---|---|
| Account & wallets | account.wallets[] | OKX connects via OAuth — one-click authorization with a read-only scope (no API keys, no wallet address). Existing API key + secret + passphrase connections remain supported. The main trading account is surfaced as one entry in account.wallets[] (key on wallet.id); when OKX Earn (staking) is active, the staked positions appear in a separate staking wallet (wallet.name "Okx Staking Account"). |
| Balances / positions | account.balances[] | Per-asset balances on the OKX account. Each balance has ticker, amount, decimals and fiat_value (USD). asset_type is "crypto", "staked" for OKX Earn staking (provider_ticker carries a .staked suffix, e.g. ticker ETH, provider_ticker ETH.staked), or "cash_equivalent" for non-USD fiat (e.g. EUR). No ticker_address — exchange holdings are identified by ticker. |
| Transactions | GET /accounts/:id/transactions | Trades, crypto-to-crypto convert, and deposits / withdrawals from the OKX account. A trade (and a convert) carries its two legs (base + quote) as parts. See "How to read a transaction" below. (Staking positions are balances only — no staking transactions are imported.) |
| Assets / securities | balance.ticker | Identified by ticker (e.g. BTC, ETH). No ticker_address — custodial exchange balances are not on-chain tokens. |
How to read a transaction
Each OKX activity maps to a Vezgo transaction. Read the value movement from parts[], and classify with transaction_type / transaction_subtype:
- Value movement — parts[] (direction sent/received, ticker, provider_ticker, amount, fiat_value in USD). A trade and a convert each have two parts (the base leg + the quote leg); deposits and withdrawals have one part.
- Type — transaction_type (trade / deposit / withdrawal) with transaction_subtype: buy / sell on a trade, and trade_crypto on a crypto-to-crypto convert. Deposits and withdrawals carry no subtype.
- Fees — fees[] (the trade or network fee; fiat_value in USD, plus the native fee asset and amount). Crypto-to-crypto converts carry no fee, so fees[] is empty.
- misc.origin_id is the OKX order/trade id for trades and converts, or the on-chain transaction hash (txId) for deposits / withdrawals. misc.origin_type is OKX's raw activity type (buy-trade / sell-trade / convert / deposit / withdrawal). Trades also carry misc.order_id; on-chain deposits / withdrawals carry the destination in parts[].to_address. There is no from_address and no top-level transaction_hash.
// One Vezgo transaction = an OKX activity (a trade carries its two legs as parts)
const id = tx.misc.origin_id; // order/trade id (trades & converts) or on-chain txId (deposits/withdrawals)
const kind = tx.misc.origin_type; // raw OKX type (buy-trade, sell-trade, convert, deposit, withdrawal)
const type = tx.transaction_type; // trade | deposit | withdrawal
const subtype = tx.transaction_subtype;// buy | sell (trade) | trade_crypto (convert)
const parts = tx.parts ?? []; // trade / convert = 2 legs (base + quote); deposit / withdrawal = 1
const fees = tx.fees ?? []; // trade / network fee (fiat_value in USD)
// On-chain deposits/withdrawals: destination is parts[].to_address; the hash is misc.origin_id (txId).
// OKX has no from_address and no top-level transaction_hash, and no staking transactions.| Where to read it | Attributes | What it is |
|---|---|---|
tx.parts[] | direction, ticker, provider_ticker, amount, fiat_value, to_address | Value movement. A trade and a convert have 2 legs (base + quote); deposits / withdrawals have 1. to_address (destination) is present only on on-chain deposits / withdrawals; there is no from_address. |
tx.transaction_type · transaction_subtype | trade / deposit / withdrawal · buy, sell, trade_crypto | Normalized classification — prefer these over the raw misc.origin_type. Subtypes: buy / sell on a trade, trade_crypto on a convert; deposits / withdrawals carry no subtype. |
tx.fees[] | ticker, amount, fiat_value | Trade / network fee — the native fee asset and amount, with fiat_value in USD. |
misc.origin_type is OKX's raw activity type. Always classify off transaction_type. Common values:
- buy-trade
- sell-trade
- convert
- deposit
- withdrawal
Supported
- Crypto and fiat balances
- OKX Earn staking positions (asset_type staked, separate wallet)
- Trades (each trade carries its two legs as parts)
- Crypto-to-crypto convert (transaction_subtype trade_crypto)
- Deposits and withdrawals (with destination to_address)
- USD fiat valuation for balances and transactions
Notes & limitations
- Balances are the exchange's reported (custodial) holdings — there is no on-chain wallet address.
- Only the main OKX account is covered — sub-accounts are not included (the read-only OAuth scope excludes sub-account modules).
- Transactions carry the destination parts[].to_address on on-chain deposits / withdrawals but no from_address; the on-chain hash is in misc.origin_id (txId) and there is no top-level transaction_hash.
- Values are USD; fiat_value can be 0 when a USD rate is unavailable.
Try to connect to OKX in our Demo Sandbox
Open DemoLet's get you started
To get your API Keys, sign up on the portal or reach out to the team at sales@vezgo.com