Set

[POST] .../v1/itemstocklimit/set

Sets stock-specific item quantity limits. Use this method to create or replace minimum and maximum item quantity limits for warehouses. Each array item identifies one item_id and stock_id pair and sets min_quantity and max_quantity for that pair; max_quantity = 0 means no maximum limit. If a pair already has the same active values, it is not counted in row_affected, returned ids, action log records or item webhooks. Item/GetExt returns these stock-specific values directly in item.min_quantity and item.max_quantity when the request selects exactly one accessible stock_id; deleting the pair makes Item/GetExt fall back to the item's global limits. This method requires billing db version 404 or later; older account databases return ErrorResult 1008. The caller must have item edit permission; missing request body, invalid item_id or stock_id, services, invalid quantity limits, denied warehouse access, duplicate pairs and persistent storage errors are returned as HTTP 200 ErrorResult.

Request Parameters

Name Type Required Description
item_id Int64 Required Item ID. The item must be an active catalog item, not a service.
max_quantity Decimal Required Maximum item quantity for the stock. Zero means no maximum limit.
min_quantity Decimal Required Minimum item quantity for the stock.
stock_id Int64 Required Stock ID.

Request Example

[
  {
    "item_id": 1001,
    "stock_id": 3,
    "min_quantity": 12.5,
    "max_quantity": 120.0
  }
]

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result Update Update operation result.

Response Example

{
  "ok": true,
  "result": {
    "row_affected": 1,
    "ids": [
      501
    ]
  }
}