🤖 For AI agents: The complete documentation index is available at /docs/llms.txt. A markdown version of this page is available at /docs/apis/two-factor.md.

Email and phone multi-factor methods are only available in a paid plan of FusionAuth. Please visit our pricing page to learn more about paid plans.

This API controls multi-factor authentication (MFA) options.

Authentication#

Some of these operations can use JWT authentication instead of API key authentication. In some cases, when you have a valid twoFactorId, neither a JWT nor an API key is required.

Learn more about JWT authentication and see examples here.

TOTP Implementation#

Support for Authy, Google Authenticator and other time based one-time password solutions are not premium features and are included in the Community plan.

While there is underlying support for different code lengths, algorithms and time steps, at the current time the system only allows for the following TOTP settings:

Configuration settingCurrently allowed value
authenticator.algorithmHmacSHA1
authenticator.codeLength6
authenticator.timeStep30

Any attempt to change these configuration values will currently be ignored. If you need different configuration settings, please file a GitHub issue detailing your use case.

Use the following APIs to manage Multi-Factor authentication:

OperationMethodEndpoint
Enable Multi-FactorPOST/api/user/two-factor/{userId}
/api/user/two-factor
Disable Multi-FactorDELETE/api/user/two-factor/{userId}?code={code}&methodId={methodId}
/api/user/two-factor/{userId}
/api/user/two-factor
/api/user/two-factor?code={code}&methodId={methodId}
Update Multi-Factor MethodPUT/api/user/two-factor/{userId}?methodId={methodId}
Generate a SecretGET/api/two-factor/secret
Start Multi-FactorPOST/api/two-factor/start
Retrieve Multi-Factor StatusGET
POST
/api/two-factor/status/{twoFactorTrustId}
/api/two-factor/status
Send a Multi-Factor Code During Login or Step UpPOST/api/two-factor/send/{twoFactorId}
Send a Multi-Factor Code When Enabling MFAPOST/api/two-factor/send
Send a Multi-Factor Code When Disabling MFAPOST/api/two-factor/send
Generate Recovery CodesPOST/api/user/two-factor/recovery-code/{userId}
Retrieve Recovery CodesGET/api/user/two-factor/recovery-code/{userId}