WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/twofactorauth_set_issuer
- A server running WHM.
https://whm-server.tld:2087/json-api/twofactorauth_set_issuer
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/twofactorauth_set_issuer?issuer=hostname.example.com'{ "metadata": { "command": "twofactorauth_set_issuer", "reason": "OK", "result": 1, "version": 1 } }
Request
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.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/twofactorauth_set_tfa_config
- A server running WHM.
https://whm-server.tld:2087/json-api/twofactorauth_set_tfa_config
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/twofactorauth_set_tfa_config?secret=WJ73QJSKZBXCFIPZ&tfa_token=227174'{ "data": { "success": 1 }, "metadata": { "command": "twofactorauth_set_tfa_config", "reason": "OK", "result": 1, "version": 1 } }
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/twofactorauth_set_tfa_config_for_user
- A server running WHM.
https://whm-server.tld:2087/json-api/twofactorauth_set_tfa_config_for_user
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
-u <username>:<password> \
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/twofactorauth_set_tfa_config_for_user \
-H 'Content-Type: application/json' \
-d '{
"example": {
"email": {
"user@example.com": {
"secret": "QLLIU5WTY3UTJGNG"
}
},
"primary_account": {
"secret": "QLLIU5WTY3UTJGNG"
},
"team": {
"team_user@example": {
"secret": "QLLIU5WTY3UTJGNG"
}
}
}
}'{ "metadata": { "command": "twofactorauth_set_tfa_config_for_user", "reason": "OK", "result": 1, "version": 1 } }