---
id: document_item.connecting-to-the-okx-exchange
page_type: documentation_article
title: "Connecting to the OKX exchange"
description: "How to connect the OKX exchange to Moonbot: create API keys, activate the spot and futures accounts, configure the terminal settings."
section: documentation
category: "Settings Button / “Settings → Login” Tab"
url: https://moonbot.eu/en/documentation/settings-login-tab/connecting-to-the-okx-exchange?format=md
locale: en
alternate_ru: https://moonbot.eu/documentation/settings-login-tab/connecting-to-the-okx-exchange?format=md
alternate_zh: https://moonbot.eu/zh/documentation/settings-login-tab/connecting-to-the-okx-exchange?format=md
parent: https://moonbot.eu/en/documentation/settings-login-tab?format=md
previous: https://moonbot.eu/en/documentation/settings-login-tab/connecting-to-the-hyperliquid-exchange?format=md
next: null
status: published
updated_at: 2026-11-14T00:19:43+03:00
---

# Connecting to the OKX exchange

Before using Moonbot as a terminal for OKX, we recommend that you register an account on the OKX exchange via our referral link:🔗 [https://okx.com/join/JOINMOONBOT](https://okx.com/join/JOINMOONBOT)

Anyone who registers via this link will automatically receive 20% cashback on spot and futures trading, and the option to activate a free one-month trial of the PRO version.

Once you have activated the PRO version using Moonbot’s referral link, you will have access to the following bonuses:

- **OKX’s auto-purchase option for tokens**;
- The **MoonHook** Strategy;
- A tool for emulating prices on a chart using the **Pencil**;
- **Module for monitoring graphs in separate windows**;
- The **Moon Kernel** module – a client-kernel mode designed to speed up manual trading.

If your OKX exchange account was registered via a different referral link, you can re-register it with our referral programme. To do this:

1. Please follow this link: [https://www.okx.com/ul/J6l2R5](https://www.okx.com/ul/J6l2R5)
2. In the "**Invite Code**" field, enter the code: **JOINMOONBOT**
3. In the "**Reason for joining**" field, please enter: "**I would like to become a Moonbot referral**" and you will be transferred within 24 hours.

Moonbot, as a trading terminal for OKX, supports trading on both the spot and futures markets.

When using the Moonbot trading terminal for OKX on a dedicated server, it is best to select the "Japan" (Tokyo) location for the best ping.

The terminal is activated for OKX via the Moon Credits window (instructions are provided below), and this requires 500 Moon Credits - both for activating the main account and for activating each subsequent subaccount. Moon Credits are available only to users of the PRO version of Moonbot. Before activating OKX, you must have the PRO version of the Moonbot trading terminal activated for trading cryptocurrencies on any other exchange.

### Instructions on how to create an API key on OKX for Moonbot

Once you have logged into your OKX account and completed the verification process:

1\) In your account settings, click on "**API and connections**" and, on the "**API and connections**" page, click on "**+ Create API key**".

![](https://moonbot.eu/storage/editor-images/01%20API%20OKX%20eng.jpg)

![(dark)](https://moonbot.eu/storage/editor-images/01%20API%20OKX%20eng.jpg)

2\) The “**OKX API Agreement**” window will appear: By continuing, you confirm that you've read, understood and agree to be bound by the OKX API Agreement. Click the **Continue** button.

3\) The page "**Create API keys**" will open; here, you need to fill in the fields and tick the relevant boxes.

![](https://moonbot.eu/storage/editor-images/03%20API%20OKX%20eng.jpg)

![(dark)](https://moonbot.eu/storage/editor-images/03%20API%20OKX%20eng.jpg)

- **Basic info**

**API key name** – enter any name you like for the API Key, for example **MOONBOT**

**Account** – when creating an API key on the main account, this field will display "**Main account**"; when creating an API key on a sub-account, it will say "**Sub-account**".

**Used for** should be left as  **API trading.**

- **Permissions**

The **Read** tick box is selected by default; please also tick the **Trade** tick box. \
**You need at least 100 USD in total assets** to create API keys with Trade or Withdraw permissions.

**Markets -** tick the boxes for **Spot & Margin** and **Perpetual.**

**Crypto** – click on the "**+ Add**" button; in the new window, click on "**Select all**" and then click on the **Confirm** button below.

- **Security**

**Trusted IP addresses**: if the slider is enabled, a field will appear for adding up to 20 IPv4 or IPv6 addresses, separated by commas or spaces, from which trading may take place. If the slider is disabled, a warning will be displayed stating that anyone with this API key can exercise all permissions from any device or network. Keys with more than Read permissions **expire after 14 days of inactivity**, **unless they’re linked to an IP address**.

**Passphrase** for using API keys in the Moonbot terminal: you must always enter the following in this field: **Okx!00000.**

Once you have finished entering your API key details, click the **Submit All** button.

Next, complete all the necessary verification steps to create an API key (enter the security codes and complete the identity verification).

Once you have completed these steps, the API keys will have been successfully created.

On the "**API and Connections**" page, a row will appear showing the API keys you have created. In the **Actions** column on the right, click the **Details** button to view the **API key** and **Secret key**, click on **View credentials**, complete the security procedures, and the **API key and Secret key fields will appear with asterisks**; click on the **eye icon** to reveal the API key details.

![](https://moonbot.eu/storage/editor-images/04%20API%20OKX%20eng.jpg)

![(dark)](https://moonbot.eu/storage/editor-images/04%20API%20OKX%20eng.jpg)

![](https://moonbot.eu/storage/editor-images/05%20API%20OKX%20eng.jpg)

![(dark)](https://moonbot.eu/storage/editor-images/05%20API%20OKX%20eng.jpg)

⚠️ **Important!** Save your **API key** and **Secret key** in a text file on a USB stick or write them down on paper — you’ll need these keys to register them in the Moonbot terminal (under the **Settings → Login** tab).

Each main account and sub-account may contain **up to 50 active API keys**.

### Instructions on how to connect OKX to the Moonbot terminal

1. Create API keys for your main account or sub-account on the OKX exchange website. **The account balance must show assets worth at least 100 USD;**
2. Please ensure that your trading funds have been transferred from the "**Funding**" to the "**Trading**". If there are no funds in the “Trading”, the Moonbot terminal will be unable to connect to the exchange, and errors such as “**Get full balance: ERROR RestBalance:**" and "**Last Error: RestBalance:**".
3. Copy the folder containing your main PRO terminal for another exchange into a new folder and run the copy of the terminal in administrator mode so that you can then configure it as the terminal for OKX;
4. Go to **Settings → Login**, in the **Exchange** field, select **OKX Spot** (for spot trading) or **OKX Futures** (for futures trading) and click the **Apply** button;
5. In the **Settings → Login** section, register the OKX API keys for your main account or sub-account;
6. In the bottom-right corner of the Moonbot terminal’s main window, click on the text **PRO version** to open the **Moon Credits** window, which contains the activations for the paid modules (see the figure below);
7. In the Moon Credits window, the lower section displays the balance of your Moon Credits; activating the main account or one subaccount requires 500 Moon Credits; if the balance is sufficient, in the **Activate API Key** block click the **Activate for 500 Credits** button - the API keys will then be activated on this terminal for trading cryptocurrencies on the OKX exchange;
8. If you need to activate additional sub-accounts on the same exchange, repeat the procedure as many times as necessary.

![](https://moonbot.eu/storage/editor-images/MoonCredits_W-eng.jpg)

![(dark)](https://moonbot.eu/storage/editor-images/MoonCredits_B-eng.jpg)

### Key points to note when using the OKX exchange

To connect the terminal to the OKX exchange and ensure it works correctly, please note the following points:

1. **The OKX exchange has its own token – OKB** – but the exchange’s fees are not charged in OKB. The base rates (for example, 0.08% for makers and 0.1% for takers on the spot market) apply regardless of OKB holdings. However, OKB token holders can receive a discount on trading fees – of up to 40% off the base rate. In other words, the token is not a source of fees, but serves as a tool to reduce them;

   How this works in practice: if you hold OKB in your account, the exchange will apply a discount to the standard fee when you place a trade. And the more tokens you hold, the more substantial the discount can be. Furthermore, OKB discounts can be combined with other mechanisms – for example, by advancing to a higher tier in the VIP programme through high trading volume.

   Information on fees for the OKX exchange: [https://www.okx.com/fees](https://www.okx.com/fees)

   If you have sub-accounts, your fee tier will be determined by the combined 30-day trading volume and daily asset balance across all main and sub-accounts. Each account will enjoy the same fee tier benefits. If you create a new sub-account, your fee tier benefits for that account will take effect at 16:00 (UTC).

   Users are classified into standard and VIP tiers based on their deposit total or trading volume over the previous 30 days. A user’s tier determines their trading fees for the following trading day.

   Your fee tier for OKX trading instruments is calculated according to various criteria. If you meet the criteria for more than one tier, the terms of the highest tier will apply to you. For example, if your 30-day spot trading volume is 5,000,000 USD (corresponding to VIP Level 2), and your 30-day futures trading volume is 10,000,000 USD (corresponding to VIP 3), you will receive VIP 3 commission rates for all instruments.
2. "**Hedge mode**" is supported in the terminal (**except for Portfolio margin**). If you need to switch to “Hedge mode”, the exchange has the following requirement: “**you may switch modes, but only if you have no open positions or orders**”. When the position mode is changed (**Hedge mode ON / Hedge mode OFF**), the terminal recalculates the leverage – on OKX, this depends on the account type.
3. **API limits**: OKX does not return remaining quota balances in the headers, meaning the Moonbot terminal cannot see how much of the limit is left. Order limits are calculated separately for each instrument, plus an overall cap of 1,000 order requests per account every 2 seconds;
4. The Moonbot terminal utilises certain undocumented functions of the OKX exchange API, such as deep-level aggregation channels (as found on exchanges such as Bybit and BitGet); the number of levels may be reduced if the exchange disables the relevant function;
5. **OKX’s servers** have been relocated from the “Hong Kong” location to the **“Tokyo (Japan)” location since the end of July 2026**, so please select the same location when trading on dedicated servers;
6. The iceberg order mode is not supported;
7. Account mode: \
   **Spot mode** – in this mode, only the OKX (Spot) connection works in Moonbot; OKX Futures is not supported\
   **Futures mode** - In this mode, both OKX (Spot) and OKX Futures are supported in Moonbot\
   **Multi-currency** - In this mode, both OKX (Spot) and OKX Futures are supported in Moonbot, and all currencies can be used as collateral.

   To switch your account mode on the OKX exchange website, go to the **Trade** tab, then, for example, select **Spot**. The trading interface will open. Click on the icon to the right of the text "**Spot mode**"; a menu for selecting modes will open. Make your selection and click the **Switch** button at the bottom.
8. **The Cross/Isolation margin setting on the OKX exchange applies to each individual market, rather than the entire account**, unlike, for example, the Bitget exchange. You can only change the margin mode for a market in the Moonbot terminal if there are no open positions or orders on that market.

   The main pitfall: **OKX does NOT prohibit holding two positions with different margin modes on the same instrument** – even two in the same direction (a cross-long and an isolation-long can co-exist, and we have verified this).

   Worse still: a ‘close’ order placed in the wrong mode does not close the position, but opens an opposite one. \
   Conclusion: **The RESPONSIBILITY to trade in a single mode at all times and in all circumstances lies with you!**

   **One account** **OKX = ONE trading mode** (either always **Cross**, or always **Isolation**), otherwise you will face lost positions and liquidations.

   Please note!\
   **OKX does not have Isolation mode memory on the exchange itself.**\
   Only the terminal knows whether you want to use the **Isolation** mode or not, so **ALL terminals** connected to the OKX exchange must trade **in the same mode**!\
   You cannot leave one terminal in **Isolation** mode while trying to enable **Cross** mode on another.

Once you have obtained the API keys for OKX and registered them in the Moonbot terminal, you can either continue with the configuration or proceed to create strategies for detecting volatile price movements and automated cryptocurrency trading on the OKX exchange (see the [What Is Autotrading in Moonbot >>](https://moonbot.eu/en/begin/simple-auto-trading/what-is-autotrading-in-moonbot?format=md)).

## Navigation

Path: [Main](https://moonbot.eu/en?format=md) / [Documentation](https://moonbot.eu/en/documentation?format=md) / [Settings Button](https://moonbot.eu/en/documentation/settings-button?format=md) / [“Settings → Login” Tab](https://moonbot.eu/en/documentation/settings-login-tab?format=md) / Connecting to the OKX exchange

Parent section: [“Settings → Login” Tab](https://moonbot.eu/en/documentation/settings-login-tab?format=md)

Previous: [Connecting to the Hyperliquid exchange](https://moonbot.eu/en/documentation/settings-login-tab/connecting-to-the-hyperliquid-exchange?format=md)
