Deploy Tokens
Deploy tokens let you deploy your applications to FastAPI Cloud from CI/CD systems without using your personal account credentials.
Creating a Deploy Token
Section titled “Creating a Deploy Token”To create a deploy token through the dashboard:
- Navigate to your app
- Select Deploy Tokens option from the sidebar
- Click Create Token
- Enter a name for the token
- Set the expiration period (1-365 days, default is 90 days)
- 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.
Using Deploy Tokens
Section titled “Using Deploy Tokens”Once you have a deploy token, set it along with your app ID as environment variables:
export FASTAPI_CLOUD_TOKEN='your-token'export FASTAPI_CLOUD_APP_ID='your-app-id'
fastapi deployOr you can also pass the app ID as a command line flag:
export FASTAPI_CLOUD_TOKEN='your-token'
fastapi deploy --app-id 'your-app-id'GitHub Actions Example
Section titled “GitHub Actions Example”First, you have to add the deploy token and app ID as GitHub Secrets in your repository settings:
FASTAPI_CLOUD_TOKEN: Your deploy tokenFASTAPI_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 }}Managing Deploy Tokens
Section titled “Managing Deploy Tokens”Viewing Tokens
Section titled “Viewing Tokens”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
Regenerating a Token
Section titled “Regenerating a Token”If you need to rotate a token (e.g., for security reasons), you can regenerate it:
- Find the token in the Deploy Tokens list
- Click the regenerate icon
- 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.
Deleting a Token
Section titled “Deleting a Token”To revoke a token:
- Find the token in the Deploy Tokens list
- Click the delete icon
- Confirm the deletion
Deleted tokens are immediately invalidated and cannot be recovered.
Token Expiration
Section titled “Token Expiration”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.
Important Notes
Section titled “Important Notes”- 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.