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

# Login

> Authenticate a user and receive a JWT token

## Request body

<ParamField body="email" type="string" required>
  User's email address
</ParamField>

<ParamField body="password" type="string" required>
  User's password
</ParamField>

## Response

<ResponseField name="message" type="string">
  Success message
</ResponseField>

<ResponseField name="user" type="object">
  User information

  <Expandable title="properties">
    <ResponseField name="firstName" type="string">
      User's first name
    </ResponseField>

    <ResponseField name="lastName" type="string">
      User's last name
    </ResponseField>

    <ResponseField name="email" type="string">
      User's email
    </ResponseField>

    <ResponseField name="role" type="string">
      User role (user, moderator, admin)
    </ResponseField>

    <ResponseField name="likedPosts" type="array">
      Array of liked post IDs
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      Account creation timestamp
    </ResponseField>
  </Expandable>
</ResponseField>

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

<ResponseExample>
  ```json 200 theme={null}
  {
    "message": "Login successful",
    "user": {
      "firstName": "John",
      "lastName": "Doe",
      "email": "user@example.com",
      "role": "user",
      "likedPosts": [],
      "createdAt": "2024-01-15T10:30:00.000Z"
    }
  }
  ```

  ```json 401 theme={null}
  {
    "message": "Invalid credentials"
  }
  ```
</ResponseExample>
