Log in (exchange credentials for a token set, with optional MFA)
/login
public
Two-step login on a single route. **Step 1:** `{ username, password }`. MFA is optional: the default response is the token set; only accounts enrolled in optional SMS MFA (see POST /account/mfa) get an MFA challenge (`challenge_name`, `session`, `challenge_parameters`) — post step 2. **Step 2 (MFA):** `{ username, session, mfa_code, challenge_name? }` — echo back the challenge returned in step 1 (`SMS_MFA` for the enrolled factor). On success the response is the token set; use `id_token` as `Authorization: Bearer` on GET /account and GET /account/api-key. **Step 2 (force change password):** when step 1 returns `challenge_name: NEW_PASSWORD_REQUIRED` (admin-provisioned account in FORCE_CHANGE_PASSWORD), post `{ username, session, challenge_name: NEW_PASSWORD_REQUIRED, new_password }` — the same token-set response. A password rejected by the password policy returns 400; any other upstream authentication failure returns the generic 502. Throttled and unauthenticated. No user enumeration: a wrong password, an unknown user, and an invalid/expired MFA session all return the identical `401 invalid credentials`.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
username |
string | yes | Account email address. |
password |
string | yes | Account password. Omit when sending a step-2 body. |
new_password |
string | no | NEW_PASSWORD_REQUIRED step 2 only. The user-chosen replacement password for an admin-provisioned account in FORCE_CHANGE_PASSWORD. Same password policy as signup: 8+ characters with upper, lower, digit and special character. |
session |
string | no | MFA step 2 only. The opaque session returned in the step-1 MFA challenge response. |
mfa_code |
string | no | MFA step 2 only. The one-time code texted to the user's verified phone (SMS_MFA, the only MFA factor). Presence (or `session`) routes the request to the challenge step. |
challenge_name |
string | no | Step 2 only. The challenge type returned in step 1 — echo it back. SMS_MFA is the only MFA factor; NEW_PASSWORD_REQUIRED answers the force-change-password challenge of admin-provisioned accounts. |
Step 1 — password
{
"username": "user@example.com",
"password": "Secret1!"
}
Step 2 — MFA code
{
"username": "user@example.com",
"session": "<opaque session from step 1>",
"mfa_code": "123456"
}
Step 2 — set the password of a FORCE_CHANGE_PASSWORD account
{
"username": "user@example.com",
"session": "<opaque session from step 1>",
"challenge_name": "NEW_PASSWORD_REQUIRED",
"new_password": "NewSecret1!"
}
Responses
| Status | Description |
|---|---|
200 |
The token set (step 1 for a non-enrolled account, or step 2 after the MFA code is accepted), OR an SMS_MFA challenge when step 1 hits an account enrolled in optional SMS MFA. |
400 |
Missing/invalid username or password, account not confirmed, invalid MFA code, expired MFA code/session, or a new_password rejected by the password policy. |
401 |
Invalid credentials (wrong password, unknown user, or invalid MFA session). Identical body in all three cases — no enumeration. |
429 |
Too many attempts; retry later. |
502 |
Upstream authentication call failed; a generic error is returned and no internals are leaked. |