Skip to main content

PUT /api/v1/inventory/decrease-stock

Decrease the available stock quantity for a specific product. This operation is typically used when processing sales or shipments.

Query Parameters

productId
integer
required
The unique identifier of the product
quantity
integer
required
The quantity to decrease from the available stock

Example Request

curl -X PUT "https://api.example.com/api/v1/inventory/decrease-stock?productId=101&quantity=5"

Response

Returns no content on success.

Status Codes

200
OK
Stock decreased successfully
400
Bad Request
Insufficient stock available for the requested quantity
404
Not Found
Inventory record not found for the specified product

Business Rules

The operation will fail if the requested quantity exceeds the available stock. The API prevents negative inventory values.
If the quantity decrease would bring the stock below the minimum stock level, the operation will still succeed but may trigger low-stock alerts in your monitoring system.

Example Error Response

When insufficient stock is available:
{
  "timestamp": "2026-03-03T10:30:00",
  "status": 400,
  "error": "Bad Request",
  "message": "Insufficient stock. Available: 3, Requested: 5"
}

Build docs developers (and LLMs) love