Pharmacy API Documentation

POST /register-admin

Description: Registers a new admin. Used only once or for creating admin users.

Authentication: ❌ Not required

Request Body:

{
  "email": "your_email@example.com"
}
POST /branches

Description: Creates a new branch within the pharmacy.
⚠️ A maximum of 10 branches is allowed per pharmacy.

Authentication: ✅ Required — Bearer admin token

Authorization: Bearer your_admin_token

Request Body:

{
  "name": "your_branch_name"
}
GET /branches

Description: Get all branches within the pharmacy.

Authentication: ✅ Required — Bearer admin token

Authorization: Bearer your_admin_token
GET /branches/:id

Description: Get details of a specific branch by its ID.

Authentication: ✅ Required — Bearer admin token

Authorization: Bearer your_admin_token
POST /users

Description: Creates a new user. There are two types of users:

  • Depo Manager: One per pharmacy. Request body includes "role": "depo manager".
  • Branch Pharmacist: One per branch. Request body must include "role": "branch pharmacist" and the "branch_id" to assign them to a branch.

Authentication: ✅ Required — Bearer admin token

Authorization: Bearer your_admin_token

Request Body Examples:

{
  "role": "depo manager"
}
{
  "role": "branch pharmacist",
  "branch_id": 21
}
GET /users

Description: Retrieve a list of all users.

Authentication: ✅ Required — Bearer admin token

Authorization: Bearer your_admin_token
GET /users/:id

Description: Retrieve a specific user by ID.

Authentication: ✅ Required — Bearer admin token

Authorization: Bearer your_admin_token
POST /suppliers

Description: Add a new supplier. Only depo managers are authorized to perform this action.

⚠️ A maximum of 10 suppliers can be added in total. Attempts to exceed this limit will result in an error.

Authentication: ✅ Required — Bearer token of a depo manager

Authorization: Bearer your_depo_manager_token

Request Body: application/json

{
  "name": "Global 3 Pharma Supplies",
  "contact_email": "contact@globalpharma.com",
  "phone": "+994551234567",
  "address": "123 Baku Avenue, AZ1000, Azerbaijan"
}
GET /suppliers

Description: Retrieve the list of all suppliers created by the depo manager within the pharmacy.

Roles Authorized: admin, depo manager, and branch pharmacist

Authentication: ✅ Required — Bearer token of an authorized role

Authorization: Bearer your_valid_token
GET /suppliers/:id

Description: Retrieve details of a specific supplier by its ID.

Roles Authorized: admin, depo manager, and branch pharmacist

Authentication: ✅ Required — Bearer token of an authorized role

Authorization: Bearer your_valid_token