# How to generate multiple recovery codes with the /mfa/associate API?

**URL:** <https://community.auth0.com/t/how-to-generate-multiple-recovery-codes-with-the-mfa-associate-api/186409>\
**Category:** Get Help\
**Tags:** recovery-code-factor, mfa\
**Created:** [May 7, 2025, 7:07am UTC](https://community.auth0.com/t/how-to-generate-multiple-recovery-codes-with-the-mfa-associate-api/186409 "2025-05-07T07:07:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![t.fukao](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/t.fukao/32/61052_2.png) [@t.fukao](https://community.auth0.com/u/t.fukao)\
**Post date:** [May 7, 2025, 7:07am UTC](https://community.auth0.com/t/how-to-generate-multiple-recovery-codes-with-the-mfa-associate-api/186409/1 "2025-05-07T07:07:34Z")

</div>

I am using `/mfa/associate` API to enroll for otp based 2fa.  
The response includes a `recovery_codes` array, but it currently only provides a single recovery code.  
Is there any way to generate **multiple codes**?

Here’s the relevant part of my request:

```auto
$response = Http::withHeaders([
    'Authorization' => 'Bearer ' . $request->mfa_token,
    'Content-Type' => 'application/json',
])->post('https:// { MY_DOMAIN } /mfa/associate', [
    'authenticator_types' => ['otp'],
]);

```

My Question is essentially the same as [this one](https://community.auth0.com/t/only-one-recovery-code-generated-while-enrolling-to-mfa/150498).  
However, after a period of inactivity, it was closed with only a wide of the mark answer.

Any insights or guidance on this would be greatly appreciated.  
Thank you.

---

<div class="post-metadata">

**Author:** ![teodor.andrei](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/teodor.andrei/32/75320_2.png) [@teodor.andrei](https://community.auth0.com/u/teodor.andrei)\
**Post date:** [May 7, 2025, 11:25am UTC](https://community.auth0.com/t/how-to-generate-multiple-recovery-codes-with-the-mfa-associate-api/186409/3 "2025-05-07T11:25:42Z")

</div>

Hi @t.fukao, and thank you for your question, which can help clarify this issue.

It is not possible to generate multiple recovery codes for the user at the same time. As my colleague pointed out in the topic you linked, only one recovery code can be active at a time. The initial code is generated upon enrollment, and afterwards, a code to replace the initial one can be generated with [a call to the Management API](https://auth0.com/docs/api/management/v2/users/post-recovery-code-regeneration).

I understand that the property name `recovery_codes` is misleading, and perhaps the team would like to implement this feature later. It would be a great idea to share your use case with the team in the #feature-request section.

Thank you, and let me know if there is more I can help you with!  
Teodor.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [May 21, 2025, 11:25am UTC](https://community.auth0.com/t/how-to-generate-multiple-recovery-codes-with-the-mfa-associate-api/186409/4 "2025-05-21T11:25:50Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
