Skip to main content

Creating an Alpaca API Key for Trading Stocks, ETFs, and Crypto

This guide walks you through setting up API access for Alpaca, a multi-asset broker supporting stocks, currencies, and crypto. You'll learn how to generate API credentials and connect them to Gunbot using the GUI.


Generating Alpaca API Credentials

  1. Log in at https://app.alpaca.markets
  2. Scroll down to the API Keys section on the bottom right of your screen
  3. Click Generate New Keys

Your API Key and Secret Key will be shown only once.
Save both securely before leaving or refreshing the page.

Alpaca API Key screen


Configuring Trading Bot

Set up your bot directly in the GUI using your Alpaca credentials:

  1. Access Settings: Open the bot’s Exchange configuration section.
    1. Enter Credentials:
    • API Key: Your Alpaca markets public API key
    • API Secret: Your generated secret key
  2. Save Exchange: Confirm your exchange setup and proceed to Trading Settings

Gunbot Alpaca API Form


Verification Steps

Complete these final checks to ensure a working connection:

  1. Save Configuration:

    • Make sure your API key and secret were saved successfully
  2. Test Connection:

    • Add a symbol (e.g., USD-TSLA)
    • Start trading
    • Monitor price updates and balance display

Notes

  • You can trade stocks, ETFs, or crypto from the same Alpaca account
  • Always protect your secret key and avoid exposing it in public or shared files
  • Use Paper Trading mode for testing before switching to live accounts

For more details, visit: https://alpaca.markets/docs