Skip to main content

Setup TOTP

Individual API

Initialize TOTP (Time-based One-Time Password) MFA setup using authenticator apps.

Quick Navigation

Endpoint

POST /api/v1/mfa/totp/setup

Headers

HeaderRequiredDescription
AuthorizationYesBearer <access_token>
Content-TypeYesapplication/json

Request Body

{
"device_name": "iPhone Authenticator"
}

Parameters

FieldTypeRequiredDescription
device_namestringYesName for the TOTP device

Response

Success (200)

{
"success": true,
"data": {
"secret": "JBSWY3DPEHPK3PXP",
"qr_code": "data:image/png;base64,iVBORw0KG...",
"manual_entry_key": "JBSWY3DPEHPK3PXP",
"device_name": "iPhone Authenticator",
"backup_codes": [
"ABCD1234",
"EFGH5678",
...
]
},
"message": "TOTP setup initiated successfully"
}

Error Codes

StatusCodeDescription
400VALIDATION_ERRORInvalid request
401UNAUTHORIZEDInvalid or missing token
409TOTP_ALREADY_ENABLEDTOTP already enabled for user

Features

  • Generates TOTP secret and QR code
  • Provides manual entry key
  • Generates backup codes (10 codes)
  • Rate limiting protection
  • MFA remains inactive until verified

Next Steps

After receiving the QR code or secret:

  1. Scan QR code with authenticator app (Google Authenticator, Authy, etc.)
  2. Use Verify TOTP Setup to verify and activate

Example

curl -X POST https://api.rivergen.com/api/v1/mfa/totp/setup \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{
"device_name": "iPhone Authenticator"
}'