Skip to main content

Creating a BitMEX API Key

This guide walks you through creating a BitMEX API key for automated trading and securing it for bot access.

Info

BitMEX is a peer-to-peer cryptocurrency derivatives trading platform. API keys enable trading bots to programmatically access your account for automated trading strategies.

Step-by-Step Guide to API Key Creation

  1. Log into BitMEX: Access your BitMEX account and confirm two-factor authentication (2FA) is enabled.

  2. Navigate to API Keys: Open the 'API Keys' section under your account name or security settings.

  3. Initiate API Key Creation: Select 'Create New API Key' (or similar) to begin. Your new key consists of an ID and a Secret.

  4. Name Your API Key (CIDR):

    • Set a clear, descriptive name (CIDR on BitMEX) that helps identify the key's purpose, for example, "Gunbot_XBTUSD_Strategy".
    • Clear naming helps manage multiple API keys if you use different bots or strategies.
  5. Configure API Key Permissions: Enable only the permissions you need:

    • Order: Allows placing and canceling orders. This is typically required.
    • Position: Allows viewing of your current positions.
    • Optionally, 'Order Cancel' if you need a key that can only cancel orders but not create new ones (less common for full trading bots).
    • Crucially, do NOT select 'Withdraw' permission. This is a vital security measure. Keep permissions minimal.
  6. IP Whitelisting (Highly Recommended):

    • Use the 'CIDR' field to restrict access to your bot's static IP address (e.g., 123.45.67.89/32). If you have a range, specify it.
    • This helps prevent unauthorized access if your API key is compromised.
  7. Finalize API Key Setup:

    • Review permissions and IP restrictions (CIDR).
    • Complete any required 2FA steps to confirm the key creation.
    • Securely store your API Key ID and Secret (the Secret is shown only once).

BitMEX API key creation interface with trading permissions and security settings

You can usually access your API settings directly through BitMEX API Management.

A well-configured API key supports secure automated trading. Audit API keys regularly, and never share your API credentials. If you plan multi-venue automation after BitMEX setup, review all exchange integrations.