> ## Documentation Index
> Fetch the complete documentation index at: https://orchestrator-docs.hexoforge.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Login

> Authenticate with email and password.

Authenticates a user with email and password. Requires `X-API-Key`. If the user has TOTP enabled, tokens are not returned until you call [Login TOTP](/api-reference/gate/login-totp).

## Request body

<ParamField body="email" type="string" required>
  Valid email.
</ParamField>

<ParamField body="password" type="string" required>
  Max 128 characters.
</ParamField>

## Response

<Tabs>
  <Tab title="200 — standard login">
    ```json theme={null}
    {
      "access_token": "eyJhbGciOiJSUzI1NiIs...",
      "refresh_token": "dGhpcyBpcyBhIHJlZnJlc2g...",
      "token_type": "bearer",
      "expires_in": 900,
      "requires_totp": false,
      "login_ticket": null,
      "last_login_method": "email"
    }
    ```
  </Tab>

  <Tab title="200 — TOTP required">
    ```json theme={null}
    {
      "access_token": null,
      "refresh_token": null,
      "token_type": "bearer",
      "expires_in": null,
      "requires_totp": true,
      "login_ticket": "a1b2c3d4e5f6...",
      "last_login_method": null
    }
    ```

    Send `login_ticket` and the TOTP code to `/login/totp`. Tickets expire in **5 minutes**.
  </Tab>
</Tabs>

<ResponseField name="last_login_method" type="string | null">
  Reflects the **previous** authentication method (for example `email`, `email_totp`). Use for “Last signed in with…” hints. `null` on the user’s first login.
</ResponseField>

## Status codes

| Code | Meaning                                                          |
| ---- | ---------------------------------------------------------------- |
| 200  | Success or TOTP step required                                    |
| 401  | Invalid email or password                                        |
| 403  | Account disabled, email not verified, IP block, or firewall deny |
| 429  | Rate limited                                                     |
