# OKX Sub-accounts & API Connection

Creating your own OKX APIs enables integration between your OKX Exchange Wallet and our product, Investy.ai. You can now start investing on Investy.ai with your funds in OKX through the created API.&#x20;

<mark style="color:red;">**Note:**</mark>

* You should create a sub-account on OKX to connect with INVESTY.AI. Invest your funds in the sub-accounts while continuing to trade with your main OKX account.&#x20;
* Prior to API creation, ensure your security by activating 2FA (Two-factor authentication).

### **Authentication Set-up**&#x20;

**Create OKX Trading Sub-Account**

1. From top right dropdown, click "**Sub-account**":

<figure><img src="https://lh7-us.googleusercontent.com/RmwH69K5Jue8kY3ISSPHGVZYEK4C4cuNoUi7aECc4MBJ9qH_XndZTNSwEDhhQZUm-EmNesf5-78o4fsSvQoM-Ucbvu_5M4Lme3u8CZAByAhoMZwyhhr-Z5r0vcE-jrDGckPb1A7B9YKvUlMagZhzg0g" alt=""><figcaption></figcaption></figure>

2. Click "**Create Sub-account**"

<figure><img src="https://lh7-us.googleusercontent.com/UQSh2kE6IqlxYRlnolQjj_7vpcs5Y33MAN1N9vMzHX4BNq2PV-PoNII4loo-PD3bOzHQyODdyGclkjl2ILArQD1OvOv8KiDWOg_fCnNauDu5lkrYkFvdbAWnimtndKgV1JJWNN1v6S_dzXwMW7-L3r0" alt=""><figcaption></figcaption></figure>

3. Set up a **\[Login ID and Password] - \[Account Type: Standard Sub-Account] - \[Edit: Configure according to your preference] - \[Submit]**&#x20;

<figure><img src="https://lh7-us.googleusercontent.com/tmpJc2-EKsmoa4ESfLRwAa2lWnf9L7-XcqBItk3nzF2NvdMln8oAtwiGd0IaIxHG11cpf5452dpo_-DRKjcoKWAwwwG-LpLZfnqygwLLYGaGWVhnIz6tNowZj1PymTDgXkh5tUY_ecsODTJ5Rb_-K0A" alt=""><figcaption></figcaption></figure>

### **Create API Key for OKX Trading Sub-account**

1. From top right dropdown, click "**Sub-account**"

<figure><img src="https://lh7-us.googleusercontent.com/RmwH69K5Jue8kY3ISSPHGVZYEK4C4cuNoUi7aECc4MBJ9qH_XndZTNSwEDhhQZUm-EmNesf5-78o4fsSvQoM-Ucbvu_5M4Lme3u8CZAByAhoMZwyhhr-Z5r0vcE-jrDGckPb1A7B9YKvUlMagZhzg0g" alt=""><figcaption></figcaption></figure>

2. Click "**Action**", then "**Manage API**"

<figure><img src="https://lh7-us.googleusercontent.com/D_NlZyP25eDkrnrRGPN5LoK-_sDKJB7c-s1zdTCzRbQMFjDDQQ7Ovf6ydtcmmYvjeqo9lsfhdWpBNSnyOrAn6WiFGp9So_F-6o6z16JYFJWNnByNMfOhlV3thLIcFvCx6KG2kPehpZ4SmvH66-ZgqKs" alt=""><figcaption></figcaption></figure>

3. Click "**Create V5 API Key**"

<figure><img src="https://lh7-us.googleusercontent.com/5ZTANFCvT6RcyHoe2E0St1POihzZWSMWDTlYNfF6kIx3Kn6ja2fEkSp4UZRutdl4oL1YDFVyhlMgx84-YQYfTnUopCmVGEWYD2t7uwfKzNH9hkwqKYnFIKA1SRkjc1byE93VIgsBhuRbkeW7iy_dn24" alt=""><figcaption></figcaption></figure>

4. Set "**API Name", "Passphase**", enable "**Trade**" permission, then click "**Confirm**"&#x20;

<figure><img src="https://lh7-us.googleusercontent.com/qlgIXKUIE_0TZVqGCWMr6CWYdc2aYE9Q0WkRBVFuPqbRqcgGrt_0TJ-P2qrjB_lnlG_gf3zokXSA0TnKStFIrbDfogVObraxgvYa2Lt9Vqtpy_nyguRHy2J6u4kDG1fo2Xp394hMSXh-eGYZlves9Ls" alt=""><figcaption></figcaption></figure>

5. Input “**Two-factor authentication**” then click “**Confirm"**

<figure><img src="https://lh7-us.googleusercontent.com/VweNkbALW9KW30c0lO27KVp7BnJeIToL7XB0DQZ0b4FPb6PtF8f8AY8ZzopK-qWEPd2B32Z3Y37HhEjjglGapuBkA_mRxFL92cCaTtABgjexJ83-51ePKWjLLTOrEBJRLbckQMt2IMF7HMCYQXHY_wA" alt=""><figcaption></figcaption></figure>

6. Get your "**API Key**" and "**API Secret**"

<figure><img src="https://lh7-us.googleusercontent.com/OU29Z0Uv3PB5DtPl6sn5kvSNyS10pm0tJV5tw1S6krPdC66F4c3z1NQP6yAMDW7EDROk0aLmu-p3QuB0AYWqmExuWgIiaAg8S3iiqMlMiEBaKe2Ih9qovLU3knvooIj3C6OFoSNt5vyuUI3Zs64hZtE" alt=""><figcaption></figcaption></figure>

### **Transfer of funds into sub-account**&#x20;

1. Select Transfer&#x20;

<figure><img src="https://lh7-us.googleusercontent.com/gBc6nemrbHw_Ve94PHGIrUsoRnSjlGW2hvwLbqbQTkE0dWDjKp221mFb__F9p-4CpaCfM6Pz0oykFiNYBY3oJ3svWuIdjYRa1A7PKdk7ZqCxwRgWaiApxI6WK_Vp2K6d29ogy0PpzqLymGof-BB9kto" alt=""><figcaption></figcaption></figure>

2. Select the Funding/Trading account in Main/Sub-account, the Sub-account name and Crypto you would like to transfer. Fill in the Amount and select Transfer to complete.&#x20;

<figure><img src="https://lh7-us.googleusercontent.com/7glyR-qsWyNrFXN1xTpRVz0mnP-75vB0Ib0nD_ntpVh20womFKJq1y71szoxfOUiSHgw8miOGup0_qtd4dVirm9_yPO03eZm05agjnjE4Q-Tbc9QLptpt9dat9uzl-aSMIQK3-RKr1fDUkO9a_dg0BE" alt=""><figcaption></figcaption></figure>

### **Connect to Investy.ai**

1. Add your IP as address allowlist at the OKX API Account as follows:

Get your IP here in the bottom section in Investy.ai website (showed below)

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcqUIMBw61fFoYkybG8x9YYYlbcx9AbrfpKC_YVlO_y1KXt9_hL8KryIGZeWWHEAF24YSDOxbPILbZMoxKqYu-UR9LDa0KRptz6wXYkRjmHZSvje64MEGIL8a4so8Zxb9Lfi93K?key=dHN7nmAOhjCshS_qKDtcgw" alt=""><figcaption></figcaption></figure>

2. Navigation: API keys → Edit → Add your IP and tick on Confirm

<figure><img src="https://lh7-us.googleusercontent.com/qXRan3hATVphNo3nk-DG1Q10kuu830fuMLh0QUaS5jOpmMjzjGeNG_HRGHrSfM-hYEAD7As7V4XUjn_1GzEtHyuys2oc4IRhPlqWkx3NPKjBJ4LGOfEfBp_GCmSbz9P3N2mdYOqk0Uolj9HDaoFbf14" alt=""><figcaption></figcaption></figure>

3. Copy and paste API key and API Secret to Investy.ai Exchange Setup. Then, enter your OKX created passphrase correctly

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcNZlqChsUL-Yq-l_PIAdtBH3L2O0heRwg8D3UE4NyTt4VPhqYTMxNIRUgaqL9N7TBYPvhgBCA17iSDidwYatcjioTBD2NeV-Ex3lm19s3qPIvlN6A10fu6AIb7pEDVbSznHf3Q9A?key=dHN7nmAOhjCshS_qKDtcgw" alt=""><figcaption></figcaption></figure>

4. Fill out all the required fields in Investy.ai. Press **\[Save] &** **\[Connect Exchange]** - your funds will be available in Investy.ai within a minute

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdMQFj6qzVqBhPtDp9IA_mGmy4wloHXw4Tm8-RA02i6V9VcO2EgOOUI_u9Y7wziFz8GXmBbH1i8IYVkK8ArRT59sxU9aRekvHhEuiekfpjsK19b7tY6VQaCv8qwrl785-Yx9_mb8Q?key=dHN7nmAOhjCshS_qKDtcgw" alt=""><figcaption></figcaption></figure>

### **Create API Key for OKX main account (Optional)**

Alternatively, if you want the trade happens in your master account, you can create the main account API as follows:

1. From top right dropdown, click "API"

<figure><img src="https://lh7-us.googleusercontent.com/4y3Em9-pKhdin3F9WBBVnaOZxYvl_7_ggQox3A9pihAZnCYwjVqH4HmHxR6vU6mOZeVQ3Khs7247k9CGseSDrtNjoo6zf3BCA2qlL-jHcG7gLfMKxMua5lU82nTA3CfaSGScTRN_VMU74JldE75wHpE" alt=""><figcaption></figcaption></figure>

2. Click "Create API Key"

<figure><img src="https://lh7-us.googleusercontent.com/sNekPZrtOCEB6XUteZTBe8qMkDzzvgRMZJmMou2Ps-rMoo-8sh9xikg5Qtt1P9SXNKqkIF9hdcRfAM2ndMY353DowTUKfHOXlTfebzsQK59fPFIK1pjiqEnchYz_sQ-S1CK6_0ZJgSkTPwi6t8wBFLk" alt=""><figcaption></figcaption></figure>

3. Follow similar procedures for sub-account API above


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.investy.ai/information/guides/api-exchange-connection/okx-sub-accounts-and-api-connection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
