Skip to content

API key for a trading terminal. Permissions, futures and connection errors

How to create an API key for Tradepit on Binance, Bybit, OKX, Bitget, and KuCoin, which permissions it needs, why futures may be locked and what connection errors mean.

Updated

Where a key is created

An API key is created on the exchange itself, in its API management section. Tradepit works with the exchange directly, through your API key.

Supported exchanges are Binance, Bybit, OKX, Bitget, and KuCoin.

First open the market you will trade on the exchange and pass its identity verification, then create the key. Why this matters for futures is explained below.

The finished key goes into Tradepit under “Account”, section “API keys”. How to do it step by step is in the Getting started guide, section “Key in Tradepit”. Keys stay only in your browser.

Which permissions to give a key

Give a key for Tradepit only the rights to read and to trade, with withdrawals and transfers turned off.

The trading right is needed on the market you will trade in Tradepit, Spot or Futures.

Pick the key the exchange generates itself, usually called System-generated. Tradepit signs requests with this key’s secret. An API key based on your own Ed25519 or RSA key pair will not work.

On “Check and save” Tradepit sends the exchange a test request and finds out what the key may do. It places no orders. “Recheck” next to a key asks the exchange again, for example after you changed its rights. What the key statuses mean is in the Getting started guide, section “If you are stuck”.

A key on Binance and Bybit

On Binance a key is created like this.

  1. Profile → Account → API Management → Create API.
  2. Key type System-generated, any name, 2FA confirmation.
  3. In the key’s rights turn on “Enable Spot & Margin Trading” for Spot and “Enable Futures” for Futures. Leave “Enable Withdrawals” and “Permits Universal Transfer” off.

By default Binance leaves a key without an IP restriction with reading only, and such a key cannot trade. How this works is in Binance’s help on creating API keys.

On Bybit a key is created only on the website, the app does not do it. For a new account the exchange may block key creation for the first 48 hours after sign-up.

  1. Profile icon at the top right → API → Create New Key.
  2. Choose a key with write rights, not read-only. For Futures turn on contract orders and positions, for Spot spot trading. Do not turn on withdrawals or transfers.
  3. Confirm with a Google Authenticator code.

When Bybit reports a key’s rights, Tradepit checks them. A key without trading on its market gets the “read-only” status, and a key with withdrawal rights is not kept.

A key on OKX, Bitget and KuCoin

These three exchanges ask you to make up a passphrase when you create a key. In Tradepit it goes into the “Passphrase” field next to the secret. The exchange will not show it again, and a forgotten passphrase means a new key.

On OKX a key is created like this.

  1. Profile → API → Create API key.
  2. Key name, rights and passphrase. Rights Read and Trade, leave Withdraw and Transfer off.
  3. Confirm with your 2FA codes.

On keys that already had Trade, OKX turned on Transfer by itself. On an older key, check that Transfer is off.

An OKX key for EEA or US is added to Tradepit like any OKX key, and Tradepit finds the key’s region by itself. Bitget, KuCoin and OKX (EEA, US) need the Exchange Bridge extension for Chrome. If it is missing, Tradepit shows you how to install it.

On Bitget a key is created like this.

  1. Profile icon at the top right → API → Create API.
  2. Type System-generated API Key (HMAC).
  3. A note for the key, the passphrase, the rights and the verification code. Rights to read and to trade futures or spot, without withdrawals and transfers.

On KuCoin a key is created like this.

  1. Avatar → API Management → Create API, the API Trading option.
  2. Key name, passphrase and rights. Futures needs futures trading, Spot needs spot trading.
  3. Confirm with your trading password, the email code and the Google code.

Tradepit treats the Transfer right of a KuCoin key as a withdrawal right and does not keep such a key.

When OKX, Bitget or KuCoin report a key’s rights, Tradepit checks them. A key without trading on its market gets the “read-only” status, and a key with withdrawal rights is not kept.

Why futures do not open

Futures are opened by the exchange, not by Tradepit. Until the exchange opens futures for you, the key cannot trade them, whatever rights it has.

Binance. Futures need identity verification, and the futures account itself is opened in the Futures section with “Open Account” and “Open Now”. A key created before the futures account was opened will not get “Enable Futures”, you need a new key. With Portfolio Margin turned on, this right cannot be turned on for a key either.

Bybit. Identity verification of at least the Standard level is required for every product of the exchange.

OKX. In the Spot account mode futures are not available. A Futures key then gets the “read-only” status in Tradepit, and the error card shows code 51010. Pick any other account mode on the OKX trading page, it cannot be changed through the API.

Bitget. Without level 1 identity verification the exchange does not let you trade.

KuCoin. Futures need a verified account and a test or experience assessment when the exchange asks for one. The exchange does not enable futures for residents of some countries.

Once futures are open and the key has the right to them, press “Recheck” next to the key. Futures windows need a key added with the Futures market, a Spot key does not fit them.

Connection errors

Exchange errors are shown to you in a clear, readable form. When the exchange refuses, a card appears in the corner of the screen. Its header names the exchange, the action and the pair, with the reason below. “Details” shows the exchange’s own error code and text, untranslated, and the HTTP status. A refusal during a key check is labeled “Key check”.

Below are the reasons tied to the key and the exchange codes Tradepit reads as each of them.

“The exchange does not accept this API key”. The exchange did not recognize the key, its signature or its passphrase. Check that the key, the secret and the passphrase were copied in full and that the form names the same exchange. A demo account key will not work, Tradepit works with the real exchange account.

ExchangeCodes
Binance-2014, -2015, -1022, -1002
Bybit10003, 10004
OKX50101, 50105, 50111, 50113, 50114, 50119
Bitget40006, 40009, 40012, 40036, 40037
KuCoin400003, 400004, 400005

Binance also returns -2015 when the address is not in the key’s IP list or the key has no right for the action, for example “Enable Futures” for futures.

“The API key has no permission for this, or your IP is not allowed”. Trading on this market is off for the key, or the exchange does not let the key in from this address.

ExchangeCodes
Bybit10005, 10010
OKX50110, 50120
Bitget40014, 40018
KuCoin400006, 400007

The “My IP” block in “API keys” shows the address the exchange sees when you trade from this computer. If the key is bound to IP addresses, KuCoin and OKX also need the IPv6 in the list, since they work over it too.

“Your computer clock is out of sync with the exchange”. Check the time on your computer and repeat the action.

ExchangeCodes
Binance-1021
Bybit10002
OKX50102, 50112
Bitget40005, 40008
KuCoin400002

“The exchange refused access from this network”, and the key carries the note “exchange refused access (403)…”. This is an HTTP 403 response without an exchange code. It says nothing about the key itself, and the key keeps its rights.

“The exchange returned an error the terminal does not know yet”. The exchange’s code and text are still in “Details”.

A key may stop working without you changing it. OKX deletes a key without an IP binding that has Trade or Withdraw after 14 days of no use. KuCoin deletes such a trading key after 30 days of no use or takes trading off it. Then create a new key and add it to Tradepit.

If the reason is unclear, write to support as the Getting started guide says, and attach the code and text from “Details”. Never send your key or secret to anyone.