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

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

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

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

Short answer: To set up a trading bot on BingX, create an API key under Profile icon (top right) > API Management > Create API, 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 “bingx”).

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.

Open a BingX account

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

Before you start: prerequisites

How to create a BingX 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 icon (top right) > API Management > Create API.
  3. Name the key. Use a clear label such as “bot-spot-1” so you can revoke it later without guessing.
  4. Set permissions. Read, plus Spot Trading and/or Perpetual Futures Trading. Leave Withdraw and Universal Transfer off.
  5. Bind your IP address. Up to 20 IP addresses per key, separated by commas. Keys with trading, transfer or sub-account permissions that are not linked to an IP are deleted automatically after 14 days with no API calls. Read-only keys and IP-linked keys do not expire.
  6. Confirm and save the credentials. Email code plus your 2FA code (authenticator or SMS). 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.

BingX API settings at a glance

Passphrase needed No
IP whitelist Up to 20 IP addresses per key, separated by commas. Keys with trading, transfer or sub-account permissions that are not linked to an IP are deleted automatically after 14 days with no API calls. Read-only keys and IP-linked keys do not expire.
Demo or testnet BingX offers a demo (VST virtual USDT) environment for perpetual futures. ccxt points to it with set_sandbox_mode(True), which uses the open-api-vst host.
Key limits and rate limits Each main account and each sub-account can hold up to 20 active API keys. The BingX management tool covers Spot and Perpetual Futures only.
Spot vs futures Spot and Perpetual Futures need separate permission boxes. In ccxt use defaultType spot or swap. Make sure the futures account is activated in the app first, otherwise orders fail with a permission error.
Python ccxt id bingx

Which permissions to choose

Read, plus Spot Trading and/or Perpetual Futures Trading. Leave Withdraw and Universal Transfer off.

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, move only the bot budget into it, and create the key from the sub-account. Each sub-account has its own 20 key limit.

Spot or futures

Spot and Perpetual Futures need separate permission boxes. In ccxt use defaultType spot or swap. Make sure the futures account is activated in the app first, otherwise orders fail with a permission error.

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

Connect BingX to a Python bot (ccxt example)

ccxt is an open source library that wraps BingX 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.bingx({
    "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
Invalid API key or signature Check for spaces when you pasted the key, and that you are using the main account key with the main account (not a sub-account key).
Permission denied on futures orders Tick Perpetual Futures Trading on the key and open the futures account once in the BingX app.
Key suddenly stopped working Trading keys without an IP whitelist are deleted after 14 inactive days. Create a new key and link your server IP.
IP not allowed Your server IP changed or is missing from the whitelist. Add the current outbound IP.
Timestamp or recvWindow errors Sync your server clock with NTP.

Fees and EU availability

Bot strategies trade often, so fees matter. See BingX fees. BingX EU holds a MiCA licence, but the EU service is not live yet. Until it launches, EU residents should check which BingX entity they sign up with.

Frequently asked questions

Can I use a trading bot on BingX?

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

Does the BingX API need a passphrase?

No. You need only the API key and secret.

Should I enable withdrawal permission on my BingX API key?

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

Does BingX have a demo or testnet API?

BingX offers a demo (VST virtual USDT) environment for perpetual futures. ccxt points to it with set_sandbox_mode(True), which uses the open-api-vst host.

Why did my BingX API key stop working?

Up to 20 IP addresses per key, separated by commas. Keys with trading, transfer or sub-account permissions that are not linked to an IP are deleted automatically after 14 days with no API calls. Read-only keys and IP-linked keys do not expire.

Is BingX supported by ccxt?

Yes, as “bingx”.

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