Home » Learn Crypto Trading » How to Set Up a Crypto Trading Bot: API Guide for Every Exchange (2026) » Bybit API Trading Bot Setup: Step-by-Step Guide (2026)

Bybit API Trading Bot Setup: Step-by-Step Guide (2026)

Bybit API trading bot setup: create an API key, choose read and trade (never withdraw), bind your IP and connect with Python.

Bybit API Trading Bot Setup: Step-by-Step Guide (2026)

Short answer: To set up a trading bot on Bybit, create an API key under Profile > API (bybit.com/app/user/api-management) > Create New Key > System-generated API Keys > API Transaction, give it read and trade permission only (never withdraw), bind it to your server IP, and paste the key, secret into your bot. With Python you can connect in a few lines using ccxt (exchange id “bybit”).

Checked on 26 October 2026 against each exchange’s official API documentation (linked in Sources). Exchanges rename menus often; if a label differs, look for “API” in your profile menu.

Official site: www.bybit.com

This guide is part of our hub How to Set Up a Crypto Trading Bot. Before you start, read our Bybit review and compare it on our exchange comparison.

Before you start: prerequisites

How to create a Bybit API key for a trading bot (step by step)

  1. Create and secure your account. Sign up, finish identity verification (KYC) and turn on 2FA. API trading on most exchanges, and futures API permissions on several, require KYC.
  2. Open the API page. Profile > API (bybit.com/app/user/api-management) > Create New Key > System-generated API Keys > API Transaction.
  3. Name the key. Use a clear label such as “bot-spot-1” so you can revoke it later without guessing.
  4. Set permissions. Choose Read-Write and tick only the product scopes you need (for example Unified Trading orders and positions). Never tick Withdraw.
  5. Bind your IP address. Bind your server IP. Keys without an IP binding expire after 90 days.
  6. Confirm and save the credentials. 2FA confirmation. No passphrase. Copy the API key and secret into a password manager. The secret is usually shown only once.
  7. Connect your bot. Store the values as environment variables and load them in your bot (code below). Run a read call first, then one tiny order.
  8. Test, then scale slowly. Use demo or testnet if available, then a small live budget. Watch logs for a few days before adding funds.

Bybit API settings at a glance

Passphrase needed No
IP whitelist Bind your server IP. Keys without an IP binding expire after 90 days.
Demo or testnet Two options: Testnet (testnet.bybit.com, separate keys, api-testnet.bybit.com) and Demo Trading (keys created in Demo Trading on the main site, api-demo.bybit.com). Keys do not work across environments.
Key limits and rate limits Limits are per endpoint and per UID; error 10006 means too many requests.
Spot vs futures The Unified Trading Account handles spot and derivatives together. In ccxt set defaultType to spot or swap.
Python ccxt id bybit

Which permissions to choose

Choose Read-Write and tick only the product scopes you need (for example Unified Trading orders and positions). Never tick Withdraw.

Rule one: a trading bot never needs withdrawal rights. If a bot service asks for withdrawal permission, do not use it.

Use a sub-account for the bot

Create a sub-account (Bybit allows API keys on sub-accounts) and fund only the bot budget.

Spot or futures

The Unified Trading Account handles spot and derivatives together. In ccxt set defaultType to spot or swap.

Start with spot. Futures bots can be liquidated in minutes if a stop fails.

Connect Bybit to a Python bot (ccxt example)

ccxt is an open source library that wraps Bybit and over 100 other exchanges. This minimal script loads keys from environment variables, checks the balance and reads a price.

# 1) store keys as environment variables, never in code or git
export EXCHANGE_API_KEY="..."
export EXCHANGE_API_SECRET="..."

# 2) pip install ccxt
import os, ccxt
ex = ccxt.bybit({
    "apiKey": os.environ["EXCHANGE_API_KEY"],
    "secret": os.environ["EXCHANGE_API_SECRET"],
    "enableRateLimit": True,
    "options": {"defaultType": "spot"},  # or "swap" for perpetual futures
})
# ex.set_sandbox_mode(True)  # demo / testnet keys only
print(ex.fetch_balance()["total"])          # read test
print(ex.fetch_ticker("BTC/USDT")["last"])   # market data
# ex.create_order("BTC/USDT", "limit", "buy", 0.0001, 50000)  # tiny test order

Build your own AI trading bot

You do not need a paid bot service. AI assistants such as Grok Bot can write and run the code above, add your strategy rules and log every trade. TradeReviewed hosts independent traders who run AI-built bots on real accounts and publish every trade, wins and losses. Treat any bot, AI or not, as experimental until it has months of logged results.

Security checklist

Troubleshooting common API errors

Error Fix
10003 API key invalid Wrong key or wrong environment (testnet, demo and mainnet keys are separate).
10004 Signature error Check the secret and clock.
10006 Too many visits Throttle requests.
10010 Unmatched IP Add the server IP to the key.
Timestamp or recvWindow errors Sync your server clock with NTP.

Fees and EU availability

Bot strategies trade often, so fees matter. See Bybit fees. Bybit EU operates under a MiCA licence from Austria. EU users should sign up through Bybit EU.

Frequently asked questions

Can I use a trading bot on Bybit?

Yes. Bybit offers an API for automated trading. Create a key with read and trade permission, bind your IP and connect your bot.

Does the Bybit API need a passphrase?

No. You need only the API key and secret.

Should I enable withdrawal permission on my Bybit API key?

No. A trading bot never needs it. Leave withdraw off.

Does Bybit have a demo or testnet API?

Two options: Testnet (testnet.bybit.com, separate keys, api-testnet.bybit.com) and Demo Trading (keys created in Demo Trading on the main site, api-demo.bybit.com). Keys do not work across environments.

Why did my Bybit API key stop working?

Bind your server IP. Keys without an IP binding expire after 90 days.

Is Bybit supported by ccxt?

Yes, as “bybit”.

API bot guides for other exchanges

Sources

Not financial advice. Automated trading can lose money fast, especially with leverage. Past results do not guarantee future returns. Never give any bot or third party withdrawal rights, and check the rules in your country before you trade.

You'll hear it here firstBreaking crypto and market alerts on Telegram, before everyone else.✈ Join our Telegram