---
title: "Submit 2FA account config (submitTwoFaAccountConfig)"
method: POST
path: "/api/2fa/account/config/submit"
tags: ["two-factor-auth-config-controller"]
---

# Submit 2FA account config (submitTwoFaAccountConfig)

`POST /api/2fa/account/config/submit`

Submit 2FA account config to prepare for a future verification. Basically, this method will send a verification code for a given account config, if this has sense for a chosen 2FA provider. This code is needed to then verify and save the account config.

Example of EMAIL 2FA account config:
```
{
  "providerType": "EMAIL",
  "useByDefault": true,
  "email": "separate-email-for-2fa@thingsboard.org"
}
```

Example of SMS 2FA account config:
```
{
  "providerType": "SMS",
  "useByDefault": false,
  "phoneNumber": "+38012312321"
}
```

For TOTP this method does nothing.

Will throw an error (Bad Request) if submitted account config is not valid, or if the provider is not configured for usage. 

Available for any authorized user.

## Request body

- union
  - BackupCodeTwoFaAccountConfig
    - `useByDefault` boolean
    - `providerType` string, required
    - `codes` string[], required
    - `codesLeft` integer
  - EmailTwoFaAccountConfig
    - `useByDefault` boolean
    - `providerType` string, required
    - `email` string, required
  - SmsTwoFaAccountConfig
    - `useByDefault` boolean
    - `providerType` string, required
    - `phoneNumber` string, required
  - TotpTwoFaAccountConfig
    - `useByDefault` boolean
    - `providerType` string, required
    - `authUrl` string, required

## Response `200`

OK

---

[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)
