How to Get Free Bybit API Keys: Step-by-Step Guide for Beginners
An exhaustive, beginner-friendly walkthrough to generate, configure, and secure institutional-grade Bybit V5 API access keys without paying any platform fees.
The modern paradigm of quantitative asset management and algorithmic trading relies on automated, real-time communication between trading software and cryptocurrency exchange execution engines. Bybit provides developers and quantitative traders with direct access to their high-throughput V5 API engine completely free of charge. You do not need a paid developer subscription, special tier membership, or upfront deposit to generate API keys.
However, creating an API connection that executes trades seamlessly while keeping your exchange assets protected requires understanding key security fundamentals—including permission scopes, HMAC signature verification, IP whitelisting, and secure secret storage. This step-by-step guide explains how to generate free Bybit API keys safely, configure key permissions correctly, and connect Python trading bots.
1. What Are Bybit API Keys and How Do They Work?
An Application Programming Interface (API) acts as a secure bridge between your external software—such as a Python trading script, TradingView alert handler, or automated trading bot—and Bybit's exchange servers. Instead of manually clicking buttons on a website or mobile app, your software sends automated code instructions to place orders, check balances, or fetch price data.
When you generate an API key pair on Bybit, the system provides two distinct cryptographic strings:
API Key (Public Identifer)
Functions like your account username or public address. It tells Bybit which account is attempting to communicate with the server.
API Secret (Private Key)
Functions like your password or cryptographic signature key. It signs your outgoing requests to verify authenticity. Never share your API Secret with anyone.
Are Bybit API Keys Really 100% Free?
Yes. Bybit does not charge any setup fee, monthly subscription fee, or recurring platform tax for provisioning or maintaining API keys. You can generate up to 20 API keys per master account and sub-account at zero cost. You only pay standard trading fees (Maker and Taker fees) when your software places executed orders in the order book.
Master Account vs. Sub-Account API Keys for Beginners
For complete beginners and automated bot developers, operating under Bybit Sub-Accounts offers an indispensable security layer:
- Master Account API Keys: Have visibility over main wallet balances, sub-account management, and global withdrawal security settings.
- Sub-Account API Keys: Are strictly confined to that specific sub-account ledger. If a sub-account API key is compromised, your master funding wallet and other sub-accounts remain entirely isolated and secure.
Bybit V5 API: The Standard Architecture
Bybit's V5 API engine standardizes data structures across Spot, Linear Futures, Inverse Perpetuals, and Options. It exposes two connection protocols:
- REST API: Used for atomic, state-changing requests such as placing orders, cancelling orders, or checking account balances.
- WebSocket API: Used for low-latency, real-time data streaming such as orderbook changes, ticker updates, and position updates.
2. Step-by-Step Guide to Generate Your Bybit API Key
Generating your free API key takes less than 3 minutes. Follow these exact steps inside your Bybit account dashboard:
Step 1: Complete Account Identity Verification (KYC Level 1)
Before provisioning API keys, ensure your Bybit account has completed at least Individual KYC Level 1. Bybit requires basic identity verification for all API key creation to prevent malicious abuse and maintain compliance.
Step 2: Navigate to API Management
- Log into your Bybit account on a secure web browser.
- Hover over your profile icon in the top right corner of the navigation bar.
- Click on API or navigate directly to Account & Security > API Management.
- Click the yellow button labelled Create New Key.
Step 3: Choose System-Generated vs. Self-Generated RSA Keys
Bybit will prompt you to select between two key generation methods:
- System-Generated API Keys (Recommended for Beginners): Bybit's Hardware Security Modules generate both the API Key and API Secret string automatically. This is fast, secure, and compatible with 99% of trading bots and Python libraries.
- Self-Generated RSA Key Pairs (For Advanced Developers): You use OpenSSL on your local terminal to create an asymmetric RSA key pair. You upload only the public key to Bybit, ensuring your private key never leaves your local hardware.
Self-Generated RSA Key Pair Generation & Isolation Flow
Local Terminal
Uses OpenSSL to generate the asymmetric RSA 2048-bit key pair locally.
Bybit API Architecture
Registers public key to authenticate incoming cryptographically signed payloads.
Offline Key Storage
Private key remains local and encrypted, never transiting the public internet.
Step 4: Configure Name, Permissions, and IP Binding
In the key creation window, enter a descriptive label (e.g. Python-Spot-Bot-Sub1). Select your required permissions (Read-Only or Read-Write) and enter your server's static IP address into the IP restriction field.
Step 5: Authenticate with 2FA and Save Credentials
Enter your Google Authenticator 2FA code or Email verification code. Bybit will display your new API Key and API Secret string. This is the only time your API Secret will ever be shown. Copy both values immediately into a secure environment file (.env) or password manager.
Interactive Bybit API Key Security & Permission Configurator
Select your intended trading use case and adjust settings to verify optimal security and permission defaults.
Recommended Bybit API Settings Matrix
3. Understanding Permission Scopes & Least Privilege Security
The single biggest security mistake beginner traders make is checking every single permission box when creating API keys. Following the Principle of Least Privilege means granting your API key only the exact permissions needed for its specific task.
1. Read-Only Permission
Allows your software to view account balances, active positions, open orders, and historical trades without the ability to open or modify trades. Perfect for portfolio tracking apps and data analysis scripts.
2. Read-Write Permission
Enables your software to execute orders, modify leverage settings, set stop-loss limits, and manage active positions. Required for automated execution bots.
3. Spot & Contract Trading Checkboxes
If your bot only trades Spot markets, check only the Spot Trade permission box and leave Contract/Futures unchecked. If trading Futures, check Contract Order Placement and Position Management.
4. Withdrawal Permission (KEEP DISABLED)
Never check the Withdrawal permission box. Disabling withdrawal capabilities ensures that even if an attacker intercepts your API credentials, they cannot withdraw funds from your account. Withdrawals should always be performed manually through Bybit's website using 2FA.
4. IP Whitelisting & Network Restriction Security
IP Whitelisting is one of the most effective security controls available for API keys. When configured, Bybit's firewall validates the originating IP address of every incoming request.
The 90-Day Auto-Expiration Rule
If you create an API key with "No IP Restriction", Bybit automatically deactivates and deletes the key after 90 consecutive days. Binding your key to at least one valid static IP address removes this limit, giving your key a permanent lifecycle.
How to Bind Static IP Addresses
If you host your bot on a cloud server (AWS, DigitalOcean, Hetzner, Vultr), copy your server's public IPv4 address and paste it into the Bybit IP binding field. If you have multiple servers, separate the IP addresses with commas (e.g. 192.0.2.10,198.51.100.25).
Bybit Special Offer
Grab a $100 sign-up bonus, earn up to $30,000 in deposit bonuses, VIP status upgrades and exclusive algorithmic rewards.
5. Connecting Bybit API Keys in Python (V5 API Example)
Once your API key is generated, you can connect it to your Python scripts. To protect your keys, store your API credentials inside a separate .env environment file rather than placing raw strings inside your Python code.
Step 1: Create a .env File
In your project root folder, create a file named .env and add your keys:
BYBIT_API_KEY="your_public_api_key_here"
BYBIT_API_SECRET="your_private_api_secret_here"Step 2: Python Authentication Script
Below is a complete Python script demonstrating how to construct an HMAC-SHA256 authenticated REST request to fetch account wallet balances using Bybit V5 API endpoints:
import os
import time
import hmac
import hashlib
import requests
from dotenv import load_dotenv
# Step 1: Load credentials securely from environment variables (.env file)
load_dotenv()
API_KEY = os.getenv("BYBIT_API_KEY")
API_SECRET = os.getenv("BYBIT_API_SECRET")
BASE_URL = "https://api.bybit.com" # Production Mainnet endpoint
def generate_v5_signature(secret: str, timestamp: int, api_key: str, recv_window: int, payload: str = "") -> str:
"""
Generates an HMAC-SHA256 signature required for Bybit V5 API authentication.
Payload concatenation format: timestamp + api_key + recv_window + query_string_or_body
"""
param_str = f"{timestamp}{api_key}{recv_window}{payload}"
return hmac.new(
bytes(secret, "utf-8"),
bytes(param_str, "utf-8"),
hashlib.sha256
).hexdigest()
def get_account_balance():
"""
Retrieves real-time account balances under Bybit's Unified Trading Account (UTA).
"""
timestamp = int(time.time() * 1000)
recv_window = 5000 # 5-second tolerance for network latency
endpoint = "/v5/account/wallet-balance"
query_params = "accountType=UNIFIED"
# Compute cryptographic signature
signature = generate_v5_signature(
API_SECRET, timestamp, API_KEY, recv_window, query_params
)
# Required headers for Bybit V5 authenticated requests
headers = {
"X-BBI-APIKEY": API_KEY,
"X-BBI-SIGN": signature,
"X-BBI-TIMESTAMP": str(timestamp),
"X-BBI-RECEIVE-WINDOW": str(recv_window),
"Content-Type": "application/json"
}
url = f"{BASE_URL}{endpoint}?{query_params}"
response = requests.get(url, headers=headers)
return response.json()
# Operational execution test
if __name__ == "__main__":
if not API_KEY or not API_SECRET:
print("[ERROR] Credentials missing! Please set BYBIT_API_KEY and BYBIT_API_SECRET in your .env file.")
else:
print("[INFO] Connecting to Bybit V5 API...")
result = get_account_balance()
print("[SUCCESS] Account Balance Payload Received:")
print(result)6. Essential Security Best Practices for Beginners
Maintaining API security requires ongoing vigilance. Follow this simple security checklist to ensure your trading account remains protected:
1. Add .env to .gitignore
Always include .env in your .gitignore file before committing code to GitHub to prevent public leaks.
2. Rotate Keys Periodically
Rotate your API keys every 60 to 90 days by generating a new key pair and deleting older keys from Bybit API management.
3. Enable Account 2FA
Keep 2-Factor Authentication (Google Authenticator) enabled on your master account for all key management actions.
7. Troubleshooting Common Bybit API Error Codes
When running automated scripts, Bybit's API server returns JSON responses containing numeric error codes if a request fails. Here are the most common error codes beginners encounter and how to fix them:
Error Code 10003: API Key is Invalid
Auth FailureCause: The API Key or Secret string is mistyped, the key was deleted from Bybit, or server system clock drift exceeded the allowed recv_window.
Fix: Re-copy your API key and secret into your .env file. Ensure your system clock is synchronized with NTP servers.
Error Code 33004: IP Address Restriction
Network BlockCause: Your Python script sent a request from an IP address that is not whitelisted on your API key.
Fix: Check your cloud server's outgoing IP address and add it to the IP restriction list in Bybit API Management.
Error Code 10001: Request Parameter Error
Syntax ErrorCause: Invalid payload formatting, missing required parameters, or passing numeric values as floats instead of string formats.
Fix: Verify parameter names against the official Bybit V5 API documentation and format price/quantity numbers as strings.
8. Frequently Asked Questions (FAQ)
Q1: Is there any hidden cost or fee to generate Bybit API keys?
No. Provisioning API keys on Bybit is 100% free. There are no registration fees, monthly subscription charges, or hidden platform costs. You pay standard maker and taker transaction fees only when trades execute.
Q2: How many API keys can I create on Bybit?
You can create up to 20 API keys per Master Account and up to 20 API keys for each Sub-Account, providing ample flexibility for testing and running multiple trading strategies.
Q3: Can someone steal my funds if my API key is leaked?
If you follow security best practices—keeping Withdrawal permissions disabled and restricting access to your static IP address—an attacker cannot withdraw your funds even if your API key string is exposed.
Q4: Why did my API key expire after 90 days?
Bybit automatically expires API keys created without IP restrictions after 90 days as a protective measure. To keep keys active permanently, bind at least one static IP address to the key.
Q5: What should I do if I lose my API Secret?
Bybit displays the API Secret string only once at key creation. If you lose your API Secret, delete the old key pair from API Management and generate a new key pair.
Unlock Seamless High-Performance Execution Vectors on Your Terms Today
Take control of your automated portfolio strategy by deploying clean, reliable connection channels built to institutional security standards.