Account
Two-factor authentication
Turn on an authenticator app or email codes, keep recovery codes, and meet the enrolment deadline.
A second factor asks for a code in addition to your password when you sign in. Turn it on from the Account security page in the dashboard, or with the /auth/mfa routes.
The factors
| Factor | How it works |
|---|---|
| Authenticator app | A time-based code of 6 digits that changes every 30 seconds (RFC 6238). You scan a QR code or type the setup key into the app. |
| Email codes | A code of 6 digits sent to your account email. It works once and expires after 10 minutes. |
| Recovery codes | 10 codes shown once when you turn a factor on. Each works once, if you cannot get a code from the other factors. |
Turn it on
- Start enrolment with your password:
POST /auth/mfa/enrolfor the authenticator app orPOST /auth/mfa/email/enrolfor email codes. The authenticator route returns thesecretand anotpauthUri; the email route sends a code and returns where it went. - Confirm with your password and the first code:
POST /auth/mfa/enable(fieldcode) orPOST /auth/mfa/email/enable(fieldcode). - If the other factor is already on, prove it in the same request, so a stolen session and password cannot add a factor. To add the authenticator while email codes are on, also send an
emailCodeor arecoveryCode. To add email codes while the authenticator is on, also send anauthenticatorCodeor arecoveryCode. Send one of the two, not both; without one the route answers 400. A wrong confirmation code when turning a factor on also answers 400, not 403. To get an emailed code for the first case, callPOST /auth/mfa/email/step-up. - Save the recovery codes in the response. They are shown once. If you already had a factor on, the response carries no new codes and the existing set stays valid.
Turning a factor on or off ends your other sessions
Sign in with a second factor
POST /auth/loginanswersmfaRequired: truewith anmfaTokenthat is valid for 5 minutes.- To get an email code, call
POST /auth/mfa/email/sendwith themfaToken. It answers 202 with the same message for every account, so it does not reveal whether email codes are on. - Call
POST /auth/mfa/verifywith themfaTokenand exactly one ofcode(authenticator),recoveryCodeoremailCode. The answer is the session, in the same shape as a normal sign-in.
Manage it
GET /auth/mfareturns the status: which factors are on, how many recovery codes remain, and the enrolment deadline.POST /auth/mfa/recovery-codesreplaces the recovery codes. The previous set stops working. It ends no session.POST /auth/mfa/disableturns the authenticator off andPOST /auth/mfa/email/disableturns email codes off. Email codes keep working after the authenticator is turned off, and the recovery codes go when the last factor is turned off.- Each of these needs your password and proof of a second factor: a current authenticator
codeor an unusedrecoveryCode. Turning email codes off, and replacing recovery codes while only email codes are on, also accept anemailCode, which you get fromPOST /auth/mfa/email/step-upwith your password. An emailed code never replaces the authenticator: it is refused while the authenticator is on. Operator accounts use the authenticator app only. - A wrong code on one of these manage routes answers 403 and counts towards the same lockout as a wrong sign-in code. A locked account gets 429 and nothing is checked.
The enrolment deadline
Every account has a deadline by which a second factor must be on. A new account gets 30 days from when it was created. Accounts that existed before this rule got 30 days from the day it was introduced. Read your own deadline as requiredBy in GET /auth/mfa, together with the days left. After the deadline, an account without a second factor can reach only its account routes, the two-factor routes and sign-out. Every other route answers 403 with the code mfa_enrolment_required, for sessions and for API tokens alike. Turning a factor on lifts it at once.