> ## 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.

# Get all users

> Retrieve all users (admin only)

<Note>
  This endpoint requires admin role.
</Note>

## Response

Returns an array of all users (excluding passwords), sorted by creation date (newest first).

<ResponseField name="users" type="array">
  Array of user objects

  <Expandable title="user object">
    <ResponseField name="_id" type="string">
      User ID
    </ResponseField>

    <ResponseField name="user_id" type="string">
      Hashed user identifier
    </ResponseField>

    <ResponseField name="firstName" type="string">
      First name
    </ResponseField>

    <ResponseField name="lastName" type="string">
      Last name
    </ResponseField>

    <ResponseField name="email" type="string">
      Email address
    </ResponseField>

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

    <ResponseField name="profilePic" type="string">
      Profile picture URL
    </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 https://api-verifier-2.onrender.com/api/users \
    -H "Authorization: Bearer <admin-token>"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  [
    {
      "_id": "65a1b2c3d4e5f6g7h8i9j0k1",
      "user_id": "sha256hash...",
      "firstName": "John",
      "lastName": "Doe",
      "email": "john@example.com",
      "role": "user",
      "profilePic": "",
      "likedPosts": [],
      "createdAt": "2024-01-10T08:00:00.000Z"
    },
    {
      "_id": "65a1b2c3d4e5f6g7h8i9j0k2",
      "user_id": "sha256hash...",
      "firstName": "Jane",
      "lastName": "Smith",
      "email": "jane@example.com",
      "role": "moderator",
      "profilePic": "https://example.com/pic.jpg",
      "likedPosts": ["post-id-1", "post-id-2"],
      "createdAt": "2024-01-05T12:00:00.000Z"
    }
  ]
  ```
</ResponseExample>
