Anthropic API error 401 (authentication_error): how to fix it
Quick answer: A 401 from the Anthropic API means the API key isn't accepted: Anthropic's docs say it may be malformed, revoked or expired. It's never an outage. Check the key and how you're sending it, or create a new one.
The message you're seeing
401 authentication_error
Is it down right now?
- Anthropic API · checked No problems
Live status, updated every minute. If it says “No problems”, the cause is most likely on your side: follow the steps below.
Common causes
- Expired key: keys can be set to expire after 3 hours, 1 day, 7 days or 30 days. After that, requests return a 401 authentication_error.
- Revoked key: someone deleted or disabled it in the Claude Console.
- Lost access: personal keys stop working when you lose access to the organisation.
- Malformed header: a typo, an extra space, or the key sent in the wrong header.
How to fix it
- Check how the key is sentSend it as an Authorization: Bearer header, or set the ANTHROPIC_API_KEY environment variable for the SDKs. The older x-api-key header still works too.
- Create a new keyAnthropic's docs say expired keys can't be reactivated, so create a new key in the Claude Console and swap it in.
- Make sure it's the right organisationIf you belong to several organisations, check the key comes from the one you mean to use.
Still getting 401s?
If a brand-new key from the right organisation still fails, print the exact header your code sends (hiding most of the key) to check nothing is adding quotes or spaces. If you're getting 429, 500 or 529 instead, see our other Anthropic API guides below.
Questions
Can I reactivate an expired Anthropic API key?
No. Anthropic's authentication docs say expired keys can't be reactivated. Create a new one.
Does a Claude Pro or Max subscription give me an API key?
The Claude apps and the API are set up separately. You create API keys in the Claude Console, which has its own billing.
Is a 401 ever caused by an outage?
No. It's about the key. If you're seeing 500, 504 or 529 errors instead, those can be on Anthropic's side: check the live status above.
Want to know when Anthropic API has a real outage? Follow our free outage alerts. We only post real outages, and again when they're fixed.
Related error guides
- Claude 529 “Overloaded” error
- Anthropic API 429 rate_limit_error
- Anthropic API 500 and 504 errors
- Anthropic “credit balance is too low”
Based on official documentation, checked 3 November 2026: Anthropic: API errors · Anthropic: Authentication. Error messages and limits change over time, so the provider's own docs are the final word.