# Connecting API OKX

> Learn how to connect Veles platform to the OKX exchange — using a Fast connection or manually creating an API key.

A Fast One-click connection is available for **main OKX accounts**.
**Subaccounts** can be connected manually only.

:::caution[Attention!]
Before creating the key, make sure that your [**account on OKX supports futures trading**](https://help.veles.finance/en/exchange/okx/prepare/) — otherwise, only the spot key will be created.
:::

## Fast connection to OKX

1. Go to the [API Key Management page](https://veles.finance/cabinet/account/api)
or open the bot creation window on the **Veles** platform.

2. Click **"Add API Key"** and select **OKX**.

3. Click **"One-click connection"**.

4. Log in to your OKX account.

5. Click **"Approve"** to confirm the request.

:::caution[Important!]
After connecting, be sure to set up **lock "By position"** for the created Binding.
:::

## How to recreate the key

If your OKX account has already been linked to Veles, the exchange may reject the request when trying to create a new key.
To recreate the key, follow these steps:

1. Remove the binding in Veles on the [API Key Management page](https://veles.finance/cabinet/account/api).

2. Delete the old key on the OKX API management page: https://www.okx.cab/ru/account/my-api.

3. Create a new key according to the instructions above.

## How to Delete an API Key on OKX

**OKX API keys** — deleting a key on the exchange should not be blocked by anything. Path: OKX → Profile → API → find the key → delete (https://www.okx.com/en/account/my-api).

If "Fast Connection" does not work, use the **manual procedure**.

## Manually creating an API key on OKX and linking it to Veles

1. In the upper-right corner, click on the **user icon**, then select **"API"**.

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

3. On the key creation page:

   - use **"Linking to a 3rd party application"** - select "Veles";
   - enable the **"Trade" permission**;
   - enter the **passphrase** (Latin letters only);
   - press **"Submit all"**;
   - save all the key data in a safe place (for example, in a password manager).

4. Enter the verification code sent to your phone to confirm the creation of the key.

## Binding the API key to Veles

1. Log in to your **Veles** personal account and click **"Create a bot"**, alternatively, go to **Settings → API Keys**.

2. Select **OKX exchange**, then **"Add new API key" → "Manual connection"** and specify the type of binding (**Spot** or **Futures**).

3. Enter the API key data, give an informative name (for example, *OKX Futures Main*) and click **"Connect"**.

:::caution[Important!]
By creating the Binding, be sure to set up **lock "By position"** to prevent conflicts between bots.
:::
