ChatGPT Agents: Invalid API Key
Invalid API Key
Known to happen when: initially saving the API key or when initially saved API key was valid, but it has either been deleted or restricted in OpenAI afterwords. In this case when an agent attempts to process a WhatsApp message and send a response, it will fail.
When an Invalid OpenAI API key was detected:
- OpenAI API card will be displayed with a 401 error and highlighted in red
- Additionally an agent that failed to run due to invalid API key will be marked as having an issue. Agent will be highlighted in red with a "Fix issues" icon under "Actions".
- Workspace owners and administrators will receive an email notification that OpenAI API key became invalid
How to fix?
One of the following will resolve the issue:
- Create a new key at https://platform.openai.com/api-keys and add it within "OpenAI API Key" card. To add a new key click the pencil ( Edit) icon next to your existing invalid API key. If an agent has already been marked as having issues, it is recommended to go over the "Fix issues" steps and re-saving and re-activating the agent after the valid API key has been added.
- Make sure the key in TimelinesAI is the same one as in OpenAI. Since keys are masked and you can't see full version of them, you can compare only using last 4 digits. If you are not sure keys are the same - better to create a new key and re-add it as described earlier. However if you are sure the key exists, then check key permission of the given key within your OpenAI account. You can check permissions https://platform.openai.com/api-keys under "Permissions" column. It should be "All" . If you have permissions restricted, switch them to "All" using the pencil icon ( Edit) option in the same column.
Updated on: 27/06/2025
Thank you!