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
- Studio›API keys ↗.
- Click Create new key.
- Optionally set a name (e.g., "Production pipeline") and an expiration date.
- Click Create new key.
- Copy the key immediately.
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
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
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
- 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
API keys require activated payments. Set up billing at Admin›Subscriptions › Billing ↗. You can choose between the free Experiment tier (with conservative rate limits) and the pay-as-you-go Scale plan.