# 3Commas IP addresses to whitelist, and a safe API key

> Where 3Commas and Bitsgap show the IP addresses to whitelist, and how to make an exchange API key that can trade but never withdraw.

Canonical: https://tradingagentstack.com/guides/safe-exchange-api-key-3commas-bitsgap/

1. [Home](https://tradingagentstack.com/)

2. [Guides](https://tradingagentstack.com/guides/)

# Set up a 3Commas or Bitsgap bot with a safe exchange API key (no withdrawals, IP whitelist)

By [Ahsen Rajab (@Satovinci)](https://tradingagentstack.com/about/)

✓ Written from official docs · checked 2026-11-30

Create an exchange API key that can trade but never withdraw, lock it to the bot's IP addresses, and test on a demo account first. Steps from the 3Commas and Bitsgap help centers.
**Tools in this guide**
- [3Commas](https://tradingagentstack.com/tool/3commas/) [Safety 58%](https://tradingagentstack.com/safety-score/)

- [Bitsgap](https://tradingagentstack.com/tool/bitsgap/) [Safety 50%](https://tradingagentstack.com/safety-score/)

- [Binance](https://tradingagentstack.com/tool/binance/) [Safety 49%](https://tradingagentstack.com/safety-score/)

- [Kraken](https://tradingagentstack.com/tool/kraken/) [Safety 85%](https://tradingagentstack.com/safety-score/)

- [Coinbase Advanced](https://tradingagentstack.com/tool/coinbase-advanced/) [Safety 75%](https://tradingagentstack.com/safety-score/)

Safety scores are calculated from our listing facts. They aren't a ranking, and affiliate links never affect them. [How it works](https://tradingagentstack.com/safety-score/)

## 1. Practice on a demo account first

3Commas has a **Demo account** with virtual funds and live prices (paid plans and the 7-day trial). Build and run your bot there before you connect real money. Bitsgap also offers demo trading on its platform.

## 2. Get the bot's IP addresses

**3Commas:** go to My Exchanges → Add exchange → pick your exchange. The connection widget lists the IP addresses to whitelist. 3Commas says to copy **every** IP shown there, not the ones in screenshots, or the connection can fail.

**Bitsgap:** go to My Exchanges → Add New Exchange (or Fix / Manual Replace on an existing key) and click the copy icon next to Bitsgap's trusted IPs. Bitsgap says IP whitelisting is required for Binance, KuCoin, Kraken and Crypto.com.

## 3. Create the API key on your exchange

1. Open your exchange's API management page (for example Binance: Account → API Management → Create API).

2. Turn on **Read** and **Spot trading** (and Futures only if your bot trades futures).

3. **Leave withdrawals off.** 3Commas: provide trading access only and disable withdrawals. Bitsgap rejects any key with withdrawals enabled and shows a "Withdrawal enabled" error.

4. Choose **Restrict access to trusted IPs only** and paste the IP list from step 2.

5. Copy the API key and secret somewhere safe. The secret is usually shown only once.

## 4. Connect the key to the bot

Paste the key and secret into 3Commas (My Exchanges → Add exchange) or Bitsgap (My Exchanges → Add New Exchange → Connect). Both check the connection. If it fails, the usual causes are a missing IP, missing trade permission or unfinished KYC on the exchange.

## 5. Check the key, then start small

- On the exchange, confirm the key shows trade permission, no withdrawal permission and the IP restriction.

- Run the bot with a small allocation first. Use a sub-account if your exchange offers one, so the bot can only reach that balance.

- Delete keys you no longer use. 3Commas asks you to create new keys when its IP list changes.

## FAQ

### Can 3Commas or Bitsgap withdraw my funds?

Not with a key set up like this. Both tell you to leave the withdrawal permission off, and Bitsgap refuses keys that have it on. Without that permission the key can trade but can't move funds off the exchange.

### Why whitelist IPs?

With an IP restriction, the exchange rejects requests from any other address, so a leaked key is much less useful to an attacker. Some exchanges also make keys without an IP restriction expire.

## Sources

- [3Commas: Create and connect API keys](https://help.3commas.io/en/articles/16281186-create-and-connect-api-keys)

- [3Commas: Troubleshoot API connection issues](https://help.3commas.io/en/articles/5668028-troubleshoot-api-connection-issues)

- [3Commas: Demo account](https://help.3commas.io/en/articles/3108963-demo-account-practice-trading-with-virtual-funds)

- [Bitsgap: How to connect your exchange](https://bitsgap.com/helpdesk/article/13091203806364-How-to-Connect-Your-Exchange-to-Bitsgap)

- [Bitsgap: Does Bitsgap have access to my wallet?](https://bitsgap.com/helpdesk/article/9970764647964-Does-Bitsgap-have-access-to-my-exchange-wallet)

- [Bitsgap: Trusted IP addresses](https://bitsgap.com/helpdesk/article/9948309520924-Updating-API-Key-Permissions-with-Trusted-IP-Addresses)

Not financial advice. Trading involves risk; test on paper first.

## Related guides

- [How to connect Claude to Alpaca via MCP](https://tradingagentstack.com/guides/connect-claude-to-alpaca-mcp/)

- [How to connect Claude (or any MCP client) to Interactive Brokers](https://tradingagentstack.com/guides/connect-claude-to-ibkr-mcp/)

- [How to connect Claude to the tastytrade MCP server](https://tradingagentstack.com/guides/connect-claude-to-tastytrade-mcp/)

- [How to connect Claude (and other AI agents) to the Robinhood Trading MCP](https://tradingagentstack.com/guides/connect-claude-to-robinhood-mcp/)

- [How to connect Claude to TradeStation MCP](https://tradingagentstack.com/guides/connect-claude-to-tradestation-mcp/)

- [How to connect Claude (and other AI apps) to the Public hosted MCP server](https://tradingagentstack.com/guides/connect-claude-to-public-mcp/)

- [Connect ChatGPT, Cursor or Claude Code to Interactive Brokers (IBKR MCP)](https://tradingagentstack.com/guides/ibkr-mcp-chatgpt-cursor-claude-code/)

- [How to connect Claude, ChatGPT or Cursor to the Tradier MCP server (paper first)](https://tradingagentstack.com/guides/connect-claude-to-tradier-mcp/)

- [How to connect Claude or Cursor to the moomoo MCP server (OAuth scopes explained)](https://tradingagentstack.com/guides/connect-claude-to-moomoo-mcp/)

- [Run Freqtrade in dry-run mode (paper trading with a simulated wallet)](https://tradingagentstack.com/guides/freqtrade-dry-run/)

- [Give an AI agent IBKR paper trading access (TWS API or Web API)](https://tradingagentstack.com/guides/ibkr-paper-trading-api-for-ai-agents/)

[Need a custom AI trading agent built? Broker or exchange integration, MCP setup, Polymarket/Kalshi bots, safety guardrails, VPS deployment. →](https://tradingagentstack.com/go/build?from=/guides/safe-exchange-api-key-3commas-bitsgap/&cta=generic-guide)

Building an agent on this? When it trades a public account on Hyperliquid or Polymarket, [get its track record verified](https://tradingagentstack.com/get-your-ai-agent-verified/): we check it from public data on the spot, then list it with a signed record. See [the AI trading bot leaderboard](https://tradingagentstack.com/ai-trading-leaderboard/), and how the agents already out there are doing in the [AI trading bot statistics](https://tradingagentstack.com/ai-trading-bot-statistics/).

## For agents

- [When to use this site, and the page index](https://tradingagentstack.com/llms.txt)
- [Sitemap](https://tradingagentstack.com/sitemap.xml)
- [Contact](https://tradingagentstack.com/contact/)
- [MCP server](https://tradingagentstack.com/mcp/)
- [MCP discovery](https://tradingagentstack.com/.well-known/mcp)
