Add

[POST] .../v1/docinout/add

Creates a new cash in/out document. Use this method to create a manual stock receipt or stock write-off document before adding item rows with InOutOperation/Add. The request requires the cash in/out document add permission and the stock receipt/expense tariff option; date, stock_id and inout_type are required, description is optional and limited by the controller and attached_user_id defaults to the current request user when omitted or 0. The document date must not fall into a closed period, the stock must be visible to the current request user and the method creates only the document header, not item operations. The response returns new_id for the created document and writes the add action log plus webhook after success; business errors such as missing body, invalid required fields, denied access, disabled tariff option, closed period, stock access denial, excessive description length, database failures or action log failures are returned as HTTP 200 ErrorResult.

Request Parameters

Name Type Required Description
attached_user_id Int64 Optional Responsible user ID. If omitted or 0, the current request user is used.
date Int64 Required Required document date as Unix time in seconds. Negative values are rejected and the date must not fall into a closed period.
description String Optional Optional document note. Maximum length is 250 characters for document creation.
inout_type String Required Required document type: income - stock receipt, outcome - stock write-off. Allowed values: all, income, outcome.
stock_id Int64 Required Required stock ID. The stock must be visible to the current request user.

Request Example

{
  "date": 1714550400,
  "stock_id": 3,
  "inout_type": "outcome",
  "description": "Write-off of damaged goods"
}

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": 42
  }
}