OpenAI API error 401: “Incorrect API key provided”
Quick answer: A 401 means OpenAI doesn't accept the API key you sent. It's never an outage. Usually the key has a typo, has been revoked, or an old key is still cached somewhere.
The message you're seeing
401 - Incorrect API key provided401 - Invalid Authentication401 - You must be a member of an organization to use the API
Is it down right now?
- OpenAI 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
- Typo or extra space: the key was copied with a missing character or a space at the end.
- Old key cached: a revoked key may still be saved in your app, environment or browser.
- Not in an organisation: your account must belong to an organisation to use the API.
- IP allowlist: if your organisation restricts API access by IP address, requests from other addresses are refused.
How to fix it
- Check the key in your requestMake sure the right key is in the Authorization header, with nothing extra.
- Clear cached keysOpenAI suggests clearing your browser's cache and cookies, and check your environment variables and config files for an old key.
- Create a new keyIf you're not sure the key is right, generate a new one in the OpenAI platform and use that.
Keep your key safe
Never put an OpenAI API key in front-end code, a public repository or a shared notebook: anyone who finds it can use your credits. Keep it in an environment variable on your server, and create separate keys for separate projects so you can revoke one without breaking the others.
Questions
Does ChatGPT Plus include an API key?
No. The OpenAI API is set up and billed separately from ChatGPT subscriptions.
Is a 401 an OpenAI outage?
No. It's about your key or account. Outages usually show as 500 or 503 errors; see the live status above.
What about 429 errors?
Those are rate limits, credits or spend limits. See our guide to OpenAI API error 429.
Want to know when OpenAI API has a real outage? Follow our free outage alerts. We only post real outages, and again when they're fixed.
Related error guides
Based on official documentation, checked 3 November 2026: OpenAI: API error codes. Error messages and limits change over time, so the provider's own docs are the final word.