Add

[POST] .../v1/docreturnstopartner/add

Creates a new partner return document. Use this method to create a return-to-partner document header before adding item lines with ReturnsToPartnerOperation/Add. The request body must contain date, partner_id, stock_id, currency_id and vat_calculation_type; attached_user_id is optional and defaults to the current request user when omitted or 0, exchange_rate defaults from currency data when not provided for non-base currency and description is limited to 300 characters. The selected stock must be available to the current request user, closed periods prevent creating the document and an optional contract must exist and use the same currency; validation, permission, stock access, contract, period, database, webhook or persistence errors are returned as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
attached_user_id Int64 Optional Responsible user ID. If omitted or 0, the API uses the current request user.
contract_id Int64 Optional Contract ID. Optional; when provided, the contract currency must match currency_id.
currency_id Int64 Required Currency ID.
date Int64 Required Return-to-partner document date as Unix time in seconds.
description String Optional Additional description. Maximum length is 300 characters.
exchange_rate Decimal Optional Exchange rate. Optional; base currency uses 1 and missing non-base rate is taken from the currency catalog.
partner_id Int64 Required Partner ID.
stock_id Int64 Required Stock ID.
vat_calculation_type String Required VAT calculation mode: No - do not accrue, Exclude - included in the amount, Include - added on top. Allowed values: No, Exclude, Include.

Request Example

{
  "date": 1767225600,
  "partner_id": 301,
  "stock_id": 11,
  "currency_id": 1,
  "contract_id": 701,
  "exchange_rate": 1,
  "vat_calculation_type": "Exclude",
  "attached_user_id": 5,
  "description": "Return defective goods to supplier"
}

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