API keys

API keys authenticate your requests to the Mistral API. Each key is scoped to a specific Workspace and grants access to all API endpoints available on your plan.

Create an API key

Create an API key

  1. StudioAPI keys.
  2. Click Create new key.
  3. Optionally set a name (e.g., "Production pipeline") and an expiration date.
  4. Click Create new key.
  5. Copy the key immediately.
warning

The full key is shown only once. After you close the dialog, you can't retrieve it. Store the key securely in a password manager or secrets vault. Don't share it or commit it to version control.

Use API keys

Use API keys

Pass the key in the Authorization header:

curl https://api.mistral.ai/v1/chat/completions \
  -H "Authorization: Bearer $MISTRAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "mistral-medium-latest", "messages": [{"role": "user", "content": "Hello"}]}'

Or set it as an environment variable for the SDKs:

export MISTRAL_API_KEY="your-api-key"
Workspace scoping

Workspace scoping

API keys are scoped to the Workspace where they were created. Resources created with a key (like datasets, batch jobs, etc.) are visible to all members of that Workspace.

To use different keys for different environments (development, staging, production), create separate Workspaces.

Key management

Key management

  • Rotate keys regularly. Create a new key, update your applications, then delete the old one.
  • Revoke compromised keys immediately by deleting them from the API keys page.
  • Set expiration dates so keys automatically stop working after a given date.
  • Usage tracking: all usage from keys in a Workspace is tracked together and billed to the Organization.
Payment activation

Payment activation

API keys require activated payments. Set up billing at AdminSubscriptions › Billing. You can choose between the free Experiment tier (with conservative rate limits) and the pay-as-you-go Scale plan.