Add

[POST] .../v1/purchaseoperation/add

Creates a new operation receipt from partner. Use this method to create one or more item lines in a receipt-from-partner document before the document is posted or priced. The request body is a JSON array batch; every operation must contain document_id, item_id, positive quantity and non-negative cost; vat_value is optional and uses the item's VAT rate when omitted; all array items must reference the same document_id. The response returns row_affected and ids for created operations and the caller must have purchase-operation add permission; null, empty or oversized arrays, invalid numeric values, mixed document_ids, denied access or persistent validation failures are returned as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
cost Decimal Required Purchase cost per item. Required; zero is allowed and negative values are rejected.
description String Optional Note.
document_id Int64 Required Receipt-from-partner document ID.
item_id Int64 Required Item ID.
order Int64 Optional Operation order. NULL means not set and is stored as NULL in the database. Ignored for database versions earlier than 363.
price Decimal Optional Sale price to write for the item when purchase price update is enabled.
quantity Decimal Required Purchased item quantity. Must be greater than zero.
vat_value Decimal Optional VAT rate value for the operation. Null uses the item's VAT rate; -1 is accepted for document/default VAT behavior.

Request Example

[
  {
    "document_id": 5001,
    "item_id": 1001,
    "quantity": 12.5,
    "cost": 42000,
    "price": 48000,
    "vat_value": 12,
    "order": 1,
    "description": "Arabica Coffee 1 kg"
  }
]

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": [
      7001
    ]
  }
}