Skip to main content
API keys authenticate your requests to Baseten. You need an API key to:
  • Deploy models, Chains, and training projects with the Truss CLI.
  • Call model endpoints for inference.
  • Use the management API.

API key types

Baseten supports two types of API keys: Personal API keys are tied to your user account. Actions performed with a personal key are attributed to you. Use personal keys for local development and testing. Team API keys are not tied to an individual user. When your organization has teams enabled, team keys can be scoped to a specific team. Team keys can have different permission levels:
  • Full access: Deploy models, call endpoints, and manage resources.
  • Inference only: Call model endpoints but cannot deploy or manage.
  • Metrics only: Export metrics but cannot deploy or call models.
Use team keys for CI/CD pipelines, production applications, and shared automation.
If your organization uses teams, Team Admins can create team API keys scoped to their team. See Teams for more information.

Environment-scoped API keys

Environment-scoped API keys are team API keys restricted to specific environments. Use them for least-privilege access when sharing keys with external partners or production integrations. You can scope a key in two ways:
  • By environment: The key can only call models in the selected environments (for example, production only, or production and staging).
  • By environment and model: The key can only call specific models within the selected environments.
To create an environment-scoped key, select Manage and call all team models or Call certain models when creating a team API key, then choose the environments from the Environment access dropdown.

Create an API key

  1. Navigate to API keys in your account settings.
  2. Select Create API key.
  1. Select Personal and click Next.
  2. Enter a name for the key (lowercase letters, numbers, and hyphens only).
  3. Select Create API key.
Copy the key immediately. You won’t be able to view it again.

Use API keys with the CLI

The first time you run truss push, the CLI prompts you for your API key and saves it to ~/.trussrc:
$ truss push
💻 Let's add a Baseten remote!
🤫 Quietly paste your API_KEY:
💾 Remote config `baseten` saved to `~/.trussrc`.
To manually configure or update your API key, edit ~/.trussrc:
[baseten]
remote_provider = baseten
api_key = YOUR_API_KEY

Use API keys with endpoints

To call model endpoints with your API key, see Call your model.

Manage API keys

The API keys page shows all your keys with their creation date and last used timestamp. Use this information to identify unused keys. To rename a key, select the pencil icon next to the key name. To rotate a key, create a new key, update your applications to use it, then revoke the old key. To revoke a key, select the trash icon next to the key. Revoked keys cannot be restored. You can also manage API keys programmatically with the REST API.

Security recommendations

  • Store API keys in environment variables or secret managers, not in code.
  • Never commit API keys to version control.
  • Use environment-scoped keys to limit access to specific environments and models.
  • Use team keys with minimal permissions for production applications.
  • Rotate keys periodically and revoke unused keys.