---
search:
  tags:
    - Users
    - POST
seo:
  description: >-
    Admin only. Creates a user against an active branch with a hashed password.
    The role… Reference for the POST /api/v1/users endpoint in the PharmaFlow
    API.
sidebar:
  label: Create a user
  badge: POST
title: Create a user
type: openapi-operation
---
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`

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

- `full_name` (string, required)
- `email` (string, required)
- `password` (string, required)
- `role` (string, required)
- `branch_id` (string, required)
- `phone` (string)

Request body example:

```json
{
  "full_name": "string",
  "email": "string",
  "password": "string",
  "role": "string",
  "branch_id": "string",
  "phone": "string"
}
```

**Responses**

- `201` — User created
- `400` — A required field is missing or invalid, the branch does not exist or is inactive, or the email is already in use
- `401` — Not authenticated
- `403` — Caller is not an admin

Response example, 201:

```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"
}
```
