Skip to content

Deploy Tokens

Deploy tokens let you deploy your applications to FastAPI Cloud from CI/CD systems without using your personal account credentials.

To create a deploy token through the dashboard:

  1. Navigate to your app
  2. Select Deploy Tokens option from the sidebar
  3. Click Create Token
  4. Enter a name for the token
  5. Set the expiration period (1-365 days, default is 90 days)
  6. Click Create Token

After creation, you’ll see the token value. Copy it immediately as it will only be displayed once. If you lose the token value, you’ll need to regenerate or create a new token.

Once you have a deploy token, set it along with your app ID as environment variables:

Terminal window
export FASTAPI_CLOUD_TOKEN='your-token'
export FASTAPI_CLOUD_APP_ID='your-app-id'
fastapi deploy

Or you can also pass the app ID as a command line flag:

Terminal window
export FASTAPI_CLOUD_TOKEN='your-token'
fastapi deploy --app-id 'your-app-id'

First, you have to add the deploy token and app ID as GitHub Secrets in your repository settings:

  • FASTAPI_CLOUD_TOKEN: Your deploy token
  • FASTAPI_CLOUD_APP_ID: Your FastAPI Cloud app ID

Then, you’ll be able to use them in your GitHub Actions workflow, for example:

name: "Deploy"
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
name: "Deploy"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v7
- name: Deploy to FastAPI Cloud
run: uv run fastapi deploy
env:
FASTAPI_CLOUD_TOKEN: ${{ secrets.FASTAPI_CLOUD_TOKEN }}
FASTAPI_CLOUD_APP_ID: ${{ secrets.FASTAPI_CLOUD_APP_ID }}

In your app’s Deploy Tokens settings, you can see all tokens with their:

  • Name: The descriptive name you assigned
  • Last Used: When the token was last used for a deployment
  • Expiration: When the token will expire
  • Status: Active or Expired

If you need to rotate a token (e.g., for security reasons), you can regenerate it:

  1. Find the token in the Deploy Tokens list
  2. Click the regenerate icon
  3. Confirm the action

The old token value will be immediately invalidated, and a new value will be generated. Make sure to update your CI/CD secrets with the new token value.

To revoke a token:

  1. Find the token in the Deploy Tokens list
  2. Click the delete icon
  3. Confirm the deletion

Deleted tokens are immediately invalidated and cannot be recovered.

Deploy tokens have a configurable expiration period between 1 and 365 days. When a token expires:

  • Deployments using the expired token will fail
  • The token will show as “Expired” in the dashboard
  • You can regenerate the token to extend its validity

Consider setting calendar reminders to rotate tokens before they expire to avoid deployment interruptions.

  • Token values are shown once: Copy the token immediately after creation. If lost, you must regenerate or create a new token.
  • Expired tokens can be regenerated: You don’t need to create a new token when one expires; regenerating will create a new value with a fresh expiration.