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

# POST /api/auth/login — sign in with email or phone

> Exchange an email or phone identifier plus password for a session JWT. Handles 2FA challenges when the account has two-factor auth enabled.

Sign in with an email address or phone number and password. Returns a session JWT you use as `Authorization: Bearer` on subsequent user-scoped requests. If the account has 2FA enabled, the response is a challenge you must complete with `POST /api/auth/2fa/verify`.

**Method:** `POST` **Path:** `/api/auth/login` **Auth:** None

## Request

<ParamField body="identifier" type="string" required>
  Email address or E.164 phone number.
</ParamField>

<ParamField body="password" type="string" required>
  Account password.
</ParamField>

## Response

<ResponseField name="token" type="string">
  Session JWT. Send as `Authorization: Bearer` on subsequent requests.
</ResponseField>

<ResponseField name="user" type="object">
  Signed-in user profile.

  <Expandable>
    <ResponseField name="id" type="string">
      Stable user identifier.
    </ResponseField>

    <ResponseField name="email" type="string">
      Email, if set.
    </ResponseField>

    <ResponseField name="phone" type="string">
      Phone, if set.
    </ResponseField>

    <ResponseField name="name" type="string">
      Display name.
    </ResponseField>

    <ResponseField name="created_at" type="string">
      ISO 8601 timestamp.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="two_factor_required" type="boolean">
  Present and `true` when 2FA is enabled. In that case `token` is a short-lived challenge token; call `POST /api/auth/2fa/verify` to complete sign-in.
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://ariacompute.com/api/auth/login \
    -H "Content-Type: application/json" \
    -d '{"identifier": "you@example.com", "password": "..."}'
  ```
</CodeGroup>

```json theme={null}
{
  "token": "eyJhbGciOi...",
  "user": {
    "id": "usr_01H...",
    "email": "you@example.com",
    "name": "Jane",
    "created_at": "2026-01-14T09:30:00Z"
  }
}
```

## Errors

| Status | Meaning                             |
| ------ | ----------------------------------- |
| `400`  | Missing `identifier` or `password`. |
| `401`  | Wrong credentials.                  |
| `429`  | Too many failed attempts.           |


## Related topics

- [POST /api/auth/phone/send-otp — send SMS verification code](/api-reference/auth/send-otp.md)
- [POST /api/auth/register/email — create account with email](/api-reference/auth/register-email.md)
- [POST /api/auth/register/phone — create account with phone](/api-reference/auth/register-phone.md)
- [Authenticate requests to the Aria Compute API](/authentication.md)
- [Enable two-factor authentication for your account](/guides/two-factor-auth.md)
