---
search:
  tags:
    - Users
    - PUT
seo:
  description: >-
    Any signed in user. Patches a user; an admin may move the role, branch, and…
    Reference for the PUT /api/v1/users/{userId} endpoint in the PharmaFlow API.
sidebar:
  label: Update a user
  badge: PUT
title: Update a user
type: openapi-operation
---
Any signed in user. Patches a user; an admin may move the role, branch, and active flag. A pharmacist may edit only their own name and phone, and the password is refused here.

`PUT /api/v1/users/{userId}`

**Request body** (`application/json`, required)

- `full_name` (string)
- `phone` (string)
- `role` (string)
- `branch_id` (string)
- `is_active` (boolean)

Request body example:

```json
{
  "full_name": "string",
  "phone": "string",
  "role": "string",
  "branch_id": "string",
  "is_active": true
}
```

**Responses**

- `200` — User updated
- `400` — No valid fields, a supplied field fails validation, the password is refused here, or the branch does not exist or is inactive
- `401` — Not authenticated
- `403` — Access forbidden
- `404` — User not found

Response example, 200:

```json
{
  "id": "string",
  "branch_id": "string",
  "email": "string",
  "full_name": "string",
  "phone": "string",
  "role": "string",
  "is_active": true,
  "last_login_at": "string",
  "created_at": "string",
  "updated_at": "string",
  "branch_name": "string"
}
```
