How to connect a trading bot to your exchange safely

Connect a trading bot with an API key that can trade and read your balance, and nothing else: withdrawals must stay off. Your money then stays on your exchange, the bot can only place and cancel orders, and deleting the key on the exchange cuts the connection at once.

In short

  • Enable trading (spot and/or futures) and reading; never enable withdrawals or transfers.
  • Use a separate key per service, ideally on a sub-account holding only the bot’s budget.
  • Store the secret only in the bot; it is shown once by the exchange.
  • Deleting the key on the exchange revokes access immediately.

What an API key is

An API key is a pair of codes (a key and a secret, sometimes a passphrase) that lets software act on your exchange account with the permissions you choose. The bot never sees your password, and the exchange checks every request against those permissions.

The permissions to give, and the ones to refuse

API key permissions for a trading bot
PermissionNeeded?Why
Read (account, balance, orders)YesTo see your balance, positions and order fills
Spot tradingFor spot botsTo place and cancel spot orders
Futures / derivatives tradingFor futures botsTo place orders and set leverage on perpetuals
WithdrawalsNeverA trading bot never needs to move money off the exchange
Internal / universal transfersNoNot needed to trade; leave it off

If any service asks for withdrawal permission to “run a bot”, do not give it. QuantPhi checks the key’s permissions when you connect it and shows that no withdrawal permission is present.

Step by step

  1. Optional but wise: create a sub-account on the exchange and move only the bot’s budget there.
  2. Open the exchange’s API management page and create a new key for the bot (a “system-generated” or HMAC key where you are given the choice).
  3. Tick reading and the trading you need (spot, futures or both). Leave withdrawals and transfers unticked.
  4. Copy the key and the secret (and the passphrase, if the exchange uses one) straight into the bot. The exchange shows the secret only once.
  5. Run the connection test in the bot and check the permissions it reports.

Notes per exchange

  • Bybit: create the key under API management; give Contract (derivatives) and/or Spot trading, leave Withdrawal off.
  • OKX: you choose a passphrase when creating the key; the bot needs it as a third field. Give Trade permission, not Withdraw.
  • Bitget: also uses a passphrase; enable trading only.
  • Binance: enable Spot & Margin trading and/or Futures; leave Withdrawals off.
  • BingX: enable trading for spot and/or perpetual futures; leave withdrawals off.
  • Coinbase: create an Advanced Trade API key with trade permission and no transfer permission. Spot only.
  • Hyperliquid: create an API wallet (agent wallet) on the Hyperliquid app; it can trade for your account but cannot withdraw.

Exchanges change their screens and rules (key expiry without an IP restriction, for example), so follow the wording on your exchange’s page.

How QuantPhi handles your key

The key is stored encrypted on our server and never shown again after you save it. QuantPhi only places and manages orders on your account; it never withdraws, and your funds stay on your exchange. Deleting the key on the exchange, or the account in QuantPhi, stops all access.

If the exchange rejects orders

An error saying “permission denied” or that the key cannot trade usually means the key was created read-only, or without the market (spot or futures) the bot trades. Create a new key with the right trading permission; editing permissions on an existing key is not possible on every exchange.

Questions

Can a trading bot withdraw my crypto?

Not if the API key has no withdrawal permission. Exchanges refuse any withdrawal made with such a key, so a trade-only key can place and cancel orders but cannot move money off your account.

Which API permissions does a trading bot need?

Reading the account, and trading on the markets it uses: spot, futures or both. Nothing else.

How do I stop a bot from accessing my exchange?

Delete its API key on the exchange. Access ends immediately, whatever the bot does.

Should I use a sub-account for a trading bot?

It is a good habit: the bot then sees and risks only the money you moved there, and your other holdings are out of its reach.

Try it on your own exchange account

QuantPhi runs DCA, grid, rebalance and Hedge Stop bots on Bybit, OKX, Bitget, Binance, BingX, Coinbase and Hyperliquid. There is a free plan; your funds never leave your exchange.

Create a free account

Crypto trading involves risk; past results and backtests do not guarantee future returns. This guide is education, not investment advice.