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

Create a user

Admin only. Creates a user against an active branch with a hashed password. The role must be admin or pharmacist, the email unique, and no password hash is returned.

POST/api/v1/users
Authorization
AuthorizationBearer token (JWT) · headerrequired

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

Request body
requiredapplication/json
full_namestringrequired
emailstringrequired
passwordstringrequired
rolestringrequired
branch_idstringrequired
phonestring
Responses
201

User created

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

A required field is missing or invalid, the branch does not exist or is inactive, or the email is already in use

detailstringrequired
401

Not authenticated

detailstringrequired
403

Caller is not an admin

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