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

# Users Management

> Partner user profile and user administration APIs.

All endpoints on this page require:

```http theme={null}
Authorization: Bearer <partner_jwt>
```

## Role Model

* `admin`: partner admin user
* `user`: partner normal user

Only partner admin can call:

* `POST /api/users`
* `DELETE /api/users/:id`
* `POST /api/users/:id/active-status`

## 1) Get Current User

```http theme={null}
GET /api/users/me
```

Returns current JWT user profile.

## 2) List Partner Users

```http theme={null}
GET /api/users
```

Returns all users under authenticated user's partner.

## 3) Create Partner User (Admin only)

```http theme={null}
POST /api/users
```

Request body:

| Field         | Type   | Required | Notes             |
| ------------- | ------ | -------- | ----------------- |
| `email`       | string | Yes      | User email        |
| `password`    | string | Yes      | MD5 string        |
| `firstName`   | string | No       | Optional          |
| `lastName`    | string | No       | Optional          |
| `phoneNumber` | string | No       | Optional          |
| `role`        | string | Yes      | `admin` or `user` |

Example:

```json theme={null}
{
  "email": "new.user@partner.com",
  "password": "<MD5_PASSWORD_HASH>",
  "firstName": "New",
  "lastName": "User",
  "phoneNumber": "+12025550124",
  "role": "user"
}
```

## 4) Delete Partner User (Admin only)

```http theme={null}
DELETE /api/users/:id
```

Rules:

* Target user must belong to same partner

## 5) Update User Active Status (Admin only)

```http theme={null}
POST /api/users/:id/active-status
```

Request body:

```json theme={null}
{
  "isActive": false
}
```

Rules:

* Current user must be partner `admin`
* Target user must belong to same partner
* Only target users with role `user` can be updated

## Success Response Envelope

For write operations returning no payload in service:

```json theme={null}
{
  "message": "success"
}
```

or `data` may be empty depending on client parser.

## Common Errors

* `403 Require partner admin role`
* `404 User not found`
* `403 Cannot delete user from another partner`
* `403 Cannot update user from another partner`
* `400 Can only update user role status, not admin`
* `409 Conflict` (duplicate email under same partner)
