Getting started with OKX on Autoview
By the end of this guide your OKX account is connected to Autoview, all three credentials are in place, and you've fired one real test order and cancelled it. That last part matters. A dry run tells you your syntax parses. Only a live order tells you the whole chain works.
OKX trades both crypto spot and futures, and one detail trips up almost every new connection: OKX hands you three credentials, not two. Get the third one wrong and nothing connects.
What Autoview does
Autoview executes through a webhook running on our servers. It's on around the clock, and it's source-agnostic: TradingView is one alert sender, but a TrendSpider alert, a Python script, or your own cron job can POST to the same hook. You give Autoview API keys for OKX, an incoming alert fires a command, and Autoview places the order on OKX. No browser needs to be open for that to happen.
There's also a Chrome extension that connects directly to TradingView alerts and runs while your computer and Chrome are on. The setup below works for both. The command syntax differs by one parameter, and I'll flag it where it does. Compare them side by side on the platforms page.
OKX is retiring USD spot pairs (read this before you connect)
OKX is replacing most of its -USD spot pairs with -USDC ones. The new Crypto-USDC instruments go live at 8:00 UTC on September 23, 2026, and run in parallel with the old -USD pairs for a week. At 8:00 UTC on September 30, 2026, OKX delists the affected -USD pairs for good, except USDT-USD, which stays. OKX states plainly that strategy orders, trading bots, and API programs on the affected pairs stop being able to place orders once that happens, so any alert still sending a -USD spot symbol after September 30 will fail.
Here's the part that will actually trip people up. Once a pair delists, OKX starts displaying the new -USDC instrument under its old -USD name on OKX's own web and app interface. BTC-USDC shows up as BTC-USD. So if you look at OKX for "OKX's own instrument code," the way the next section of this guide tells you to, you'll see BTC-USD and be tempted to type exactly that into Autoview. That fails too, because Autoview resolves your s= symbol against OKX's real instrument ID, not what OKX's interface displays for it. After September 30, use the -USDC code for these pairs, not the label OKX shows you.
One more step if you've never traded a -USDC pair on OKX before: OKX requires a one-time account activation before it lets you trade any Crypto-USDC instrument. Do that once in the OKX app or site before pointing an Autoview alert at a -USDC symbol. It isn't shared between a master account and its sub-accounts, so if you run both, activate each one separately.
The good news is this needs nothing from Autoview's side. Autoview reads OKX's live instrument list and refreshes its cache every 15 minutes, so a new -USDC pair becomes tradable through Autoview within 15 minutes of listing on September 23. Update the s= symbol in your alert to the new instrument code, and you're set.
Try OKX Demo Trading first
Before you touch your live account, connect OKX's own Demo Trading environment instead. It runs on simulated funds, the setup and command syntax are identical to live OKX, and a mistake there costs nothing. This is the recommended starting point for anyone new to Autoview on OKX, not an optional detour.
Demo Trading is a compatibility requirement, not a cosmetic setting. OKX distinguishes a demo request from a live one with a header, x-simulated-trading: 1, sent on every simulated-trading API call. Autoview handles that header for you, but only if you route the command to the right place: on the webhook platform, create (or point) the webhook at the OKX Demo connection rather than your live OKX connection, and Autoview sends the header automatically. On the extension, swap e=okx for e=OKXDEMO (or the equivalent e=OKX-DEMO):
| Live OKX (extension) | OKX Demo (extension) |
|---|---|
e=okx s=BTC-USDT b=buy t=limit p=-5% q=1 | e=OKXDEMO s=BTC-USDT b=buy t=limit p=-5% q=1 |
Get that routing wrong in either direction and the mismatch is the whole problem: forget to switch to e=OKXDEMO (or the Demo connection) and a "test" order hits your live account; try to run a live command through the demo route and it never touches real money at all. Treat the connection you pick as part of the command, the same way the instrument code and the price are.
Demo Trading uses its own API key, separate from your live key. On OKX's site, go to Trade > Demo Trading > Personal Center > Demo Trading API, and create a key there. It hands you the same three fields as a live key -- API Key, Secret Key, Passphrase -- and Autoview's OKX Demo connection takes them in the same three fields as the live one. Grant Read and Trade permissions, same as live. Skip Withdraw here too; demo funds have nothing to withdraw, but the habit is the same one you're building for the live key, so carry it over rather than treating demo as a place where the rule doesn't apply.
OKX's account mode and position mode settings are account-wide, not separate per environment, so check them inside Demo Trading specifically before you place anything. Confirm which account mode you're in (Spot, Futures, Multi-currency margin, or Portfolio margin), since order types and margin behavior depend on it. If you're testing a futures command, also set the position mode to Long/Short on the demo account the same way the common error messages guide describes for live OKX -- a mismatched position mode rejects the order in demo exactly the way it does live, which is useful: it's one more thing a clean demo run confirms before you touch real funds.
Once a demo order fires and cancels cleanly, you've confirmed your credentials, your routing, your instrument code, and your position mode all line up, before any of it runs against real money.
Create your API key on OKX
API keys are the credentials that let Autoview place orders on your account without ever touching your password. You generate them inside OKX, not inside Autoview. OKX keeps its own walkthrough current, so create the key there: OKX API management. Their full API reference lives at OKX API docs.
When OKX creates the key, it asks you to set a passphrase. Write it down. This is the single most common reason an OKX connection fails: the passphrase is a value you set on the API key itself, it is not your account login password, and it is case-sensitive. OKX will not show it to you again.
Two permission rules are non-negotiable:
- Grant Read and Trade permissions. Autoview needs Read to verify the connection and Trade to place and cancel orders. Without Trade, nothing executes.
- Never grant Withdraw permission. No automation strategy needs it, and a key that can't move funds off the exchange is a key that can't drain your account if it leaks.
OKX also lets you whitelist IP addresses, so a key only works from an address you approve. On the webhook platform that address is the zone your signals run from. OKX deletes keys with no whitelisted IP after a period of inactivity, so if you trade rarely, either whitelist an IP or expect to recreate the key. Contact support for the zone address before you whitelist.
OKX shows the Secret Key once, at creation. Copy the API Key, the Secret Key, and your passphrase somewhere safe before you leave that screen. Paste them into a plain note first so no stray spaces sneak in.
Add the keys to Autoview
OKX asks for three fields, and Autoview's form matches them one to one. Enter them exactly as OKX gave them:
- Passphrase: the value you set when creating the key. Not your account password.
- API Key: the public half OKX displays.
- Secret Key: the private half OKX shows only once.
Open the OKX configuration in your Autoview account, paste all three fields, and save. Name the key if you plan to run more than one OKX key; on the webhook platform a clear name is what lets you wire it to a specific webhook later. Watch for the confirmation that the account connected.
Fire a test order on live OKX, then cancel it
This is the live-account equivalent of the Demo Trading round trip above, and it's the step people skip once they've already seen a clean demo run. Don't skip it. A demo fill proves your syntax and your routing against simulated funds; it doesn't prove your live credentials, live permissions, or live account mode are set up the same way, so run this once on live OKX too, at a controlled size, before you let a real signal fire unattended.
A real warning before you send anything: OKX commands hit your live account. Trade a size at or above OKX's minimum for the instrument, and place a limit order far enough from the market that it won't fill while you're testing.
Start with a dry run. Add d=1 to any command and Autoview parses it, shows you exactly what it would have done, and sends nothing to OKX. Get a clean dry run before you send a live one.
OKX uses hyphen-separated instrument codes in the s= symbol. Spot is BTC-USDT, a perpetual swap is BTC-USDT-SWAP, a dated future is BTC-USDT-240329. TradingView's {{ticker}} returns BTCUSDT with no hyphens, so don't pipe it straight into s=; use OKX's own instrument code, meaning the real instId, not whatever OKX's interface happens to display for a pair (see the USD/USDC note above, effective September 30, 2026). A limit buy 5% under the market looks like this:
- Extension:
e=okx s=BTC-USDT b=buy p=-5% q=1 - Webhook:
s=BTC-USDT b=buy p=-5% q=1
The only difference is e=okx, which tells the extension which exchange to route to. On the webhook platform the webhook already knows its exchange, so you leave it out.
The example hard-codes a price offset and a quantity, which is what you want for a controlled test. In real use you'll often want a live value instead. A TradingView alert can write one in: p={{close}} tells TradingView to substitute the candle's close at fire time, and Autoview just receives the number. The {{close}} token is TradingView's, not Autoview's. The alert sender supplies the value, so a Python script or another platform builds the same command its own way and posts a plain number where {{close}} would sit.
Fire it, then open the Autoview log and your OKX orders. You should see the resting limit order in both. Now cancel it:
- Extension:
e=okx s=BTC-USDT c=order - Webhook:
s=BTC-USDT c=order
Order placed, order cancelled, both confirmed in the log and on OKX. That's the full round trip. Your setup works.
That same cancel is how you change a resting order later, since Autoview cannot edit an open OKX order in place; changing an open OKX order from an alert walks through cancel, then place again.
Go live
Connected and tested? Good. A couple of OKX-specific notes before you let real signals run.
OKX futures orders can reject if your account's position mode doesn't match what the order implies, and the fix is to set the position mode to Long/Short on OKX. The reasons and the exact steps live in the common error messages guide. Check it if a futures order comes back rejected.
Most other first-run problems are one of three things. Invalid credentials almost always means a typo on paste or a key created without Trade permission. An authorization error usually means the passphrase is wrong, and the usual culprit is typing the account password instead of the API-key passphrase. If OKX rejects the order itself, the error in your log comes straight from OKX, often because the quantity sat below the instrument's minimum.
When a command behaves oddly, put d=1 back on it. The dry-run output is the fastest way to see what Autoview thinks you asked for versus what you meant. Next you'll want stop-loss, take-profit, and trailing parameters layered onto these same commands, which is where the automation gets interesting.