> ## Documentation Index
> Fetch the complete documentation index at: https://docs.perpsagent.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# How to connect Bybit API 

> Create a trade-only Bybit API key and connect it to the bot — non-custodial.

Perps Agent is **non-custodial**: it trades with **your** Bybit API keys, on **your** account. Capital never leaves Bybit, and the keys are stored **encrypted** (per user). You only ever grant **trade** permission — never withdrawal.

<Steps>
  <Step title="Open Bybit API management">
    Open [**Bybit → API Management**](https://www.bybit.com/app/user/api-management) (or [**testnet API Management**](https://testnet.bybit.com/app/user/api-management) for testing) → **Create New Key** → **System-generated API Keys**.
  </Step>

  <Step title="Set permissions — trade only">
    * **Enable:** Unified Trading → **Trade** (and read), and **Derivatives / Contract — Trade**.
    * **Disable:** **Withdraw** and **Internal Transfer**. The bot never needs them.
    * **IP whitelist (recommended):** bind the key to the server IP running the bot. For local / testnet use you can leave it unbound.
  </Step>

  <Step title="Copy the key and secret">
    Copy the **API Key** and **API Secret**. ⚠️ The secret is shown **once** — save it now.
  </Step>

  <Step title="Connect it in the bot">
    In the Telegram bot, tap **🔑 Re-connect** (or send `/connect`) and follow the prompt to paste your **API Key** and **API Secret**. The bot encrypts and stores them; it never logs them.
  </Step>

  <Step title="Verify">
    Tap **💰 Balance** (or send `/balance`). If your equity shows, you're connected. Use **🗑 Disconnect** any time to remove your stored keys.
  </Step>
</Steps>

<Warning>
  **Never enable withdrawal** on a key you hand to any bot. Never share your API secret. If a key leaks, delete it on Bybit and create a new one. Perps Agent stores keys encrypted, per user, and the on-chain Vault never bridges to your exchange account.
</Warning>

<Note>
  **Testnet vs mainnet.** For testing, create the key on [**testnet.bybit.com**](https://testnet.bybit.com) (the bot defaults to testnet). Use a mainnet key only when you intend to trade real funds.
</Note>

Next: [Fund your MNT wallet](/setup/fund-mnt-wallet) so the bot can pay its on-chain fees on Mantle.
