For Agents
Place and cancel orders on OKX, read account balances and positions, and pull market data for spot, futures, swaps, and options.
Jentic One is a self-hosted execution layer for AI agents. It lets your agent call the OKX API, or any other public or private API you need. You set the rules, the agent never sees your credentials, and every call is logged.
# On the machine that will host your Jentic One instance:
curl -fsSL https://raw.githubusercontent.com/jentic/jentic-one/main/tools/install.sh | sh# On the machine where your agent runs (keep this separate from the instance):
curl -fsSL https://raw.githubusercontent.com/jentic/jentic-one/main/tools/install.sh | sh
jentic register # connects your agent to your Jentic One instanceJentic One is in public beta. The setup above keeps your agent separate from the instance, which is what you want before using real credentials: an agent running as the same OS user as Jentic One can read its stored keys directly. Just evaluating? A single local install is fine to start. See the secure deployment guide for the tiers.
What an agent can do with OKX API API.
Place limit, market, and conditional orders across spot, margin, futures, and swaps
Cancel single or batched open orders by order ID or client-supplied ID
Read account balance, positions, and position-risk per instrument
Pull live ticker, order-book depth, and candlestick history for any symbol
GET STARTED
Use for: I need to place a limit buy order for BTC-USDT on OKX, Cancel all open orders for ETH-USDT-SWAP, Get my current OKX account balance, Retrieve open positions on perpetual swaps
Not supported: Does not handle fiat on-ramps, custody outside OKX, or NFT marketplace operations — use for OKX exchange trading, account, and market data only.
Jentic publishes the only available OpenAPI document for OKX API, keeping it validated and agent-ready.
Jentic publishes the only available OpenAPI specification for OKX API, keeping it validated and agent-ready. OKX (formerly OKEx) is one of the largest cryptocurrency exchanges, and this v5 REST API covers trading, market data, account management, funding, and public data for spot, margin, futures, perpetual swaps, and options. Forty-nine endpoints expose order placement and cancellation, balance and position reads, market depth, candlesticks, and funding transfers — enough to build a full trading or analytics integration.
Transfer funds between trading and funding accounts and to sub-accounts
List supported instruments and trading-fee rates per account tier
Patterns agents use OKX API API for, with concrete tasks.
★ Algorithmic trading execution
Execute a trading strategy on OKX by placing, amending, and cancelling orders programmatically. The trade endpoints accept a clOrdId so each order has a stable client-side reference, and the position-risk endpoint feeds the strategy's risk module. Latency-sensitive setups should pair this REST surface with OKX's WebSocket feeds for live market data.
Place a limit buy order for 0.1 BTC-USDT at a specified price and confirm the order ID returned by the exchange
Portfolio monitoring and reporting
Pull balances, open positions, and recent fills to feed a portfolio dashboard or daily P&L report. The account/balance, account/positions, and account/bills endpoints together give a complete picture of holdings, mark-to-market exposure, and historical activity. A scheduled job can compile this into a CSV or BI table within seconds.
Fetch the current balance, open positions, and the last 24 hours of bills, then compile a daily P&L summary
Market-data analytics
Quants and researchers pull candlesticks, ticker, and order-book depth from OKX to backtest strategies and build market-microstructure analytics. The market-data endpoints expose multiple resolutions (1m to 1D) and venue-side ticker fields like 24h volume that are critical for liquidity modelling.
Pull 30 days of 1-hour candles for BTC-USDT and compute the realised volatility
Sub-account treasury automation
Funds and prop desks operating multiple OKX sub-accounts use the asset transfer endpoints to rebalance USDT and BTC between them, and the funding endpoints to move funds between trading and funding wallets. This automates routine treasury tasks that previously required manual UI clicks per sub-account.
Transfer 1000 USDT from the funding account to the trading account and confirm the transfer reference
AI agent crypto assistant via Jentic
An AI agent acting as a crypto-trading assistant uses Jentic to call OKX without holding the four-header signed-request scheme directly. The agent searches Jentic for an intent like 'place an OKX limit order', loads the schema, and executes — Jentic handles the API key, secret signing, timestamp, and passphrase headers from the encrypted vault.
Search Jentic for 'OKX place order', load the schema, and execute a limit buy order for a user-specified instrument and amount
49 endpoints — jentic publishes the only available openapi specification for okx api, keeping it validated and agent-ready.
METHOD
PATH
DESCRIPTION
/api/v5/trade/order
Place an order
/api/v5/trade/cancel-order
Cancel an order by orderId
/api/v5/account/balance
Get account balance
/api/v5/account/positions
List open positions
/api/v5/account/bills
List recent account bills and fills
/api/v5/account/instruments
List instruments tradable on the account
/api/v5/account/account-position-risk
Get position risk per instrument
/api/v5/trade/order
Place an order
/api/v5/trade/cancel-order
Cancel an order by orderId
/api/v5/account/balance
Get account balance
/api/v5/account/positions
List open positions
/api/v5/account/bills
List recent account bills and fills
Three things that make agents converge on Jentic-routed access.
Credential isolation
OKX requires four signed headers per request. Jentic stores the API key, secret, and passphrase encrypted in the vault and computes the OK-ACCESS-SIGN HMAC at request time, so the agent never holds the raw secret or passphrase.
Intent-based discovery
Forty-nine endpoints across trading, account, market-data, public-data, and funding require careful navigation. Agents search Jentic by intent (for example 'place a limit order') and Jentic returns the right /api/v5/trade/order operation with parameter typing intact.
Time to first call
Direct integration including HMAC signing, four-header construction, sub-account auth, and rate-limit handling: 2-3 days. Through Jentic: under 1 hour.
Alternatives and complements available in the Jentic catalogue.
Binance API
World's largest crypto exchange API with similar trading, account, and market-data scope
Choose Binance for the deepest spot liquidity globally; choose OKX for derivatives features like options and unified-account trading.
Kraken API
Established US-and-EU-friendly crypto exchange with a similar REST surface
Use Kraken for regulated US/EU access and fiat on-ramps; use OKX for broader derivatives coverage.
Bybit API
Derivatives-focused crypto exchange API directly comparable to OKX swaps and options
Choose Bybit when the focus is perpetual swaps with simpler unified accounts; choose OKX when options and structured products are needed.
Specific to using OKX API API through Jentic.
Why is there no official OpenAPI spec for OKX API?
OKX does not publish an OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call OKX API via structured tooling. It is validated against the live API and kept up to date. Get started at https://app.jentic.com/sign-up.
What authentication does the OKX API use?
OKX uses an API key with four signed headers: OK-ACCESS-KEY, OK-ACCESS-SIGN (HMAC-SHA256 of the request payload), OK-ACCESS-TIMESTAMP, and OK-ACCESS-PASSPHRASE. Through Jentic, the secret and passphrase are stored encrypted in the vault and the signature is computed at request time, so the agent never holds the raw secret.
Can I place a perpetual swap order with the OKX API?
Yes. POST to /api/v5/trade/order with instId set to a swap symbol (for example BTC-USDT-SWAP), tdMode set to cross or isolated, and the order side, type, and size. The same endpoint handles spot, margin, futures, swaps, and options — instId determines the instrument.
What are the rate limits for the OKX API?
OKX applies per-endpoint rate limits, typically expressed as N requests per 2 seconds per UID or IP. Limits vary — order-placement endpoints are more constrained than read-only market-data endpoints. Response headers include the remaining quota; back off on 429.
How do I cancel all open OKX orders through Jentic?
Search Jentic for 'OKX cancel orders', load the schema for the cancel-orders operation, and execute with instId or a list of orderIds. The endpoint accepts batched cancellations, so a single call clears the open book for one symbol.
Does the OKX API support sub-accounts?
Yes. The funding endpoints support transfers between sub-accounts and the parent account. Each sub-account has its own balances and positions, queryable via the standard /api/v5/account endpoints when authenticated as that sub-account.
Can I read market depth from the OKX API?
Yes. The market-data endpoints expose tickers, candlesticks at multiple resolutions, and order book depth. For real-time updates beyond REST polling, OKX offers WebSocket feeds — pair them when latency matters.
/api/v5/account/instruments
List instruments tradable on the account
/api/v5/account/account-position-risk
Get position risk per instrument