Authentication
Mixtrain requires authentication to access the API and manage resources. There are two ways to authenticate depending on your use case.
Interactive Login
For local development and CLI usage, use the interactive login:
mixtrain loginThis opens a browser window to authenticate with your Mixtrain account. Your credentials are securely stored locally.
API Key
For automated scripts, CI/CD pipelines, and production deployments, use API key authentication.
Environment Variable
Set the MIXTRAIN_API_KEY environment variable:
export MIXTRAIN_API_KEY=mix-your-api-key-hereThen use the CLI or SDK as normal:
mixtrain workspace listPython SDK
SDK will automatically use the API key from the environment variable if it is set. Otherwise, it will use the login token. You can also pass the API key directly to the SDK.
from mixtrain import MixClient
client = MixClient(api_key="mix-your-api-key-here")Managing API Keys
Manage your API keys at Manage Workspaces → Your workspace → API Keys.
Creating Keys
- Click Create new key
- Give your key a descriptive name (e.g., "CI/CD Pipeline", "Local Development")
- Copy and securely store the key - it won't be shown again
Deactivating Keys
If a key is compromised or no longer needed:
- Find the key you want to deactivate
- Click Deactivate
The key will be immediately invalidated and any requests using it will fail.
Best Practices
- Use separate keys for different environments (development, staging, production)
- Never commit API keys to version control
- Use environment variables or secret managers to store keys