POST/user/totp/save

Save a user TOTP configuration

Saves a TOTP configuration for the authenticated user. Supply a config_name defined in the SFTPGo configuration file and select the protocols that require TOTP. Set secret.status to Plain with a payload to save a new secret, or to Redacted to preserve the existing secret.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

4 body fields

TOTP configuration settings to save for the authenticated user.

config_namestringoptional
This name must be defined within the "totp" section of the SFTPGo configuration file. You will be unable to save a user/admin referencing a missing config_name
enabledbooleanoptional
Whether the TOTP configuration is enabled.
secretobjectoptional
The secret is encrypted before saving, so to set a new secret you must provide a payload and set the status to "Plain". The encryption key and additional data will be generated automatically. If you set the status to "Redacted" the existing secret will be preserved
protocolsarray<string>optional
TOTP will be required for the specified protocols. SSH protocol (SFTP/SCP/SSH commands) will ask for the TOTP passcode if the client uses keyboard interactive authentication. FTP has no standard way to support two factor authentication, if you enable the FTP support, you have to add the TOTP passcode after the password. For example if your password is "password" and your one time passcode is "123456" you have to use "password123456" as password. WebDAV is not supported since each single request must be authenticated and a passcode cannot be reused.

7 status codes
200Returns a response object containing a message and an error description if one is present.
errorstringoptional
error description if any
messagestringoptional
message, can be empty
400Returned when the request is invalid.
errorstringoptional
error description if any
messagestringoptional
message, can be empty
401Returned when the request is unauthenticated.
errorstringoptional
error description if any
messagestringoptional
message, can be empty
403Returned when the authenticated user is not permitted to save the TOTP configuration.
errorstringoptional
error description if any
messagestringoptional
message, can be empty
409Returned when saving the TOTP configuration conflicts with the current state.
errorstringoptional
error description if any
messagestringoptional
message, can be empty
500Returned when an internal server error occurs.
errorstringoptional
error description if any
messagestringoptional
message, can be empty
defaultUnexpected Error
errorstringoptional
error description if any
messagestringoptional
message, can be empty

Error handling

A 400 is returned when the request is invalid; a 401 when the request is unauthenticated; and a 403 when the authenticated user is not permitted to save the configuration. A 409 is returned when the save conflicts with the current configuration; a 500 when an internal server error occurs. config_name must name a configuration defined in the totp section, protocols values must be SSH, FTP, or HTTP, and a new secret payload must use status Plain.