All Collections
OpenAI API
API Error Codes Explained
Error Code 401 - Incorrect API key provided
Error Code 401 - Incorrect API key provided
Joshua J. avatar
Written by Joshua J.
Updated over a week ago

This error message indicates that the API key you are using in your request is not correct. This could happen for several reasons, such as:

- You are using a typo or an extra space in your API key.

- You are using an API key that belongs to a different organization.

- You are using an API key that has been deleted or deactivated

- Your API key might be cached.

To resolve this error, please follow these steps:

- Try clearing your browser's cache and cookies then try again.

- Check that you are using the correct API key in your request header. Follow the instructions in our Authentication section to ensure your key is correctly formatted (i.e. 'Bearer <API_KEY>')

- If you are unsure whether your API key is correct, you can generate a new one here. Make sure to replace your old API key in your codebase and follow our best practices.

Did this answer your question?