Inventory

Inventory is branch-scoped unless centralization shares catalog across branches.

The inventory model

Properties

  • Name
    id
    Type
    string
    Description

    Inventory item UUID.

  • Name
    name
    Type
    string
    Description

    Product name.

  • Name
    sku
    Type
    string
    Description

    Stock keeping unit.

  • Name
    quantityOnHand
    Type
    number
    Description

    Current stock at branch.


GET/api/inventory

List items

Search, category, pagination.

Query parameters

Query parameters: page, pageSize, search.

Request

GET
/api/inventory
curl -X GET http://localhost:3000/api/inventory \
  -H "Authorization: Bearer YOUR_JWT"

Response

{
  "data": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "name": "Paracetamol 500mg",
      "sku": "MED-001",
      "quantityOnHand": 120,
      "unit": "tablet"
    }
  ],
  "pagination": {
    "page": 1,
    "pageSize": 20,
    "total": 1,
    "totalPages": 1
  }
}

POST/api/inventory

Create item

Add catalog item to branch inventory.

Request

POST
/api/inventory
curl -X POST http://localhost:3000/api/inventory \
  -H "Authorization: Bearer YOUR_JWT"

Response

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "New item",
  "sku": "MED-099",
  "quantityOnHand": 0
}

GET/api/inventory/:id

Retrieve item

Item detail and stock.

Request

GET
/api/inventory/:id
curl -X GET http://localhost:3000/api/inventory/:id \
  -H "Authorization: Bearer YOUR_JWT"

Response

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "Paracetamol 500mg",
  "sku": "MED-001",
  "quantityOnHand": 120,
  "category": "Medicine"
}

PATCH/api/inventory/:id

Update item

Update item fields.

Request

PATCH
/api/inventory/:id
curl -X PATCH http://localhost:3000/api/inventory/:id \
  -H "Authorization: Bearer YOUR_JWT"

Response

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "Paracetamol 500mg (updated)"
}

POST/api/inventory/adjustments

Adjust stock

Record stock adjustment.

Request

POST
/api/inventory/adjustments
curl -X POST http://localhost:3000/api/inventory/adjustments \
  -H "Authorization: Bearer YOUR_JWT"

Response

{
  "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
  "itemId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "delta": -5,
  "reason": "Damaged"
}

GET/api/inventory/:id/stock

Item stock

Stock breakdown for item.

Request

GET
/api/inventory/:id/stock
curl -X GET http://localhost:3000/api/inventory/:id/stock \
  -H "Authorization: Bearer YOUR_JWT"

Response

{
  "itemId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "quantityOnHand": 120,
  "batches": [
    {
      "batchNumber": "B001",
      "quantity": 80,
      "expiryDate": "2027-01-01"
    }
  ]
}

Was this page helpful?