Add

[POST] .../v1/stock/add

Creates a stock. Use this method to create a stock before it is used in warehouse documents, retail cash registers or user stock assignments. It returns new_id and validates name, firm_id, optional area and current-user context; name is required and must not exceed 150 characters, address must not exceed 255 characters and description must not exceed 1024 characters. The caller must have stock add permission; missing body, invalid required fields, invalid current user, denied access, tariff stock-count limits, related-firm validation failures and storage errors are returned as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
address String Optional Stock address. Maximum length is 255 characters.
area Decimal Optional Stock area. If specified, the value must be greater than 0; if omitted, the database default is used.
description String Optional Stock description or note. Maximum length is 1024 characters.
firm_id Int64 Required Company ID.
name String Required Stock name. Maximum length is 150 characters.

Request Example

{
  "name": "Main store",
  "firm_id": 2,
  "address": "Tashkent, Buyuk Ipak Yuli 10",
  "area": 120.500,
  "description": "Primary retail stock"
}

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result Insert Created record result.

Response Example

{
  "ok": true,
  "result": {
    "new_id": 8
  }
}