Inventory Levels API
Scope: Tenant-scoped; requires authenticated org context
Availability: Not available in SuperAdmin
Endpoints
Create Inventory Level
POST /api/inventory-levels
Create or update inventory level settings (min/max/reorder quantities) for a product at a location.
Request Body:
{
"productMasterId": "prod_123",
"locationId": "loc_123",
"minQuantity": 50,
"reorderQuantity": 100,
"maxQuantity": 500,
"status": "Supported",
"abcClass": "A",
"expectedLeadTimeDays": 7,
"replenishmentPeriodDays": 14,
"forecastPeriodDays": 30,
"forecastQuantity": 200,
"preferredBinLocationId": "bin_123",
"replenishmentLocationId": "loc_456",
"comments": "High priority item"
}
Request Fields:
| Field | Type | Required | Description |
|---|
productMasterId | string | Yes* | Product Master ID (or productId for legacy) |
productId | string | No | Legacy Product ID (deprecated) |
locationId | string | Yes | Location ID |
minQuantity | number | No | Minimum quantity (must be ≤ reorder ≤ max) |
reorderQuantity | number | No | Reorder point (must be ≥ min and ≤ max) |
maxQuantity | number | No | Maximum quantity (must be ≥ reorder) |
status | string | No | Status (default: “Supported”) |
abcClass | string | No | ABC classification (A, B, or C) |
expectedLeadTimeDays | integer | No | Expected lead time in days |
replenishmentPeriodDays | integer | No | Replenishment period in days |
forecastPeriodDays | integer | No | Forecast period in days |
forecastQuantity | number | No | Forecast quantity |
preferredBinLocationId | string | No | Preferred bin location |
replenishmentLocationId | string | No | Replenishment source location |
comments | string | No | Additional comments |
Response:
{
"id": "level_123",
"productMasterId": "prod_123",
"locationId": "loc_123",
"minQuantity": 50,
"reorderQuantity": 100,
"maxQuantity": 500,
"status": "Supported",
"abcClass": "A",
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T10:00:00Z",
"product": {
"id": "prod_123",
"sku": "SKU-123",
"name": "Product Name"
},
"productMaster": {
"id": "prod_123",
"globalSku": "SKU-123",
"productName": "Product Name"
}
}
Update Inventory Level
PATCH /api/inventory-levels/{id}
Update inventory level settings.
Request Body:
{
"minQuantity": 75,
"reorderQuantity": 150,
"maxQuantity": 600,
"status": "Supported",
"abcClass": "A",
"comments": "Updated based on recent demand"
}
Response:
{
"id": "level_123",
"productMasterId": "prod_123",
"locationId": "loc_123",
"minQuantity": 75,
"reorderQuantity": 150,
"maxQuantity": 600,
"status": "Supported",
"abcClass": "A",
"updatedAt": "2024-01-15T11:00:00Z"
}
Delete Inventory Level
DELETE /api/inventory-levels/{id}
Delete an inventory level configuration.
Response:
{
"success": true,
"message": "Inventory level deleted"
}
Example Requests
Create Inventory Level
curl -X POST "https://app.betterdata.co/api/inventory-levels" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"productMasterId": "prod_123",
"locationId": "loc_123",
"minQuantity": 50,
"reorderQuantity": 100,
"maxQuantity": 500
}'
Update Inventory Level
curl -X PATCH "https://app.betterdata.co/api/inventory-levels/level_123" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reorderQuantity": 150
}'
Common Errors
400 Bad Request - Invalid Quantities
{
"error": "Invalid quantities: min ≤ reorder ≤ max required"
}
Cause: Quantity validation failed (e.g., min > reorder or reorder > max).
Solution: Ensure min ≤ reorder ≤ max.
404 Not Found
{
"error": "Product or location not found"
}
Cause: Product or location doesn’t exist or isn’t accessible.
Solution: Verify the product and location IDs are correct and accessible to your organization.
Related Pages
Permissions & Roles
Viewing inventory levels requires standard user permissions. All inventory data is scoped to your organization.