# User management

The User Management page gives admins a searchable, paginated table of every registered user.

## Users Table

Navigate to **Admin > Users** (`/app/admin`). The table displays the following columns:

| Column         | Description                                         |
| -------------- | --------------------------------------------------- |
| **User**       | Avatar, display name, and email address             |
| **Role**       | Dropdown selector -- `user` or `admin`              |
| **Active**     | Toggle switch to activate or deactivate the account |
| **Projects**   | Number of projects owned by the user                |
| **Logs**       | Number of logged requests                           |
| **Last login** | Timestamp of the most recent login                  |
| **Created**    | Account creation date                               |

Use the **search bar** at the top to filter by name or email.

## Changing a User's Role

Select a new value from the **Role** dropdown on the user's row. The change takes effect immediately. The user will see (or lose) the Admin panel shield icon on their next page load.

## Activating and Deactivating Users

Flip the **Active** toggle to deactivate a user. Deactivated users cannot log in or make API requests. Flip it back to reactivate them.

## Self-Modification Protection

Admins **cannot** change their own role or deactivate themselves. The role dropdown and active toggle are disabled on your own row. Attempting these operations through the API returns a `400 Bad Request` error.

## API Reference

All endpoints require admin authentication.

### List users

```http
GET /api/v1/admin/users?page=1&page_size=20&search=john
```

Query parameters:

| Parameter   | Type    | Default | Description             |
| ----------- | ------- | ------- | ----------------------- |
| `page`      | integer | 1       | Page number             |
| `page_size` | integer | 20      | Users per page          |
| `search`    | string  | --      | Filter by name or email |

Returns a paginated list of users with their role, active status, project count, log count, last login, and creation date.

### Update a user

```http
PATCH /api/v1/admin/users/{user_id}
```

Request body (all fields optional):

```json
{
  "role": "admin",
  "is_active": false
}
```

Returns the updated user object. Attempting to modify your own account returns `400`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.collieai.io/admin-panel/user-management.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
