Totp Setup
POST
/api/v1/auth/totp/setup
const url = 'https://example.com/api/v1/auth/totp/setup';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"password":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/auth/totp/setup \ --header 'Content-Type: application/json' \ --data '{ "password": "example" }'Start TOTP setup for a local-auth user — generates and stores a pending secret.
Requires the current password: a stolen session or API token must not be able to enrol its own authenticator, which ends every other session and locks the owner out.
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
TOTPSetupRequest
The current password: starting 2FA enrolment is as sensitive as turning it off.
object
password
required
Password
string
Example generated
{ "password": "example"}Responses
Section titled “Responses”Successful Response
Media typeapplication/json
TOTPSetupResponse
object
provisioning_uri
required
Provisioning Uri
string
Example generated
{ "provisioning_uri": "example"}Validation Error
Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object
Example generated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}