Enforcement_failed Error generating a new API key

I am getting a persistent error when trying to generate a new key. This occurs when hitting the ‘create secret key’ button on the pop up (the one with the optional field for the key name):

Anyone encounter similar behavior?

1 Like

Do you get the same error on the main API keys page instead of the Quickstart?



Actually no, it performs correctly from that page.

Thank you!


I had the same issue so something in the tutorial is broken. Works in the main api area as said.

1 Like

Mine is doing the same thing even though I have a new account and new phone number

It’s broken for me even on the main API page, weird.

I’ve encountered the same problem, but I don’t know how to solve it. Does anyone know how to resolve it

same here i cant génerate an api key shows the same error message please help

same here, were you able to generate the KPI Key?

Have you reached out to help.openai.com yet? I’d try that…

1 Like

Hi and welcome to the Developer Forum!

If you are getting the Enforcement failed message then that is typically related to your phone number being incorrect, double check your account details.

Hello everyone, I’m trying to create a new API key from OpenAI Platform , but I always get the same error (“Error generating API key (error=enforcement_failed). If this issue persists please contact us through our help center at https://help.openai.com.”).
Are there any other settings before creating a new key?

This is usually due to there being a missing or mismatched phone number on your account, please check that.

I also have the same error

and the phone number is right. Have reached out to customer support. Is there anything else which can cause this error?

Hi, I’m having this same issue. My phone is correct.

I encountered this a month ago, but it passed.

Here’s something else you can try, which I can’t verify because a generated key worked fine just now for me:

  • open private browser window (in browser supporting full independence like Firefox),
  • proceed to https://openai.com,
  • login through the menu option on that main page,
  • you will be presented with ChatGPT or API, your choice is the latter,
  • go directly to API keys in the account sidebar navigation menu
  • “create new secret key”, and assign a single word name
  • generate button

If a red error appears, follow the instructions in that error.

Tried that too - didn’t work either.

Safari - Firefox - Chrome : the same error shows up

Hopefully this helps someone. I was having the same problem: seeing the error when trying to generate an API key from my settings page. My email and phone number were fine/correct.

To fix it: I went to my Profile, and I clicked “Save” on it. I didn’t change anything; phone, name, and email were already there. I just clicked Save. The page confirmed it was saved.

Then I tried generating a key again and it magically worked. So it’s probably a bug in their servers, and maybe it only affects users who haven’t edited their profile in a while (presumably after they introduced the enforcement check?).

Hope it helps!

1 Like

Click the personal button and accept the thing that pops up.

same issue at the moment. Worked when I omitted to enter a name for the api-key! Weird!

1 Like