Skip to content
These docs describe Tradr v0.17.0. Running an older release? Check the release notes for what changed.

Confirm two-factor enrolment with a code.

POST
/api/auth/two-factor/enrol/confirm
curl --request POST \
--url https://api.tradr.cloud/api/auth/two-factor/enrol/confirm \
--header 'Content-Type: application/json' \
--data '{ "code": "example" }'

Validates the submitted authenticator code against the pending secret, then turns two-factor on, shows 10 single-use backup codes once (stored only as one-way hashes) and ends every other session of the user, keeping the current one. Requires an authenticated session; rate limited to 10 management writes per 15 minutes per user; never cached.

Media typeapplication/json
object
code
required
string
>= 6 characters <= 20 characters
Examplegenerated
{
"code": "example"
}

The 10 single-use backup codes, shown once.

Media typeapplication/json
object
backupCodes
Array<string>
Examplegenerated
{
"backupCodes": [
"example"
]
}

Validation error, or the code is wrong (INVALID_TWO_FACTOR_CODE).

No authenticated session.

No pending enrolment to confirm (TWO_FACTOR_NOT_PENDING).

Rate limit exceeded.