M3 API Reference
The M3 Inventory API provides endpoints for managing inventory items, locations, stock movements, and alerts.
Base URL
Section titled “Base URL”Production: https://m3.inspiringlivingsolutions.com/apiDevelopment: http://localhost:3000/apiAuthentication
Section titled “Authentication”Requires Clerk session authentication.
Endpoints
Section titled “Endpoints”Inventory Items
Section titled “Inventory Items”List Items
Section titled “List Items”GET /itemsQuery Parameters:
| Parameter | Type | Description |
|---|---|---|
| page | number | Page number |
| limit | number | Items per page |
| category | string | Filter by category |
| propertyId | string | Filter by property |
| locationId | string | Filter by location |
| condition | string | Filter by condition |
| lowStock | boolean | Only low stock items |
Response:
{ "data": [ { "id": "uuid", "name": "Bath Towels - White", "category": "LINENS", "quantity": 24, "minStock": 10, "condition": "GOOD", "property": { "id": "uuid", "name": "Villa Sunrise" }, "location": { "id": "uuid", "name": "Linen Closet" } } ], "pagination": { "page": 1, "limit": 20, "total": 500 }}Get Item
Section titled “Get Item”GET /items/:idCreate Item
Section titled “Create Item”POST /itemsBody:
{ "name": "Bath Towels - White", "sku": "TWL-BTH-WHT", "category": "LINENS", "propertyId": "uuid", "locationId": "uuid", "quantity": 24, "unit": "EACH", "minStock": 10, "maxStock": 50, "condition": "NEW", "unitCost": 250, "currency": "THB"}Update Item
Section titled “Update Item”PATCH /items/:idDelete Item
Section titled “Delete Item”DELETE /items/:idStock Movements
Section titled “Stock Movements”Record Movement
Section titled “Record Movement”POST /movementsBody:
{ "itemId": "uuid", "type": "USE", "quantity": 5, "notes": "Used for turnover", "referenceType": "WORK_ORDER", "referenceId": "wo-uuid"}Movement Types:
- INITIAL
- PURCHASE
- USE
- DAMAGE
- LOSS
- TRANSFER_IN
- TRANSFER_OUT
- ADJUSTMENT
- RETURN
List Movements
Section titled “List Movements”GET /movementsQuery Parameters:
| Parameter | Type | Description |
|---|---|---|
| itemId | string | Filter by item |
| type | string | Filter by type |
| startDate | string | From date |
| endDate | string | To date |
Transfers
Section titled “Transfers”Create Transfer
Section titled “Create Transfer”POST /transfersBody:
{ "sourceLocationId": "uuid", "destinationLocationId": "uuid", "items": [ { "itemId": "uuid", "quantity": 5 }, { "itemId": "uuid", "quantity": 3 } ], "notes": "Moving stock to Villa B"}Receive Transfer
Section titled “Receive Transfer”POST /transfers/:id/receiveBody:
{ "items": [ { "itemId": "uuid", "receivedQuantity": 5 }, { "itemId": "uuid", "receivedQuantity": 2, "notes": "1 damaged" } ]}Locations
Section titled “Locations”List Properties
Section titled “List Properties”GET /propertiesList Locations
Section titled “List Locations”GET /locationsQuery Parameters:
| Parameter | Type | Description |
|---|---|---|
| propertyId | string | Filter by property |
| parentId | string | Filter by parent |
| type | string | Filter by type |
Create Location
Section titled “Create Location”POST /locationsBody:
{ "name": "Master Bedroom", "type": "ROOM", "propertyId": "uuid", "parentId": "uuid", "description": "Main floor master"}Categories
Section titled “Categories”List Categories
Section titled “List Categories”GET /categoriesCreate Category
Section titled “Create Category”POST /categoriesBody:
{ "name": "Pool Equipment", "parentId": "uuid", "description": "Pool and spa items"}Alerts
Section titled “Alerts”List Alerts
Section titled “List Alerts”GET /alertsQuery Parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | ACTIVE, ACKNOWLEDGED, RESOLVED |
| type | string | LOW_STOCK, CONDITION, EXPIRY |
| propertyId | string | Filter by property |
Acknowledge Alert
Section titled “Acknowledge Alert”POST /alerts/:id/acknowledgeResolve Alert
Section titled “Resolve Alert”POST /alerts/:id/resolveBody:
{ "action": "Ordered 20 units", "notes": "PO-12345 created"}Reports
Section titled “Reports”Stock Report
Section titled “Stock Report”GET /reports/stockMovement Report
Section titled “Movement Report”GET /reports/movementsValuation Report
Section titled “Valuation Report”GET /reports/valuationError Responses
Section titled “Error Responses”{ "error": { "code": "INSUFFICIENT_STOCK", "message": "Not enough stock for this movement", "details": { "available": 5, "requested": 10 } }}