---
title: "Save platform 2FA settings (savePlatformTwoFaSettings)"
method: POST
path: "/api/2fa/settings"
tags: ["two-factor-auth-config-controller"]
---

# Save platform 2FA settings (savePlatformTwoFaSettings)

`POST /api/2fa/settings`

Save 2FA settings for platform. The settings have following properties:
- `providers` - the list of 2FA providers' configs. Users will only be allowed to use 2FA providers from this list. 

- `minVerificationCodeSendPeriod` - minimal period in seconds to wait after verification code send request to send next request. 
- `verificationCodeCheckRateLimit` - rate limit configuration for verification code checking.
The format is standard: 'amountOfRequests:periodInSeconds'. The value of '1:60' would limit verification code checking requests to one per minute.
- `maxVerificationFailuresBeforeUserLockout` - maximum number of verification failures before a user gets disabled.
- `totalAllowedTimeForVerification` - total amount of time in seconds allotted for verification. Basically, this property sets a lifetime for pre-verification token. If not set, default value of 30 minutes is used.


TOTP 2FA provider config has following settings:
- `issuerName` - issuer name that will be displayed in an authenticator app near a username. Must not be blank.

For SMS 2FA provider:
- `smsVerificationMessageTemplate` - verification message template.  Available template variables are ${code} and ${userEmail}. It must not be blank and must contain verification code variable.
- `verificationCodeLifetime` - verification code lifetime in seconds. Required to be positive.

For EMAIL provider type:
- `verificationCodeLifetime` - the same as for SMS.

Example of the settings:
```
{
  "providers": [
    {
      "providerType": "TOTP",
      "issuerName": "TB"
    },
    {
      "providerType": "EMAIL",
      "verificationCodeLifetime": 60
    },
    {
      "providerType": "SMS",
      "verificationCodeLifetime": 60,
      "smsVerificationMessageTemplate": "Here is your verification code: ${code}"
    }
  ],
  "minVerificationCodeSendPeriod": 60,
  "verificationCodeCheckRateLimit": "3:900",
  "maxVerificationFailuresBeforeUserLockout": 10,
  "totalAllowedTimeForVerification": 600
}
```

Available for users with 'SYS_ADMIN' or 'TENANT_ADMIN' authority.

## Request body

- PlatformTwoFaSettings — Settings value
  - `providers` union[], required
    - union
      - BackupCodeTwoFaProviderConfig
        - `providerType` string, required
        - `codesQuantity` integer
      - EmailTwoFaProviderConfig
        - `providerType` string, required
        - `verificationCodeLifetime` integer
      - SmsTwoFaProviderConfig
        - `providerType` string, required
        - `verificationCodeLifetime` integer
        - `smsVerificationMessageTemplate` string, required
      - TotpTwoFaProviderConfig
        - `providerType` string, required
        - `issuerName` string, required
  - `minVerificationCodeSendPeriod` integer, required
  - `verificationCodeCheckRateLimit` string
  - `maxVerificationFailuresBeforeUserLockout` integer
  - `totalAllowedTimeForVerification` integer, required
  - `enforceTwoFa` boolean
  - `enforcedUsersFilter` unknown

## Response `200`

OK

- PlatformTwoFaSettings — Settings value
  - `providers` union[], required
    - union
      - BackupCodeTwoFaProviderConfig
        - `providerType` string, required
        - `codesQuantity` integer
      - EmailTwoFaProviderConfig
        - `providerType` string, required
        - `verificationCodeLifetime` integer
      - SmsTwoFaProviderConfig
        - `providerType` string, required
        - `verificationCodeLifetime` integer
        - `smsVerificationMessageTemplate` string, required
      - TotpTwoFaProviderConfig
        - `providerType` string, required
        - `issuerName` string, required
  - `minVerificationCodeSendPeriod` integer, required
  - `verificationCodeCheckRateLimit` string
  - `maxVerificationFailuresBeforeUserLockout` integer
  - `totalAllowedTimeForVerification` integer, required
  - `enforceTwoFa` boolean
  - `enforcedUsersFilter` unknown

---

[API](https://skmtc.net/thingsboard/apis/thingsboard-rest-api.md) · [All operations](https://skmtc.net/thingsboard/apis/thingsboard-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/thingsboard/thingsboard-rest-api/revisions/40169ccdec5c/schema)
