Skip to main content

Reset TOTP Setup

Reset TOTP setup by removing all unverified TOTP methods. Internal utility endpoint.

Endpoint

POST /api/v1/mfa/totp/reset

Headers

HeaderRequiredDescription
AuthorizationYesBearer <access_token>

Response

Success (200)

{
"success": true,
"data": {
"message": "TOTP setup reset successfully. Removed 2 unverified methods."
},
"message": "TOTP setup reset successfully"
}

Error Codes

StatusCodeDescription
401UNAUTHORIZEDInvalid or missing token
500RESET_FAILEDInternal server error

Data Flow

  1. Authentication

    • Verify access token
    • Get current user
  2. Unverified Methods Query

    • Query MfaMethod table
    • Filter by user ID and type = "totp"
    • Filter by verified = false
  3. Method Removal

    • Delete all unverified TOTP methods
    • Clean up related data
  4. Response

    • Return reset confirmation
    • Include count of removed methods

Features

  • Removes all unverified TOTP methods
  • Useful for resetting stuck TOTP setup state
  • Does not affect verified TOTP methods
  • Internal utility endpoint

Use Cases

Use this endpoint if:

  • TOTP verification is failing due to database state issues
  • User wants to restart TOTP setup process
  • Unverified TOTP methods are cluttering the account

Important Notes

  • Only removes unverified TOTP methods
  • Verified TOTP methods are not affected
  • User can set up TOTP again after reset

Example

curl -X POST https://api.rivergen.com/api/v1/mfa/totp/reset \
-H "Authorization: Bearer <access_token>"