Skip to main content

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:
FieldTypeRequiredDescription
productMasterIdstringYes*Product Master ID (or productId for legacy)
productIdstringNoLegacy Product ID (deprecated)
locationIdstringYesLocation ID
minQuantitynumberNoMinimum quantity (must be ≤ reorder ≤ max)
reorderQuantitynumberNoReorder point (must be ≥ min and ≤ max)
maxQuantitynumberNoMaximum quantity (must be ≥ reorder)
statusstringNoStatus (default: “Supported”)
abcClassstringNoABC classification (A, B, or C)
expectedLeadTimeDaysintegerNoExpected lead time in days
replenishmentPeriodDaysintegerNoReplenishment period in days
forecastPeriodDaysintegerNoForecast period in days
forecastQuantitynumberNoForecast quantity
preferredBinLocationIdstringNoPreferred bin location
replenishmentLocationIdstringNoReplenishment source location
commentsstringNoAdditional 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.

Permissions & Roles

Viewing inventory levels requires standard user permissions. All inventory data is scoped to your organization.