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

Prev Next
Post
/api/v1/users.regenerateTotpCodes

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
Header parameters
X-Auth-Token
stringRequired

The authToken of the authenticated user.

X-User-Id
stringRequired

The userId of the authenticated user.

Body parameters
Example 1
{
  "code": "482913"
}
object
code
string Required

The code shown by the authenticator app for the account.

Example482913
Responses
200

OK

Success Example
{
  "codes": [
    "5c1d8b02",
    "e74a2f61"
  ],
  "success": true
}
object
codes
Array of string

The new backup codes of the account.

string
success
boolean
400

Bad Request

Invalid code
{
  "success": false,
  "error": "[invalid-totp]",
  "errorType": "invalid-totp"
}
object
success
boolean
error
string
errorType
string
401

Unauthorized

Authorization Error
{
  "status": "error",
  "message": "You must be logged in to do this."
}
object
status
string
message
string