You can generate a new recovery key from Settings or System Preferences on a trusted device signed in with your Apple ID.
On your iPhone, iPad, or iPod touch
- Go to Settings > [your name] > Password & Security. You might need to enter your Apple ID password.
- Tap Recovery Key.
- Slide to turn on Recovery Key.
- Tap Use Recovery Key and enter your device passcode.
- Write down your recovery key and keep it in a safe place.
- Confirm your recovery key by entering it on the next screen.
On your Mac
- Go to System Preferences > Apple ID > Account Details. You might need to enter your Apple ID password.
- Click Security.
- In the Recovery Key section, click Turn On.
- Click Use Recovery Key.
- Write down your recovery key and keep it in a safe place.
- Click Continue.
- Confirm your recovery key by entering it on the next screen.
How to generate a recovery key - Apple Support