OKX serves a few months of fills through its API. SetupBook can read them with a read-only key, so your USDT perpetual swaps and spot trades arrive in your journal without any typing. OKX has one extra step that other exchanges lack: you invent a passphrase when you create the key, and SetupBook needs it too. It takes about five minutes.

This guide shows each step with pictures. For how every platform connects, read the overview of all connections. If you also trade on Bitget, which uses a passphrase too, see the Bitget guide.

Before you start

  • A SetupBook account with Pro. Connecting a platform is part of Pro, and every journal starts with 14 days of it: start 14 days free.
  • An OKX account. In some regions OKX asks for at least 100 USD in assets before it lets you create a key.
  • A place to write down the passphrase, such as a password manager.
  • Five minutes.

The key only reads. You tick Read and leave Trade and Withdraw off. SetupBook never places an order and never moves money. It stores the key and the passphrase sealed on the server and uses them to read your fills.

1. Open the API page and create a key

On the OKX website go to your profile, choose API and connections and press Create API key. In the app the path is Menu, then API, then Create API key.

The form asks for an API name (call it SetupBook), the permissions, an optional IP address allowlist and a passphrase.

A drawing of the OKX Create API key form with the API name, the passphrase field and the Read box ticked while Trade and Withdraw are left off
Create API key: a name, a passphrase of your own, Read ticked, Trade and Withdraw off.

2. Tick Read and nothing else

Under Permissions tick Read. Leave Trade and Withdraw off, and leave any other box that appears (for example transfer) off too. OKX says a key with only Read can show your account data but cannot place orders.

IP restriction: leave the allowlist empty. We cannot give you a fixed address to allow yet. If you want one, ask us through the feedback form under the connections. With a read-only key nothing can be traded or withdrawn either way. OKX deletes keys that can trade and have no IP address after 14 days without use; that rule does not touch a read-only key.

3. Choose a passphrase and copy the key

Type a passphrase of your own. OKX keeps only a scrambled version of it, so it cannot be shown again: if you lose it, delete the key and make a new one. Confirm with your security check. OKX then shows the API key and the secret key. Copy the key, the secret and the passphrase into a safe place.

4. Paste all three into SetupBook

In SetupBook open Accounts β†’ Connections and press Add connection. Choose OKX and leave Environment on Live. Paste the key into API key, the secret into API secret and the passphrase into Passphrase.

Under Markets tick what you trade: USDT perpetual swaps and Spot. OKX needs no list of pairs. Leave Into account on Create from the platform account, or pick one of yours, and press Check the key and connect.

SetupBook's OKX connection dialog with the API key, secret and passphrase fields and the markets highlighted
Accounts β†’ Connections β†’ Add connection β†’ OKX. Three fields: key, secret, passphrase.

SetupBook proves the key by reading your balance. OKX does not tell a key's permissions to the key itself, so SetupBook cannot warn you if you ticked Trade by mistake. Look at the key's permissions on OKX once to be sure.

5. Watch the first sync

The first sync starts at once and reaches about three months back, as far as OKX serves. When it finishes, the connection shows Active, the time of the last sync and the number of trades. After that SetupBook looks for new fills every hour, and you can press Sync now at any moment.

An OKX connection card in SetupBook with the status Active highlighted and the last sync time and trade count
Active status, last sync and trade count after the first sync.

What you get:

  • Positions, not loose fills. Fills are grouped into positions the same way as the file import, so a position closed in three parts is one trade with three exits.
  • Locked fields. Symbol, side, times, prices, size, fees and the net result come from OKX and stay exact (they feed your net P&L). Plan, setup quality, mistakes, notes and screenshots stay yours.
  • Time zone. OKX times are UTC, so there is nothing to set.
  • Not included. Coin-margined (inverse) contracts and funding payments are not read.

Older than three months? That history has to come in as a file. If you can export it from OKX as a CSV, the import's Other CSV option maps its columns: see the import guide.

Demo Trading

OKX Demo Trading has its own keys. On OKX open Trade β†’ Demo Trading, go to Personal Center and create a key under Demo Trading API. In SetupBook choose Demo in the Environment box and paste that key with its passphrase. Its trades land in a Demo account. A demo key works only with Demo selected.

Replacing a key

Open the connection's menu, choose Edit and press Replace the key. Paste the new key, secret and passphrase and save: SetupBook checks them, forgets the old ones and uses the new ones from the next sync. The trades stay.

Problems

What you see Why What to do
OKX, Bitget and KuCoin keys need their passphrase The passphrase field is empty Paste the passphrase you typed when you created the key
The exchange rejected the key A wrong passphrase, a mistyped secret, or a demo key with Live selected Check all three values, and check the Environment box
You forgot the passphrase OKX cannot show it again Delete the key on OKX, make a new one and use Replace the key
Spot trades are missing Spot is not ticked Edit the connection and tick the market
Swap trades are missing The contract is coin-margined Coin-margined contracts are not supported yet
Trades are older than three months The API does not serve them Import a CSV of the older history with Other CSV

Trouble connecting? Write to us from the connections page with what you tried. We answer by email within 30 minutes, every day.

Frequently asked questions

Is it safe? Can SetupBook trade or withdraw?

No. A key with only Read cannot place an order or withdraw, and SetupBook has no code that tries. The key and the passphrase are stored sealed on the server and are never sent to your browser. To stop, delete the key on OKX and the connection stops.

Why does SetupBook need the passphrase?

OKX signs every request with the passphrase as well as the key and the secret. Without it OKX rejects the request. You chose the passphrase yourself when you made the key.

Do I need to restrict the IP address?

No. Leave the allowlist empty. We cannot give you a fixed address to allow yet; if you want one, ask us in the feedback form. A read-only key cannot trade or withdraw with or without an IP rule.

Which OKX markets are read?

USDT perpetual swaps and spot. Coin-margined contracts and funding payments are not read yet.

Does it cost anything?

Connecting is part of Pro. Every journal starts with 14 days of Pro, and nothing is charged in those 14 days. Cancel before they end and you stay on the free plan, which keeps manual entry.

Prefer a file? The import still works: see the user guide. To connect another exchange, read the KuCoin guide.