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

# ログイン

> ユーザー認証しアクセストークンを返すエンドポイントです。

## POST /auth/login

メールアドレスとパスワードでログインします。認証に成功すると、以降の API リクエスト用のアクセストークンおよびリフレッシュトークンが返されます。

### リクエストボディ

<ParamField body="email" type="string" required>
  ユーザーのメールアドレス。
</ParamField>

<ParamField body="password" type="string" required>
  アカウントのパスワード。
</ParamField>

### レスポンス

<ResponseField name="success" type="boolean">
  ログインが成功したかどうか。
</ResponseField>

<ResponseField name="message" type="string">
  読みやすいステータスメッセージ。
</ResponseField>

<ResponseField name="user" type="object">
  ユーザー情報を含むオブジェクト。

  <Expandable title="user のプロパティ">
    <ResponseField name="id" type="string">
      ユーザーの一意な識別子。
    </ResponseField>

    <ResponseField name="email" type="string">
      ユーザーのメールアドレス。
    </ResponseField>

    <ResponseField name="name" type="string">
      ユーザーの氏名。
    </ResponseField>

    <ResponseField name="emailVerified" type="boolean">
      メールアドレスが確認済みかどうか。
    </ResponseField>

    <ResponseField name="updatedAt" type="string">
      最終更新日時の ISO 8601 タイムスタンプ。
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="tokens" type="object">
  認証トークンを含むオブジェクト。

  <Expandable title="tokens のプロパティ">
    <ResponseField name="accessToken" type="string">
      以降のリクエスト認証用のアクセストークン。`Authorization` ヘッダーに Bearer として付与します。有効期限は 15 分です。
    </ResponseField>

    <ResponseField name="refreshToken" type="string">
      新しいアクセストークンを取得するためのリフレッシュトークン。有効期限は 7 日です。
    </ResponseField>

    <ResponseField name="expiresIn" type="number">
      トークンの有効期限（秒）。900 は 15 分を意味します。
    </ResponseField>

    <ResponseField name="tokenType" type="string">
      トークン種別（常に `Bearer`）。
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.llmgenerator.com/api/v1/auth/login \
    -H "Content-Type: application/json" \
    -d '{
          "email": "user@example.com",
          "password": "securePassword123"
        }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.llmgenerator.com/api/v1/auth/login', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      email: 'user@example.com',
      password: 'securePassword123'
    })
  });

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.llmgenerator.com/api/v1/auth/login',
      json={
          'email': 'user@example.com',
          'password': 'securePassword123'
      }
  )

  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 成功 (200) theme={null}
  {
    "success": true,
    "message": "Login successful",
    "user": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "email": "user@example.com",
      "name": "John Doe",
      "emailVerified": true,
      "updatedAt": "2026-01-29T12:00:00.000Z"
    },
    "tokens": {
      "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
      "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
      "expiresIn": 900,
      "tokenType": "Bearer"
    }
  }
  ```

  ```json 認証情報が無効 (401) theme={null}
  {
    "message": "Invalid email or password"
  }
  ```
</ResponseExample>
