Mistral API 401 Unauthorized: API Key Not Working
Quick answer
A 401 means the API key is missing, invalid, revoked, expired or from another workspace. Create a fresh key in the console and send it as a Bearer token.
Most likely fix: Check the header
How to fix it
Try these in order — the most common fix is first.
1. Check the header
- Send Authorization: Bearer YOUR_API_KEY
- Make sure no whitespace or quotes ended up in the environment variable
Did this fix it?2. Verify the key in the console
- Open the API keys page in the console
- Confirm the key exists, is not revoked and belongs to the workspace you expect
- Create a new key and replace the old one
Did this fix it?3. Use the right key type
- Create a pay-as-you-go API key in the console instead of a plan key from Code > Vibe CLI
- If you cannot tell which key type you have, contact support with your organization ID (never the key itself)
Did this fix it?
Symptoms
Requests return 401 Unauthorized (authentication_error), including right after getting a Vibe quota email or creating a key.
Why it happens
- Key is missing, mistyped, revoked or expired
- Key belongs to a different workspace than the one you are calling
- Header not sent as Authorization: Bearer YOUR_API_KEY
- Key created as a plan key (Code, Vibe CLI) instead of a pay-as-you-go API key
This guide also covers
- mistral api key not working
- mistral 401 unauthorized
- mistral invalid api key
Still not working?
If Mistral AI keeps failing, you're not alone. See every Mistral AI problem users report or the alternatives people switch to.
Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.
Talk to usOther Mistral AI errors
- Mistral API 429 Rate Limit Exceeded Error
- Mistral API 402 Payment Required Error
- Mistral API 403 Forbidden Error
- Mistral API 500, 502, 503 and 504 Errors
- Mistral Model Deprecated or 404 Model Not Found
- Le Chat Not Working: Something Went Wrong
- Le Chat Message Limit Reached (Free and Pro)
- Le Chat File Upload Failed or Document Upload Limit