Add
[POST] .../v1/docwholesalereturn/add
Creates a wholesale customer return document. Create a wholesale return document header before adding item lines with WholeSaleReturnOperation/Add. Optional price_type_id selects an existing price type for pricing new item lines; omitted or 0 leaves it unset. Unknown price types return HTTP 200 ErrorResult with error 1044. 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 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.
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-from-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. |
| price_type_id | Int64 | Optional | Optional price type ID. Omitted or 0 creates a document without a price type. When selected, zero prices on newly added item lines are taken from this price type. |
| 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,
"price_type_id": 7,
"exchange_rate": 1,
"vat_calculation_type": "Exclude",
"attached_user_id": 5,
"description": "Return from partner warehouse"
}
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": 6601
}
}