API Keys
API keys authenticate your applications with MutagenT. All API keys use themt_ prefix. Learn how to create, manage, and securely use them.
Creating API Keys
Open Dashboard
Navigate to app.mutagent.io/settings/api-keys
Create Key
Click Create API Key and configure:
- Name: Descriptive name (e.g., “Production Server”)
- Scope: Workspace, Organization, or User
- Permissions: Select required permissions
Key Scopes
| Scope | Access Level | Headers Required | Use Case |
|---|---|---|---|
| Workspace | All workspace resources | None (auto-inferred) | Team projects, shared prompts (recommended for CLI) |
| Organization | All org resources | x-workspace-id required | Cross-workspace access |
| User | Your resources across orgs | x-workspace-id + x-organization-id | Admin tools, personal development |
Using API Keys
Environment Variables (Recommended)
CLI Authentication
SDK Configuration
Tracing Configuration
The tracing module readsMUTAGENT_API_KEY automatically, or you can pass the key explicitly:
HTTP Headers
For direct API calls:Workspace and Org Defaults
If you use an organization-scoped or user-scoped key, set defaults with the CLI:Security Best Practices
Use environment variables
Use environment variables
Store keys in
.env files and load with dotenv or your framework’s config system. Add .env to your .gitignore.Rotate keys regularly
Rotate keys regularly
Create new keys periodically and revoke old ones from the dashboard.
Use workspace-scoped keys
Use workspace-scoped keys
Workspace-scoped keys are the most restrictive scope that still works without additional headers. Use them unless you need cross-workspace access.
Monitor usage
Monitor usage
Review API key usage in the dashboard to detect anomalies.