> ## Documentation Index > Fetch the complete documentation index at: https://developer.rocket.chat/llms.txt > Use this file to discover all available pages before exploring further. # Regenerate TOTP Backup Codes > Generates a new set of backup codes for the authenticator app (TOTP) two-factor authentication of your own account and returns them. The previous backup codes stop working. The code from the authenticator app is required in the body. Requests are limited to five per minute. This endpoint replaces the deprecated `2fa:regenerateCodes` real-time method, which remains available until 9.0.0. ### Changelog | Version | Description | | ------- | ----------- | | 8.8.0 | Added | ## OpenAPI ````json POST /api/v1/users.regenerateTotpCodes { "openapi": "3.0.0", "info": { "version": "1.0.0", "title": "Authentication" }, "servers": [ { "url": "https://apiexplorer.support.rocket.chat" } ], "tags": [ { "name": "Authentication" }, { "name": "Two-Factor Authentication" } ], "paths": { "/api/v1/users.regenerateTotpCodes": { "post": { "tags": [ "Two-Factor Authentication" ], "summary": "Regenerate TOTP Backup Codes", "description": "Generates a new set of backup codes for the authenticator app (TOTP) two-factor authentication of your own account and returns them. The previous backup codes stop working. The code from the authenticator app is required in the body. Requests are limited to five per minute.\n\nThis endpoint replaces the deprecated `2fa:regenerateCodes` real-time method, which remains available until 9.0.0.\n\n### Changelog\n| Version | Description |\n| ------- | ----------- |\n| 8.8.0 | Added |", "operationId": "post-api-v1-users.regenerateTotpCodes", "parameters": [ { "$ref": "#/components/parameters/Auth-Token" }, { "$ref": "#/components/parameters/UserId" } ], "requestBody": { "required": "true", "content": { "application/json": { "schema": { "type": "object", "properties": { "code": { "type": "string", "description": "The code shown by the authenticator app for the account.", "example": "482913" } }, "required": [ "code" ], "additionalProperties": "false" }, "examples": { "Example 1": { "value": { "code": "482913" } } } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "codes": { "type": "array", "description": "The new backup codes of the account.", "items": { "type": "string" } }, "success": { "type": "boolean" } }, "required": [ "codes", "success" ], "additionalProperties": "false" }, "examples": { "Success Example": { "value": { "codes": [ "5c1d8b02", "e74a2f61" ], "success": "true" } } } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "error": { "type": "string" }, "errorType": { "type": "string" } } }, "examples": { "Invalid code": { "value": { "success": "false", "error": "[invalid-totp]", "errorType": "invalid-totp" } } } } } }, "401": { "$ref": "#/components/responses/authorizationError" } } } } }, "components": { "parameters": { "Auth-Token": { "name": "X-Auth-Token", "in": "header", "description": "The `authToken` of the authenticated user.", "required": "true", "schema": { "type": "string", "example": "RScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f" } }, "UserId": { "name": "X-User-Id", "in": "header", "description": "The `userId` of the authenticated user.", "required": "true", "schema": { "type": "string", "example": "rbAXPnMktTFbNpwtJ" } } }, "responses": { "authorizationError": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string" }, "message": { "type": "string" } }, "x-examples": { "Authorization Error": { "status": "error", "message": "You must be logged in to do this." } } }, "examples": { "Authorization Error": { "value": { "status": "error", "message": "You must be logged in to do this." } } } } } } } } } ````