> ## 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 Success (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 Invalid Credentials (401) theme={null}
  {
    "message": "Invalid email or password"
  }
  ```
</ResponseExample>
