Bybit API Key Setup for Trading Bots 2026: Security Guide

How to generate and secure a Bybit API key for any trading bot in 2026 — permission scopes, IP whitelisting, rotation schedules, and Bitsgap as a worked example.

Any bot you connect to Bybit — Bitsgap, Cryptohopper, 3Commas, a custom script running on Hummingbot, or anything else — depends on the same foundation: an API key with the right permissions and enough security hygiene around it that a leak doesn’t become a disaster. This guide is a deep-dive on that foundation specifically, written for traders in supported regions who want to understand API key mechanics well enough to configure any bot safely, not just follow a single platform’s click-through wizard. We’ll use Bitsgap as the primary worked example throughout because it’s a widely used, well-documented case, but everything about permission scopes, IP whitelisting, and rotation applies regardless of which bot platform you ultimately connect. Before diving in, the Free BTC AI Predictor is worth bookmarking as a companion tool for whatever strategy you end up automating once your API setup is locked down.

Analytics dashboard on a large monitor showing security and account activity metrics

Recommended exchange

Bybit

800+ coins on spot at 0.10%, USDT perps at 0.02% maker / 0.055% taker, free Grid/DCA/Combo bots, copy trading, TradFi CFDs (SpaceX xStocks, Apple, NVIDIA), and Unified Trading Account. Not available to US, Canada, UK, Singapore, Hong Kong, or Mainland China residents — EEA users use bybit.eu instead.

Sign up on Bybit →

Why API Key Security Deserves Its Own Deep-Dive

Most trading bot tutorials treat the API key step as a two-line footnote — “generate a key, paste it in, done.” That undersells how much of your actual financial risk in this whole automation setup lives in that one step. A bot itself, whether it’s Bitsgap’s grid engine or a custom script, can only do what its API key permits. If the key permits withdrawal, a compromised key is a direct path to losing funds. If the key is scoped to read and trade only, a compromised key can, at worst, place unwanted trades — annoying and potentially costly, but fundamentally recoverable, since the funds never leave the exchange. That asymmetry is why this single configuration screen matters more than almost anything else in the bot setup process, and why it’s worth understanding thoroughly rather than clicking through it quickly.

Bybit’s API infrastructure supports the fine-grained permission model that makes this safety possible, and pairing it with a reputable bot platform like Bitsgap — which explicitly requests only read and trade access for its exchange connections — gives you a setup where the worst-case scenario from a key leak is contained rather than catastrophic. That’s the standard every legitimate bot platform should meet, and it’s worth using as your baseline when evaluating any tool, including ones outside this guide’s primary focus.

This matters more in 2026 than it did a few years ago, simply because bot platforms have proliferated and the average trader now has more choices, more marketing claims to sift through, and more opportunities to connect an API key to something that doesn’t deserve the trust. Fee structures, subscription pricing, and bot strategy variety are all worth comparing across platforms, but none of that matters if the underlying API connection is configured in a way that puts your capital at unnecessary risk. Treat the permission and security decisions covered in this guide as the non-negotiable baseline, and treat feature comparisons between platforms as the secondary decision that comes after you’re confident the connection itself is safe.

Try it free

Bitsgap

Run GRID, DCA, COMBO, and BTD bots across 15+ exchanges from one dashboard. 7-day free trial, no card needed.

Start Bitsgap free trial →

Generating a Bybit API Key: The Core Steps

Inside Bybit’s account settings, locate API Management, usually accessible from your profile menu. Click to create a new key, and choose the system-generated option unless you have a specific advanced use case requiring a self-generated key pair with your own signature verification. Give the key a clear, descriptive label — something like “Bitsgap Grid Bot” or “Custom DCA Script” — especially if you anticipate managing multiple keys for different bots or strategies over time. A vague label like “API Key 1” becomes a liability months later when you’re trying to remember which key does what and whether it’s safe to delete.

Bybit will then present the permission selection screen, which is the heart of this entire guide. Select read access so your bot platform can see balances, positions, and order history. Select trade access, scoped to the specific product lines you’ll actually bot — Spot, USDT Perpetual, Inverse Perpetual, or others, depending on your strategy. Leave every other permission, especially withdrawal, unchecked. Generate the key, and Bybit will show you the API key and secret exactly once. Copy both into a password manager immediately; the secret cannot be retrieved again after you leave that screen.

Permission Scopes Explained in Depth

Read permission is the least risky scope by a wide margin. It allows a connected application to view your account balance, open positions, and trade history, but grants zero ability to change anything. If you only wanted a bot to send you notifications about your portfolio without ever placing a trade, read-only would be all you’d need — though that’s a narrower use case than most bot platforms exist for.

Trade permission is what actually makes bot automation possible. It allows placing new orders, modifying existing ones, and canceling open orders. This is the permission every grid, DCA, or combo bot needs to function, because the bot’s entire value proposition is placing and managing orders on your behalf without you doing it manually. Trade permission on Bybit can typically be scoped per product line — you can grant trade access for Spot without granting it for Derivatives, which is worth doing deliberately based on what you’re actually automating rather than enabling everything by default.

Withdrawal permission allows moving funds off the exchange entirely, to an external wallet address. No bot platform needs this to function — a grid bot, DCA bot, or any strategy tool operates entirely through placing and canceling orders within your existing balance. There is no scenario in this guide, or in legitimate bot usage generally, where you should enable withdrawal permission on an API key connected to a third-party platform.

Transfer permission, where exposed separately, allows moving funds between different wallet types or sub-accounts within Bybit itself — not off the exchange, but still a capability beyond what standard bot strategies require. Treat it with the same default-off caution as withdrawal unless you have a specific, well-understood reason to enable it.

One detail that trips up traders moving between exchanges or between bot platforms: Bybit’s exact permission labels and groupings have shifted over past interface updates, and different product lines (Spot, USDT Perpetual, Inverse Perpetual, Options) can expose trade permission as separate toggles rather than one unified switch. If you’re bot-trading multiple product types, check each relevant toggle individually rather than assuming one “trade” switch covers everything — a bot that’s supposed to run a USDT perpetual grid but only has Spot trade permission enabled will fail to place orders even though the connection itself looks healthy in Bitsgap’s dashboard.

Organized office desk setup with a monitor displaying charts and a notebook beside it, Clean, minimal office workspace

IP Whitelisting: The Second Layer of Defense

Beyond permission scopes, Bybit lets you restrict an API key to only accept requests originating from specific IP addresses. This matters because even a key with narrow, safe permissions (read and trade only) can still be misused by an attacker to place unwanted or manipulative trades if it’s stolen. An IP whitelist closes that door: if the request isn’t coming from an approved address, Bybit rejects it outright, regardless of whether the key and secret are technically valid.

If you’re connecting to Bitsgap, the platform publishes its outbound IP ranges in its own connection documentation specifically so users can whitelist them on the exchange side. Enter those ranges into Bybit’s IP restriction field when creating or editing the key. If you’re running a custom bot on your own server or a cloud instance, you’d instead whitelist that server’s static IP address — which is why self-hosted or custom bot setups typically require a static, not dynamic, IP to make whitelisting practical.

The trade-off with IP whitelisting is maintenance: if Bitsgap or another platform changes its published IP ranges, or if your own server’s IP changes, the whitelist needs updating or the connection breaks. This is a reasonable cost for the security benefit, but it’s worth knowing about before enabling it, so a sudden “connection failed” error doesn’t catch you off guard — check whether the IP whitelist is the cause before assuming something else broke.

For traders running a custom bot instead of a managed platform like Bitsgap, IP whitelisting is arguably even more valuable, since a self-hosted script often runs continuously on a server you control, making a fixed IP address easy to obtain and maintain (most cloud providers offer static IP allocation as a standard option). In that setup, combining narrow permission scopes with a tight IP whitelist means an attacker would need to both steal your credentials and compromise or spoof your specific server’s network identity to misuse the key — a meaningfully higher bar than credential theft alone.

Recommended exchange

Bybit

800+ coins on spot at 0.10%, USDT perps at 0.02% maker / 0.055% taker, free Grid/DCA/Combo bots, copy trading, TradFi CFDs (SpaceX xStocks, Apple, NVIDIA), and Unified Trading Account. Not available to US, Canada, UK, Singapore, Hong Kong, or Mainland China residents — EEA users use bybit.eu instead.

Sign up on Bybit →

Key Rotation: Why and How Often

API key rotation — periodically deleting an old key and generating a fresh one — isn’t strictly required by Bybit, but it’s a widely recommended security practice for any long-lived credential. The logic is straightforward: the longer a key exists, the larger the window during which it could theoretically be exposed through a leak, a misconfigured backup, a compromised device, or simply human error. Rotating every few months limits how long any single credential stays valid, which limits the damage window if something does go wrong without your immediate knowledge.

A practical rotation routine: every 90 days or so, generate a new API key with the same permission scope as the one you’re replacing, update the connection in Bitsgap (or whichever bot platform you’re using) with the new key and secret, confirm the bot continues functioning correctly with a small test period, and only then delete the old key. This order matters — deleting the old key before confirming the new one works risks an unnecessary connection outage if something goes wrong during the swap. Bybit’s API Management screen shows creation date and last-used timestamp for each key, which makes it easy to audit your current key inventory and spot anything stale or unexpectedly inactive.

Rotation also gives you a natural checkpoint to reassess whether the key’s permission scope still matches your actual usage. If you started with a Spot-only grid bot and have since added a USDT perpetual DCA strategy, a rotation cycle is the right moment to update the new key’s permissions to reflect that expanded usage, rather than accumulating multiple overlapping keys with inconsistent scopes over time. Keeping your active key inventory small, clearly labeled, and scoped tightly to current usage is a simple habit that compounds into meaningfully better security posture the longer you run automated strategies.

Worked Example: Fees and Security Together on a Bitsgap Setup

To ground this in a concrete scenario: suppose you generate a Bybit API key scoped to read and trade on Spot only, with IP whitelisting enabled for Bitsgap’s published ranges, and connect it to a Bitsgap Advanced plan at $69/month. You deploy a spot grid bot on ETH/USDT with $3,000 allocated across 50 grid levels. Over a month, the grid completes 100 full cycles, each netting roughly $10 gross profit — $1,000 gross for the month. Bybit’s spot fee at 0.10% maker/taker applies to each leg: at $60 per grid line, each leg costs $0.06, or $0.12 per round-trip cycle, totaling $12 in cumulative fees across 100 cycles. Add the $69 Bitsgap subscription, and total costs are $81, leaving $919 net profit for the month in this illustrative scenario.

None of that changes based on your API security choices — the fee math is identical whether your key is scoped narrowly and IP-whitelisted or configured carelessly. What changes is your exposure if something goes wrong. With withdrawal disabled and IP whitelisting active, a compromised key in this scenario could, at absolute worst, result in the bot placing unintended trades within your existing $3,000 balance — a bad outcome, but a contained and recoverable one. Without those protections, the same compromise scenario risks the entire $3,000 leaving the exchange outright. The security setup doesn’t change your expected returns; it changes your downside tail risk, which is exactly the kind of asymmetric protection worth taking seriously even though it costs nothing beyond a few extra minutes of setup.

Who This Guide Is For — and Regional Restrictions

This guide applies to any trader connecting any bot platform to Bybit, provided you’re in a region where Bybit accepts retail accounts — most of Latin America, the Middle East (Turkey, Israel, Saudi Arabia), Africa, and much of the Asia-Pacific region including India, Vietnam, Indonesia, and the Philippines. Residents of the United States, United Kingdom, Canada, Singapore, Hong Kong, mainland China, and Japan cannot open a Bybit account at all, which means none of the API key steps here are reachable from those jurisdictions regardless of which bot platform you’re trying to connect. EU/EEA residents are directed to bybit.eu, a separately licensed MiCA-regulated entity, and should confirm that platform’s API interface matches what’s described here before assuming full parity — regulated regional entities sometimes differ in feature rollout timing from the main platform. If you’re in a restricted region, Coinbase is a supported alternative exchange that pairs with other bot platforms offering similar API security models.

Common Security Mistakes

The most common and most damaging mistake, repeated across virtually every bot-related security incident that gets discussed publicly, is enabling withdrawal permission on a bot’s API key — either through carelessness or a mistaken belief that it’s needed for some feature. It never is, for any grid, DCA, or combo strategy. The second mistake is storing API secrets in plaintext files, unencrypted notes apps, or shared documents rather than a proper password manager — a secret that leaks from an insecure storage location is just as dangerous as one leaked through the exchange itself. The third mistake is never auditing existing keys — letting old, unused, or overly broad-permission keys accumulate in your API Management list indefinitely, each one a latent risk surface even if it’s not actively connected to anything anymore. The fourth mistake is skipping IP whitelisting entirely because it seems like an extra step, when in practice it takes only a few minutes and meaningfully raises the bar for what a stolen key can actually do.

Try it free

Bitsgap

Run GRID, DCA, COMBO, and BTD bots across 15+ exchanges from one dashboard. 7-day free trial, no card needed.

Start Bitsgap free trial →
Multiple trading charts with red and green candlesticks displayed across a dashboard

Once your API key is generated, scoped, and whitelisted, and your bot of choice is connected, checking the Free BTC AI Predictor periodically gives you directional context to decide whether your current strategy — grid, DCA, or something more directional — still matches actual market conditions.

FAQ

What’s the single most important API permission setting for a trading bot?

Disabling withdrawal permission. No legitimate bot strategy — grid, DCA, combo, or custom script — needs the ability to move funds off the exchange, and disabling it is the one setting that contains the damage from a worst-case key compromise.

Does IP whitelisting work with bot platforms that don’t have a fixed server location?

It depends on the platform. Bitsgap publishes specific IP ranges precisely so users can whitelist a stable set of addresses. Platforms without published static ranges may not support this feature reliably, in which case narrow permission scoping becomes even more important as your primary defense.

How often should I rotate my Bybit API keys?

There’s no mandatory schedule, but a common practice among careful traders is roughly every 90 days. Generate the new key, confirm the bot reconnects and functions correctly, then delete the old key only after that confirmation.

Can I use one API key for multiple bots or strategies?

You can, but it’s better practice to generate separate, clearly labeled keys per bot or platform. This makes auditing easier and lets you revoke access to one bot without disrupting others.

What happens if my API secret is exposed?

Delete the affected key immediately from Bybit’s API Management screen and generate a replacement. Since the key itself only has read and trade permissions (never withdrawal, if configured correctly), the practical damage from exposure is limited to unwanted trades within your existing balance, not fund loss.

Do all bot platforms request the same permissions as Bitsgap?

Reputable platforms generally request only read and trade access, matching the model described throughout this guide. If a bot platform asks for withdrawal permission or requests you deposit funds into a platform-controlled wallet rather than connecting via API, treat that as a significant red flag.

Can US or UK residents generate a Bybit API key at all?

No. Bybit does not accept retail account registrations from the United States, United Kingdom, Canada, Singapore, Hong Kong, mainland China, or Japan, so the account verification required before reaching API Management isn’t reachable from those regions. EU/EEA residents must use the separately regulated bybit.eu.

Should I use a self-generated or system-generated API key?

System-generated is simpler and is what nearly all third-party bot platforms, including Bitsgap, expect by default. Self-generated key pairs are an advanced option suited to custom scripts or specific signature-verification use cases, not standard bot platform connections.


This is not financial advice. API key security is your responsibility as the account holder; always verify permission settings directly on Bybit before connecting any third-party platform. Bybit is unavailable to residents of the US, UK, Canada, Singapore, Hong Kong, mainland China, Japan, and sanctioned regions; EU/EEA residents must use the separately regulated bybit.eu.

Continue learning

fundamentals

How AI Chatbots Track Your IP — and What to Do About It

AI platforms log your IP address every session. Here's what that data reveals, who can access it, and how NordVPN protects your network identity in 2026.

Read lesson →
fundamentals

AI Context Window Comparison 2026: Gemini, GPT, Claude

Compare AI context windows in 2026 — Gemini 2.5 Pro (1M tokens), GPT-5 (256K), Claude 4 (200K). Learn when each size matters and how to avoid token waste.

Read lesson →
fundamentals

Best AI Stack for Solopreneurs in 2026 (Under $100/Month)

The best AI stack for solopreneurs in 2026 — 5 tools covering content, automation, and outreach for under $100/month, with no team required.

Read lesson →