[POST] .../v1/docpurchase/add
Creates a new partner receipt document. Use this method to create the receipt-from-partner document header before adding line operations through PurchaseOperation methods and posting the document with DocPurchase/Perform. It writes a new document header and returns new_id; attached_user_id is optional and falls back to the current request user when omitted or 0. The request requires date, partner_id, stock_id, currency_id and vat_calculation_type, checks purchase add permission, validates referenced partner, stock, currency, contract, price type, closed periods and required custom fields and returns business errors such as 1002, 1008, 1031, 1016, 1090, 1126 or persistent ErrorResult responses 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. |
| contract_id | Int64 | Optional | Contract ID. |
| currency_id | Int64 | Required | Currency ID. |
| date | Int64 | Required | Receipt-from-partner document date as Unix time in seconds. |
| description | String | Optional | Additional description. |
| exchange_rate | Decimal | Optional | Exchange rate. |
| fields | Array of FieldValueAdd | Optional | Custom field values. |
| partner_id | Int64 | Required | Partner ID. |
| price_type_id | Int64 | Optional | Price type 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": 15,
"stock_id": 2,
"currency_id": 1,
"exchange_rate": 1.0,
"vat_calculation_type": "Exclude",
"description": "Purchase invoice PI-2026-001",
"price_type_id": 3
}
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": 5001
}
}