Skip to main content
POST
Create critical stock definition
A critical stock definition can only be added to a product whose StockType is not 1 (no stock tracking) (2410). WarehouseName is required; a product can have at most one critical stock definition per warehouse (2403).
  • MinStock and MaxStock cannot be negative.
  • When MaxStock is greater than 0, it cannot be less than MinStock (2406); MaxStock: 0 means there is no upper limit.
  • MaxStockControl, MinStockControl and NegativeStockControl each take the following values:
  • MaxStockControl: when stock exceeds MaxStock.
  • MinStockControl: when stock falls below MinStock.
  • NegativeStockControl: when an operation would make stock negative.

Error codes

Codes this endpoint can return. The general errors that apply to every endpoint (authentication, permissions, request headers, request limits) are not repeated here.

Authorizations

Authorization
string
header
required

Access token obtained from the Noyax auth service with your API key.

Headers

X-UserID
integer<int32>
required

ID of the Noyax user the request is made on behalf of. Written to the audit fields of created, updated and deleted records.

Required range: x >= 1
X-CompanyID
integer<int32>
required

ID of the company. The user must be assigned to this company. All reads and writes are limited to this company.

Required range: x >= 1
X-PeriodID
integer<int32>

ID of the accounting period. Optional; if sent, it is written to created records.

Required range: x >= 1

Path Parameters

productId
string<uuid>
required

Product ID.

Body

WarehouseName
null | string
required

Required. Warehouse name from GET /api/v1/stock/warehouses.

Example:

"MERKEZ DEPO"

MinStock
number<double>

Minimum stock level. Cannot be negative.

Example:

10

MaxStock
number<double>

Maximum stock level. Cannot be negative; 0 means no maximum. When greater than 0, it cannot be less than MinStock.

Example:

500

MaxStockControl
integer<int32>

What happens when MaxStock is exceeded. 0: Continue, 1: Warn the user, 2: Stop the operation.

Example:

1

MinStockControl
integer<int32>

What happens when stock falls below MinStock. 0: Continue, 1: Warn the user, 2: Stop the operation.

Example:

1

NegativeStockControl
integer<int32>

What happens when stock would go negative. 0: Continue, 1: Warn the user, 2: Stop the operation.

Example:

2

Response

Created

Success
boolean
required

Whether the operation succeeded.

Example:

true

ResultCode
string
required

"0000" on success. On failure, the code of the first error; all errors are listed in Errors.

Example:

"0000"

Data
object
required
Message
null | string

Error message when Success is false. Messages of all errors are joined into a single text.