How to get a TradeStation API key

TradeStation issues API keys (client id and secret) on request to funded account holders. You then log in once through OAuth to obtain a refresh token.

About 30 minutes 4 steps Checked October 2026

Before you start

  • A funded TradeStation account
  • An email to TradeStation Client Experience
  • A local callback URL such as http://localhost:3000

Create your TradeStation API key

  1. 1

    Request a WebAPI key

    Contact TradeStation Client Experience from your account email and ask for a WebAPI key, giving your callback URL(s).

  2. 2

    Receive the key

    You receive a client id (API key) and client secret. Store them as TRADESTATION_CLIENT_ID and TRADESTATION_CLIENT_SECRET.

  3. 3

    Authorize in the browser

    Open https://signin.tradestation.com/authorize?response_type=code&client_id=…&redirect_uri=…&audience=https://api.tradestation.com&scope=openid offline_access MarketData ReadAccount Trade, log in and copy the returned code.

  4. 4

    Exchange for tokens

    POST the code to https://signin.tradestation.com/oauth/token with your client id, secret and redirect URI. Save the refresh_token.

Test the key

Before wiring the key into a strategy, make one request by hand. It separates “the key is wrong” from “my code is wrong”.

curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \
  "https://sim-api.tradestation.com/v3/marketdata/barcharts/MSFT?interval=1&unit=Daily&barsback=5"
A Bars array means the token works. 401 means the 20-minute access token expired.

Keep the credentials safe

  • Store values in a password manager or a git-ignored .env, never in code or notebooks you share.
  • In an AlgoGP project you can still add them under APIs & keys (encrypted at rest) and read them with strategy_runtime.secrets.get("TRADESTATION_CLIENT_ID").
  • Give each bot its own credential so you can revoke one without stopping the others.
TRADESTATION_CLIENT_ID=paste-your-value-here
TRADESTATION_CLIENT_SECRET=paste-your-value-here
TRADESTATION_REFRESH_TOKEN=paste-your-value-here
.env for local runs

Frequently asked questions

How long do TradeStation tokens last?

Access tokens 20 minutes; refresh tokens indefinitely by default unless rotation is enabled.

Design and backtest your TradeStation strategy first

AlgoGP turns an idea into Python and tests it on years of history before you connect it to TradeStation. The exported code keeps the broker behind four small adapter methods.

  • AI copilot writes and revises the rules
  • Backtests with realistic costs
  • Exported Python ready to wire to TradeStation

Free plan, no card required.

How the TradeStation API works

AlgoGP is not affiliated with TradeStation. Menus get renamed from time to time; if a label differs, the official documentation has the current path.