MixtrainDocs

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 login

This 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-here

Then use the CLI or SDK as normal:

mixtrain workspace list

Python 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

  1. Click Create new key
  2. Give your key a descriptive name (e.g., "CI/CD Pipeline", "Local Development")
  3. Copy and securely store the key - it won't be shown again

Deactivating Keys

If a key is compromised or no longer needed:

  1. Find the key you want to deactivate
  2. 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

On this page