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.

Full List of Integrations

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.

DataWhere to read itSource on OKX
Account & walletsaccount.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 one entry in account.wallets[] (wallet.name null), and the funding account is a second entry (wallet.name "Okx Funding Account") whenever it holds a balance or has ledger history — key on wallet.id. OKX Earn holdings (Simple Earn flexible and On-chain Earn) are part of the main wallet's balances.
Balances / positionsaccount.balances[]Per-asset balances on each wallet (balance.wallet). Each balance has ticker, amount, decimals and fiat_value (USD). In the main wallet asset_type is "crypto", "staked" for OKX Earn holdings, or "cash_equivalent" for non-USD fiat (e.g. EUR); funding-wallet balances are "crypto". An Earn holding is its own balance next to the tradable balance of the same coin: it keeps the base ticker, carries provider_ticker with a .staked suffix and a name ending in "(earn)" (e.g. ticker BTC, provider_ticker BTC.staked, name "Bitcoin (earn)"). No ticker_address — exchange holdings are identified by ticker.
TransactionsGET /accounts/:id/transactionsMain wallet: trades, Convert / Simple trade, deposits / withdrawals (on-chain, and internal transfers with other OKX users), and the trading account's other ledger entries (transfers, conversions, fees). Funding wallet: the funding-account ledger — Earn subscriptions / redemptions and rewards, fiat deposits / withdrawals, transfers between OKX accounts, airdrops, rebates and referral rewards. tx.wallet says which wallet an activity belongs to. OKX credits deposits to the funding account and Vezgo reports them on the main wallet; a move between the funding and trading accounts appears on both wallets (transfer_out on one, transfer_in on the other). See "How to read a transaction" below.
Assets / securitiesbalance.tickerIdentified 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). Amounts are positive; direction carries the sign. A spot trade carries one part per OKX bill on the order — two (base + quote) for a single fill, more when the order filled in several executions — and a Convert / Simple trade has two. Every other activity, including token conversions and fiat orders, has one part. Trade part amounts are balance changes (OKX's balChg), so the fee is already deducted from the leg it was charged on, and a maker rebate is already added to its leg.
  • Type — transaction_type is trade, deposit, withdrawal, staking / unstaking (Earn subscriptions / redemptions), reward, bonus or other. transaction_subtype refines it: buy / sell on a trade (on a spot trade they follow the pair's base currency — buy = base received), or trade_crypto for Convert, Simple trade and token conversions; fiat_deposit / fiat_withdrawal and transfer_in / transfer_out (moves between OKX accounts) on ledger deposits / withdrawals; staking_reward / interest_income / income_reward on a reward; distribution / rebate / referral_bonus on a bonus; fees / refund / cancel on other. Some activities carry no subtype, including on-chain deposits / withdrawals and Earn subscriptions / redemptions.
  • Fees — fees[] holds a trade's fee or a withdrawal's network fee: the native fee asset and amount, with fiat_value in USD. On a trade it is informational: the parts already reflect the fee, and a maker rebate sits in its leg. On a withdrawal it is charged on top: the part is the amount sent and the network fee comes on top of it, so deduct the fee from the balance of the asset in fees[].ticker. The funding ledger can also book that network fee as its own transaction (origin_type withdrawal-fee, other / fees): match it to its withdrawal by coin, fee amount and time, and count the fee once. Other fee entries in the ledgers (e.g. interest deductions, funding fees) are their own transactions too (transaction_type other, subtype fees), with the fee as their part.
  • misc.origin_id is the OKX order id (ordId) for a trade — Convert and Simple trade legs, which share no order id, use the received leg's bill id — the transaction hash (txId) for an on-chain deposit / withdrawal, OKX's own id for an internal transfer (deposit-<depId> / withdrawal-<wdId>), and the bill id (billId) for every other ledger entry. misc.origin_type is Vezgo's label for the activity: buy-trade / sell-trade / convert / deposit / withdrawal, or the ledger entry's type (e.g. earn-subscription, staking-yield, transfer-to-trading). Trades also carry misc.order_id, misc.bill_id, misc.trade_id and misc.origin_pair (the OKX instrument, e.g. BTC-USDT); ledger entries carry OKX's bill type code in misc.funding_bill_type, or misc.trading_bill_type with misc.trading_bill_subtype. Deposits / withdrawals carry the destination in parts[].to_address — an on-chain address, or an OKX account identifier for an internal transfer. There is no from_address and no top-level transaction_hash.
  • Older rows — crypto deposits and withdrawals imported up to October 2, 2026 keep their earlier form: a withdrawal's part amount is negative (its direction is sent), internal transfers share an empty misc.origin_id and can be merged into one transaction, an unpriced coin carries its coin amount as fiat_value, and some failed or cancelled withdrawals are still listed.
// One Vezgo transaction = an OKX activity (a trade carries its legs as parts)
const wallet = tx.wallet;              // account.wallets[].id — the main wallet or the funding wallet
const id     = tx.misc.origin_id;      // ordId (trades), billId (convert, ledger entries), txId (on-chain deposits/withdrawals)
                                       // or deposit-<depId> / withdrawal-<wdId> (internal transfers)
const kind   = tx.misc.origin_type;    // buy-trade, sell-trade, convert, deposit, withdrawal, or a ledger type

const type    = tx.transaction_type;   // trade | deposit | withdrawal | staking | unstaking | reward | bonus | other
const subtype = tx.transaction_subtype;// buy | sell | trade_crypto | fiat_deposit | transfer_in | staking_reward | …
const parts   = tx.parts ?? [];        // spot trade = one per bill (2 for a single fill); convert = 2; else 1
const fees    = tx.fees ?? [];         // trade fee (already in the parts) or withdrawal network fee (on top: deduct it)

// Deposits/withdrawals: destination is parts[].to_address; an on-chain one's hash is misc.origin_id (txId).
// Ledger entries carry OKX's bill type code in misc.funding_bill_type or misc.trading_bill_type.
// A move between the funding and trading accounts appears on both wallets.
Where to read itAttributesWhat it is
tx.parts[]direction, ticker, provider_ticker, amount, fiat_value, to_addressValue movement. A spot trade has one part per OKX bill on the order (2 for a single fill); a Convert / Simple trade has 2; every other activity has 1. to_address (destination) is present only on deposits / withdrawals; there is no from_address.
tx.transaction_type · transaction_subtypetrade / deposit / withdrawal / staking / unstaking / reward / bonus / other · buy, sell, trade_crypto, fiat_deposit, fiat_withdrawal, transfer_in, transfer_out, staking_reward, …Normalized classification — prefer these over the raw misc.origin_type. buy / sell follow a spot trade's base currency; Earn subscriptions / redemptions are staking / unstaking, and staking-yield payouts are reward / staking_reward.
tx.fees[]ticker, amount, fiat_valueTrade fee or withdrawal network fee — the native fee asset and amount, with fiat_value in USD. A trade's fee is already in its parts (informational); a withdrawal's network fee is charged on top of its part — deduct it. That network fee can also arrive as a funding-wallet withdrawal-fee transaction: match the two by coin, amount and time, and count it once. Other ledger fee entries are their own transactions (other / fees).

misc.origin_type is Vezgo's label for the OKX activity: buy-trade / sell-trade / convert / deposit / withdrawal, or the ledger entry's type for everything else (an unlisted OKX bill type surfaces as funding-<code> or trading-<code>, with transaction_type other). Always classify off transaction_type. Common values:

  • buy-trade
  • sell-trade
  • convert
  • deposit
  • withdrawal
  • trading-transfer
  • transfer-to-trading
  • transfer-from-trading
  • fiat-deposit
  • fiat-withdrawal
  • earn-subscription
  • earn-redemption
  • staking-subscription
  • staking-redemption
  • staking-yield
  • withdrawal-fee
  • airdrop

Supported

  • Crypto and fiat balances in the main (trading) and funding wallets
  • OKX Earn holdings — Simple Earn (flexible) and On-chain Earn — as staked balances in the main wallet
  • Trades (each trade carries its legs as parts)
  • Convert and Simple trade (transaction_subtype trade_crypto)
  • Deposits and withdrawals — on-chain, internal OKX transfers and fiat
  • Earn subscriptions / redemptions and staking rewards from the funding-account ledger
  • Transfers between OKX accounts, airdrops, rebates and referral rewards
  • 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; transfers to and from sub-accounts appear as transfer_in / transfer_out.
  • On the first sync, trades and other trading-account entries go back 3 months (the window OKX serves for that ledger); the funding-account ledger goes back to February 2021.
  • Crypto deposits and withdrawals (on-chain and internal transfers) are imported once completed: a deposit once OKX has credited it, a withdrawal once it has succeeded. Fiat deposits and withdrawals come from the funding ledger, where a cancelled fiat withdrawal appears as the withdrawal plus its cancel entry (transaction_type other, subtype cancel).
See the full Vezgo object reference

Try to connect to OKX in our Demo Sandbox

Open Demo

Let's get you started

To get your API Keys, sign up on the portal or reach out to the team at sales@vezgo.com

You have questions? Contact us