latestOpenAPI 3.0.2cPanel License2026-08-106251554.3 MB

3da41671c02c

Authentication
Two-Factor Authentication

Update 2FA authentication secret and code

This function sets the secret and the authentication code for Two-Factor Authentication (2FA) for the root or reseller account. You can generate a random secret and an OTP authentication URL with WHM API 1's twofactorauth_generate_tfa_configorauth_generate_tfa_config function.

get/twofactorauth_set_tfa_config

Query parameters

secretstring required
Example:WJ73QJSKZBXCFIPZ

A generated code for use with 2FA in Base32 format.

tfa_tokenstring required
Example:227174

The time-based one-time password (TOTP) that the authentication app provides.

Response

HTTP Request was successful.

Example response

{
  "data": {
    "success": 1
  },
  "metadata": {
    "command": "twofactorauth_set_tfa_config",
    "reason": "OK",
    "result": 1,
    "version": 1
  }
}