API keys - Mistral AI
Summary
Mistral API keys are essential for authenticating requests to the Mistral API, with each key specifically scoped to a Workspace and granting access to all API endpoints available under the user's plan. Users can create new keys via the Studio interface, optionally assigning a name and an expiration date. Once generated, the full key is displayed only once and must be copied and stored securely, as it cannot be retrieved later. Keys are passed in the `Authorization` header for `curl` requests or set as an environment variable for SDKs. All resources created with a key are visible to members of its associated Workspace, and separate Workspaces are recommended for different environments like development or production. Key management practices include regular rotation, immediate revocation of compromised keys, and setting expiration dates. API key usage is tracked and billed to the Organization, requiring activated payments through either the free Experiment tier or the pay-as-you-go Scale plan.
Key takeaway
For AI Engineers integrating with the Mistral API, securely managing your API keys is paramount. Always copy the full key immediately upon creation and store it in a secrets vault, never in version control. Implement a strategy for regular key rotation and utilize expiration dates to minimize security risks. If a key is compromised, revoke it without delay to protect your Workspace resources.
Key insights
Mistral API keys authenticate requests, are Workspace-scoped, and require secure handling and regular management.
Principles
- API keys are Workspace-specific.
- Keys must be stored securely.
- Regular key rotation is critical.
Method
Create a new key in Studio, copy it immediately, and pass it via the `Authorization` header or as an environment variable for API access.
In practice
- Use separate Workspaces for environments.
- Set expiration dates for all keys.
- Revoke compromised keys instantly.
Topics
- API Keys
- Mistral API
- API Authentication
- Workspace Scoping
- Key Management
Best for: AI Engineer, Machine Learning Engineer, Software Engineer
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by mistral.ai via Google News.