Skip to content
PharmaFlow Knowledgebase
Esc
↑↓navigate↵open⌘Jpreview

Update a user

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}
Authorization
AuthorizationBearer token (JWT) · headerrequired

JWT from POST /api/v1/auth/login sent as Authorization Bearer.

Path parameters
userIdstringrequired

The user being updated.

Request body
requiredapplication/json
full_namestring
phonestring
rolestring
branch_idstring
is_activeboolean
Responses
200

User updated

idstringrequired
branch_idstringrequired
emailstringrequired
full_namestringrequired
phonestringrequired
rolestringrequired
is_activebooleanrequired
last_login_atstring | nullrequired
created_atstringrequired
updated_atstringrequired
branch_namestring | nullrequired
400

No valid fields, a supplied field fails validation, the password is refused here, or the branch does not exist or is inactive

detailstringrequired
401

Not authenticated

detailstringrequired
403

Access forbidden

detailstringrequired
404

User not found

detailstringrequired
Try it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X PUT 'http://localhost:8000/api/v1/users/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "full_name": "string",
  "phone": "string",
  "role": "string",
  "branch_id": "string",
  "is_active": true
}'
Response
{
  "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"
}