API Reference
Re-enroll TOTP
Verifies the current password, then generates a new TOTP secret. Must be confirmed via /api/users/me/totp/confirm.
POST /api/users/me/totp/re-enroll
Verifies the current password, then generates a new TOTP secret. Must be confirmed via /api/users/me/totp/confirm.
Operation ID: reEnrollTotp
Authentication
Option 1
- BearerAuth (
http bearer) API key token. Create via POST /api/api-keys. Format:envoy_<hex>
Option 2
- CookieAuth (
apiKey) Session cookie set after login + TOTP verification
Request body
The request body is required.
application/json
- Type:
object - Properties:
current_password(string,required)
Success responses
200
New TOTP enrollment data
Content type: application/json
- Type:
object - Properties:
totp_secret(string)totp_uri(string)
Error responses
400
Validation error
Content type: application/json
- Reference:
Error- Type:
object - Properties:
error(string)- Example:
NOT_FOUND
- Example:
message(string)- Example:
Resource not found
- Example:
- Type:
Example:
{
"error": "VALIDATION_ERROR",
"message": "Invalid input"
}401
Current password incorrect
429
Too many requests
Content type: application/json
- Reference:
Error- Type:
object - Properties:
error(string)- Example:
NOT_FOUND
- Example:
message(string)- Example:
Resource not found
- Example:
- Type:
Example:
{
"error": "RATE_LIMITED",
"message": "Too many failed TOTP attempts. Try again later."
}Examples
cURL
curl --request POST \
--url 'https://your-envoy.example.com/api/users/me/totp/re-enroll' \
--header 'Authorization: Bearer $API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"current_password": "string"
}'JavaScript (fetch)
const response = await fetch('https://your-envoy.example.com/api/users/me/totp/re-enroll', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"current_password": "string"
}),
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = response.status === 204 ? null : await response.json();
console.log(data);