Skip to main content
API keys authenticate deployment, inference, and Management API requests. Choose the credential that fits your task, then create, rotate, and revoke keys as your workloads change.

Choose a credential

Use CLI sign-in or a scoped team API key for every workload. Use a personal API key only for short-lived testing on your own machine: it carries all of your permissions, and Baseten revokes it when you’re deprovisioned or after 30 days without use.

Key types

Personal API keys are tied to your user account and carry your account’s permissions. Baseten attributes actions performed with a personal key to you. Team API keys belong to a team, independent of any individual user. When your organization has teams enabled, team keys can be scoped to a specific team. Choose one permission for a team key:
  • Full access to all team models: Everything except managing the team and its API keys, including deploying, calling, and training.
  • Invoke dedicated models: Call the dedicated models you select, plus Chains when the key covers every model and environment. It can’t call Model APIs, deploy, train, or export metrics.
  • Invoke Model APIs: Call the Model APIs you select. It can’t call dedicated models, deploy, train, or export metrics.
  • Export metrics for team models: Export metrics for the models you select. It can’t call models, deploy, or train.
For CI that starts Loops runs or Training Jobs and deploys checkpoints, choose Full access to all team models in the team that owns the training resources. Invoke dedicated models grants inference access; it doesn’t authorize starting training or deploying checkpoints. Ask a Team Admin to create the key if you can’t select the team. API key management keys are scoped to your organization. Use them to automate team key creation and to list or revoke team and personal keys. For more information, see API key management keys.
If your organization uses teams, Team Admins can create team API keys scoped to their team. For more information, see Teams.

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 Invoke dedicated models when creating a team API key, then choose the environments under Environment access. For a Full access to all team models key, Restricted environment access chooses which restricted environments the key can also manage.

API key management keys

Use an API key management key to provision and rotate team keys without an individual’s credentials. A management key can:
  • List teams and models to find the IDs used to scope new keys.
  • Create team API keys of any permission level.
  • List team API keys and members’ personal API keys.
  • Revoke team and personal API keys.
A management key can’t invoke or manage models, create personal keys, or create other management keys. Only organization Admins can create, rename, or revoke management keys. For more information, see Create an API key.

Key expiration

Set an expiration when you create a key. You can’t change it afterward; rotate the key to replace it with one that has a different expiration. An expired key stops authenticating requests. The dashboard offers 7 days, 30 days, and 90 days, subject to your organization’s limits. Team and API key management keys also offer Never when no limit applies. The Baseten CLI and Management API accept a future timestamp within the applicable limit. Organization Admins can set expiration limits for new keys; changing a limit doesn’t change existing keys. Keys created before expiration was introduced have no expiration. Expired keys stay on the API keys page, marked Expired in the Expires column, so you can recreate them. Revoked keys can’t be recreated. Baseten emails the key’s creator a reminder a week before expiration and again the day before. Each reminder includes the key’s last-used timestamp. Team Admins also receive reminders for team keys; Organization Admins receive them for API key management keys.

Automatic revocation of unused personal keys

Baseten automatically revokes personal API keys that haven’t authenticated a request in 30 days, including personal keys with no expiration. Team and API key management keys aren’t revoked for inactivity. Their configured expiration still applies. Check personal keys’ last-used timestamps on the API keys page to find keys approaching revocation. Use a team key for workloads that run less often than every 30 days. Revocation is permanent; create a replacement and update the affected clients to restore access.

Create an API key

Choose a credential before you create a key. Create a separate key for each application and environment, so you can revoke one without interrupting the others.
To create an API key:
1

Open the API keys page

Sign in to your workspace at app.baseten.co and open API keys under Organization settings.
2

Name the key

Choose Create API key. For Name, enter a name using lowercase letters, numbers, and hyphens, such as production-inference.
3

Set access and expiration

Select the key type for your workload:
  1. Select Personal.
  2. For Expiration, choose an available duration within your organization’s limit, up to 90 days.
The key inherits your account’s permissions.
  1. Select Team.
  2. For Expiration, choose an available duration, or Never if your organization allows keys without an expiration.
  3. Choose Next.
  4. Under Team scope, select the team that owns the resources.
  5. Under Permissions, select the access the key needs:
    • Full access to all team models: Deploy, call, train, and manage the team’s models.
    • Invoke dedicated models: Call the dedicated models you select.
    • Invoke Model APIs: Call the Model APIs you select.
    • Export metrics for team models: Export metrics without deployment or inference access.
  6. Narrow the key’s access for the permission you chose:
    • For Invoke dedicated models or Export metrics for team models, select models under Model access. Select the option for all models, such as All dedicated models, only when the key needs every model in the team, including models added later. For Invoke dedicated models, choose environments under Environment access.
    • For Invoke Model APIs, select Model APIs under Model API access.
    • For Full access to all team models, use Restricted environment access to choose which restricted environments the key can also manage.
Only Organization Admins can create these keys.
  1. Select API key management.
  2. For Expiration, choose an available duration, or Never if your organization allows it.
4

Create and save the key

Choose Create API key and copy the key immediately; Baseten shows it only once. Store it in a secret manager or your CI provider’s secret store, separate from source code, notebooks, and container images.
5

Check the key's access

Confirm that the new key’s Owner and Expires values match your selections. For a team key, open its details and check the permissions, allowed models, and environment restrictions.

Use API keys with CLIs

The Baseten CLI reads an API key from the BASETEN_API_KEY environment variable. To sign in through your browser or save an API key in a profile, run the following command:
Command
Sign-in prompt
For more information about non-interactive sign-in and credential profiles, see baseten auth login. For the Truss CLI, the first truss push asks how to authenticate, with the same choice of pasting an API key or logging in via browser (OAuth). You can also sign in before pushing with truss login or its alias, truss auth login. For more information about credential storage, OAuth, and multiple remotes, see truss auth. To configure or update an API key manually, edit ~/.trussrc:

Use API keys with endpoints

Set your key as an environment variable, or store it in your secret manager:
Pass your API key in the Authorization header using the Bearer scheme:
Bearer works with OpenAI-style clients and AI gateways such as LiteLLM and OpenRouter without extra configuration. Baseten also accepts the legacy Api-Key scheme on every endpoint, so existing scripts using Authorization: Api-Key <key> continue to work:
Send requests from your backend. Anyone who uses a browser or mobile app can read a key embedded in it. Keep keys out of logs and coding agent prompts as well; have an agent read the key from the environment variable. For more information, see Call your model.
Frontier Gateway federated API keys are the exception: they only accept the Api-Key scheme. Workspace API keys used to manage gateway groups still accept either scheme.

Rotate a key

Create a replacement with the original key’s type, team, model access, and environment restrictions. Update and test the workload with the replacement before revoking the original. To change the expiration of an existing key, set the new expiration on its replacement. To recreate a key in the dashboard, you must own the personal key, be a Team or Organization Admin for a team key, or be an Organization Admin for a management key. Seeing a key in the list doesn’t grant permission to recreate it.
1

Create a replacement

Use dashboard recreation for environment-restricted keys and keys that only call Model APIs. It copies the original key’s current permissions. For CLI and REST creation, preserve the type, team, and complete model list from your provisioning configuration.
To recreate the key with its existing access:
  1. On the API keys page, choose API key actions next to the original key, then Recreate API key.
  2. For Name, enter a new name, such as production-inference-replacement.
  3. For Expiration, choose how long the replacement should last.
  4. Choose Create API key and copy the new key immediately.
The replacement appears as a separate key with its own expiration. The original key remains unchanged. You can recreate an expired key, but not a revoked one.
2

Check the replacement's access

Check the replacement’s type, team, and expiration on the API keys page, with baseten org api-key list, or with List API keys. Confirm that it has a different prefix from the original.Check the complete model list in the dashboard or REST listing. Check environment restrictions and Model APIs access in the dashboard; neither listing includes these settings.
3

Update and test the workload

Update the application’s secret or environment variable to use the replacement. Restart or redeploy the application if it loads credentials only at startup.Run an operation the workload normally performs with the replacement key, such as an inference request or a metrics export. Confirm that it returns the expected result without authentication or permission errors before revoking the original.
4

Revoke the original

Revoke the original key by its original prefix. Keep the replacement active and confirm that the workload continues to succeed afterward.

Revoke a key

Revocation is permanent, and requests using the key stop authenticating. If a workload still needs the access, rotate its key first. If a key is exposed, revoke it and check for unauthorized use.
To revoke an API key:
  1. On the API keys page, choose API key actions next to the key, then Revoke API key.
  2. Choose Delete key to confirm.
The key no longer appears in the active key list.

Respond to an exposed key

A key is exposed once it appears where others can read it, such as a commit, a log, or a shared message. Treat the key as exposed even after you delete the commit or message.
  1. Revoke the key. Requests that use it stop authenticating.
  2. Create a replacement and update the workloads that used the exposed key.
  3. Check the audit log for actions the key performed, and your usage for unfamiliar requests.

Rename a key

Rename keys in the dashboard:
  1. On the API keys page, choose the key to open its details.
  2. Choose Edit name, enter a new name, and save it.
The list shows the updated name. The key’s value and permissions stay the same. The CLI and Management API don’t rename keys.

Administer API keys

The API keys page shows each visible key’s creation date, expiration, and last-used timestamp. Use expiration dates to plan rotation. Use last-used timestamps to find personal keys approaching automatic revocation, and to find keys that nothing uses so you can revoke them.

View and revoke keys as an organization Admin

Organization Admins see every key in the workspace: all team API keys plus every member’s personal API keys. The Owner column shows who each key belongs to: the owning member for personal keys, or the team for team keys. Use the Member, Team, and Type filters to narrow the list. Organization Admins can revoke any key in the workspace, including other members’ personal keys. Admins can’t rename other members’ personal keys. To see who created a team API key, check the audit log. All other roles see their own personal keys and any team keys they created. Team Admins also see every key scoped to their teams. The list API keys endpoint follows the same visibility rules. Each personal key includes an owner object with the member’s user_id, email, and name. API key management keys can list and revoke team and personal keys across the organization, making them suitable for automated key rotation and cleanup.

Set expiration limits

As an Organization Admin, set separate expiration limits for personal keys and for team and API key management keys in the dashboard. Changes apply only to new keys; the CLI and Management API don’t expose these settings.
  1. On the API keys page, under Expiration configuration, choose Set expiration limits.
  2. For Personal key expiration, select 7, 30, or 90 days. Default (90 days) keeps the 90-day maximum.
  3. For Team & Organization key expiration, select 7, 30, or 90 days, 1 year, or No limit. This limit applies to team and API key management keys.
  4. Choose Save.
The summary under Expiration configuration shows the saved limits. When you create a key, the Expiration menu offers only values within them, and Never is unavailable when a limit applies to team and API key management keys. The audit log records each change.

Control who can create API keys

As an Organization Admin, you can stop new personal API keys, new team and API key management keys, or both. Existing keys keep working.
These settings are in Private Preview with workload identity federation, and they apply only to organizations that have it turned on. To request access, Contact us.
Get the current organization to read the settings, or update the current organization to change them. Omitted fields keep their current values.
boolean
Whether members can create new personal API keys. Set it to true to allow new keys again. null isn’t accepted.
boolean
Whether Team Admins can create team keys and Organization Admins can create API key management keys. Set it to true to allow new keys again. null isn’t accepted. Despite its name, this field doesn’t control service accounts.
Set BASETEN_API_KEY to a Baseten API key with Organization Admin permissions. To stop new personal API keys: Run the following command:
The response returns the updated organization. Check that allow_personal_api_keys is false. To stop new team and API key management keys: Run the following command:
The response returns the updated organization. Check that allow_service_account_api_keys is false.

API key format

Baseten API keys use the stable b10_ prefix so secret-scanning tools can identify exposed credentials. Configure your scanner to match the complete key format:
Keys created before 15:30 UTC on November 9, 2026, don’t contain the b10_ prefix, so this regular expression detects only keys created on or after that time.
If a key is exposed, respond to the exposure.

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.
  • Set the shortest expiration that fits the workload. Rotate keys before they expire.
  • Monitor key creation, deletion, and use through the audit log.