Enable 2FA
Enable two-factor authentication (2FA) for the authenticated account
- HTTP Method:
POST
- URL:
https://example.domain.tld/api/v1/2fa/<username>/
- Require authentication:
Yes
- Permission level required:
MasterAdmin
/ DomainAdmin
/ MailUser
Path parameters
Parameter |
Type |
Description |
Required |
username |
str |
Your account username |
Required |
Response parameters
Parameter |
Type |
Description |
2fa |
dict |
The 2FA object |
key |
str |
2FA key |
status |
str |
2FA status |
type |
str |
2FA type |
uri |
str |
2FA URI |
username |
str |
Your account username |
Example request (Python)
import requests
import json
from pprint import pprint
url = "https://example.domain.tld/api/v1/2fa/u2@vonmail.com/"
r = requests.post(url, auth=("u2@vonmail.com","long-auth_token-here"))
try:
pprint(r.json())
except:
print(r.text)
Example response (JSON)
{'2fa': {'key': 'Z6MZ-HESS-ZK4T-OBVA-SQJK-EFHC-XS3T-MBWA',
'status': 'pending_verification',
'type': 'TOTP',
'uri': 'otpauth://totp/example.domain.tld:u2@vonmail.com?secret=Z6MZHESSZK4TOBVASQJKEFHCXS3TMBWA&issuer=example.domain.tld',
'username': 'u2@vonmail.com'}}