Reset TOTP Setup
Reset TOTP setup by removing all unverified TOTP methods. Internal utility endpoint.
Endpoint
POST /api/v1/mfa/totp/reset
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <access_token> |
Response
Success (200)
{
"success": true,
"data": {
"message": "TOTP setup reset successfully. Removed 2 unverified methods."
},
"message": "TOTP setup reset successfully"
}
Error Codes
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Invalid or missing token |
| 500 | RESET_FAILED | Internal server error |
Data Flow
-
Authentication
- Verify access token
- Get current user
-
Unverified Methods Query
- Query MfaMethod table
- Filter by user ID and type = "totp"
- Filter by verified = false
-
Method Removal
- Delete all unverified TOTP methods
- Clean up related data
-
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>"
Related Endpoints
- TOTP Setup - Set up TOTP again after reset
- TOTP Verify - Verify TOTP setup