How To Create API Keys on OKX

·

Creating API keys on OKX is a straightforward process that enables secure integration between your trading account and third-party platforms. Whether you're automating trades, tracking performance, or syncing portfolio data, generating API credentials properly ensures both functionality and security. This guide walks you through each step with clarity and precision, helping you set up your OKX API keys safely using best practices.


Why Use a Sub-Account for API Integration?

Before diving into the technical steps, it’s important to understand why using a sub-account is highly recommended. By isolating your automated trading activities in a dedicated sub-account, you protect your main funds and maintain full control over permissions. Even if API credentials are compromised, the potential damage is limited to the sub-account only.

This approach aligns with advanced risk management strategies used by professional traders and enhances overall account security.

👉 Discover how secure API integrations can boost your trading efficiency


Step 1: Access Sub-Accounts via Profile

Start by logging into your OKX account. Once inside:

  1. Click on your Profile icon in the top-right corner.
  2. Navigate to Sub-Accounts from the dropdown menu.

This section allows you to create and manage multiple sub-accounts, each with its own unique permissions and balances.

Using sub-accounts is one of the most effective OKX security practices, especially when connecting to external services.


Step 2: Create a New Sub-Account

In the Sub-Accounts dashboard:

A pop-up window will appear, prompting you to configure the new account.


Step 3: Configure Sub-Account Settings

Now customize your sub-account for optimal performance and compatibility:

  1. Name Your Sub-Account
    Choose a clear, recognizable name—like “Robuxio-Trading” or “AutoBot-Futures.”
  2. Select Account Type
    Pick Standard Sub-Account. This type supports spot and futures trading and integrates seamlessly with API tools.
  3. Edit Trading Settings
    Make sure the following options are enabled:

    • Account Mode: Spot and Futures mode
    • Position Mode: One-way Mode

    These settings ensure compatibility with most third-party trading bots and analytics platforms.

  4. Deposit Settings (Optional)
    You can allow direct deposits into this sub-account. If disabled, all funds must be transferred from the main account.

Double-check all configurations before proceeding.


Step 4: Generate API Keys from the Sub-Account

With the sub-account created, it’s time to generate the API keys:

  1. Under the Action column next to your new sub-account, click Manage API.
  2. Select Create API.

You’ll now enter the API configuration panel.

Configure API Permissions

Fill in the following details carefully:

  1. API Name
    Assign a descriptive name (e.g., “TradingBot-API”).
  2. Sub-Account Selection
    Ensure the correct sub-account is selected—preferably the one created specifically for third-party use.
  3. Purpose
    Choose Linking third-party app. This setting activates IP whitelisting and tighter security protocols.
  4. Select Application
    If available, choose the integrated service (e.g., Robuxio) from the list.
  5. Enable Trade Permission
    Check the box to allow trading operations through the API. Only enable this if required by the third-party platform.
  6. Create a Passphrase
    Set a strong, unique passphrase. You’ll need this along with your API key and secret to authenticate connections.
🔐 Never reuse passwords or passphrases. Store these credentials securely using a password manager or encrypted vault.

Step 5: Retrieve Your API Credentials

After creation:

👉 Learn how to securely store and use your API keys for automated trading

Copy them immediately and store them in a secure location. For security reasons, OKX will not show these again unless you regenerate them.

⚠️ Never share your API keys or screenshot them in unsecured environments.


Step 6: Link API Keys to Third-Party Platform

Now connect your OKX sub-account to an external service like Robuxio:

  1. Go to the platform’s website (e.g., app.robuxio.com).
  2. Navigate to Profile > Add Exchange.
  3. Select OKX as the exchange.
  4. Choose your preferred trading portfolio.
  5. Enter:

    • API Key
    • Secret
    • Passphrase
  6. Click Save Changes.

The system will begin validating your credentials.


Final Step: Validate Connection and Fund Account

Once saved:

If everything displays correctly, your setup is complete—and you’re ready to trade automatically or monitor positions in real time.


Frequently Asked Questions (FAQ)

Q1: Why should I use a sub-account instead of my main account for API access?

Using a sub-account limits exposure. Even if your API keys are compromised, attackers can only access funds within that isolated sub-account, protecting your primary holdings.

Q2: What permissions should I grant my API key?

Only grant necessary permissions. For read-only tracking, disable trading rights. For automated bots, enable trade permission, but avoid withdrawal rights entirely.

Q3: Can I revoke or delete an API key later?

Yes. Return to Manage API in your sub-account settings, find the key, and click Revoke. This instantly disables access.

Q4: Is it safe to link my OKX account to third-party apps?

It’s safe if you follow best practices: use strong passphrases, restrict permissions, enable two-factor authentication (2FA), and monitor activity regularly.

Q5: What does “One-way Mode” mean in futures trading?

One-way Mode allows you to hold a single position per contract (either long or short). It simplifies position management and is widely supported by trading bots.

Q6: Why is selecting “Linking third-party app” important during API creation?

This selection enables enhanced security features such as IP whitelisting and restricted access patterns, reducing the risk of unauthorized usage.


Best Practices for Secure API Usage

To maximize safety while leveraging automation:

Security isn’t just about setup—it’s about ongoing maintenance.

👉 Explore advanced security settings to protect your digital assets


By following this guide, you’ve successfully created and configured secure API keys on OKX using a sub-account structure—a method trusted by experienced traders worldwide. With proper configuration and cautious handling, your automated trading journey can be both powerful and protected.