How to get a tastytrade API key

tastytrade has no static API key; you create OAuth credentials once and refresh tokens from code.

About 10 minutes 4 steps Checked November 2026

Before you start

  • An open tastytrade account
  • Two-factor authentication enabled

Create your tastytrade API key

  1. 1

    Open API settings

    Log in at my.tastytrade.com and go to Manage → My Profile → API.

  2. 2

    Create an OAuth application

    Under OAuth Applications create one; copy the client id and the client secret (shown once).

  3. 3

    Create a personal grant

    Click Manage → Create Grant to get a refresh token for your own account.

  4. 4

    Store the three values

    Save TASTYTRADE_CLIENT_ID, TASTYTRADE_CLIENT_SECRET and TASTYTRADE_REFRESH_TOKEN in Keys & secrets or .env.

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 https://api.tastyworks.com/oauth/token \
  -d grant_type=refresh_token -d refresh_token="$TASTYTRADE_REFRESH_TOKEN" \
  -d client_id="$TASTYTRADE_CLIENT_ID" -d client_secret="$TASTYTRADE_CLIENT_SECRET"
A JSON body with access_token means the credentials work.

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("TASTYTRADE_CLIENT_ID").
  • Give each bot its own credential so you can revoke one without stopping the others.
TASTYTRADE_CLIENT_ID=paste-your-value-here
TASTYTRADE_CLIENT_SECRET=paste-your-value-here
TASTYTRADE_REFRESH_TOKEN=paste-your-value-here
.env for local runs

Frequently asked questions

Does the refresh token expire?

No, but revoking the grant invalidates it. Access tokens last about 15 minutes.

Design and backtest your tastytrade strategy first

AlgoGP turns an idea into Python and tests it on years of history before you connect it to tastytrade. 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 tastytrade

Free plan, no card required.

How the tastytrade API works

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