---
title: "For a completed MFA enrollment regenerate the recovery codes"
method: POST
path: "/current-identity/mfa/recovery-codes"
tags: ["Current Identity", "MFA"]
---

# For a completed MFA enrollment regenerate the recovery codes

`POST /current-identity/mfa/recovery-codes`

## Request

- Base URL: `https://demo.ziti.dev/edge/client/v1`
- URL: `https://demo.ziti.dev/edge/client/v1/current-identity/mfa/recovery-codes`
- Auth: one of:
  - API key in header `zt-session`
  - OAuth 2
    - Authorization code: `/oidc/authorize`
    - Token URL: `/oidc/token` scopes: `openid`
- TypeScript: <https://skmtc.dev/openziti/apis/ziti-edge-client/docs/current-identity/mfa/recovery-codes/post.ts> (a function with typed inputs; its response is checked against the schema)

Allows regeneration of recovery codes of an MFA enrollment. Requires a current valid time based one time password to interact with. Available after a completed MFA enrollment. This replaces all existing recovery codes.

## Request body

- MfaCode
  - `code` string, required

## Response `200`

Base empty response

- Empty
  - `data` object, required
  - `meta` Meta, required
    - `apiEnrollmentVersion` string
    - `apiVersion` string
    - `filterableFields` string[]
    - `pagination` Pagination
      - `limit` number, required
      - `offset` number, required
      - `totalCount` number, required

## Other responses

- `401`: The supplied session does not have the correct access rights to request this resource
- `404`: The requested resource does not exist

## Changes

- **2024-06-07** `26670d8bbc37`: 1 breaking, 1 info
  - removed the required property `error` from the response with the `200` status
  - added the required property `data` to the response with the `200` status
- **2024-05-29** `cce2800c1357`: 1 breaking, 3 warning, 1 info
  - removed the required property `data` from the response with the `200` status
  - the optional response header `WWW-Authenticate` removed for the status `200`
  - the optional response header `WWW-Authenticate` removed for the status `401`
  - the optional response header `WWW-Authenticate` removed for the status `404`
  - …1 more

[Operation history](https://skmtc.dev/openziti/apis/ziti-edge-client/changes/current-identity/mfa/recovery-codes/post.md)

---

[API](https://skmtc.dev/openziti/apis/ziti-edge-client.md) - [All operations](https://skmtc.dev/openziti/apis/ziti-edge-client/llms.txt) - [OpenAPI document](https://skmtc.dev/openziti/apis/ziti-edge-client/revisions/f7b51eaafbbb?raw)
