[POST] .../v1/docordertopartner/add
Creates a new partner order document. Use this method to create a supplier order header that later receives requested item rows through OrderToPartnerOperation/Add and can be copied into a purchase document workflow. The request body must contain date, partner_id, currency_id, status_id and vat_calculation_type; status_id must belong to DocOrderToPartner document type, contract_id is optional and description is limited to 300 characters. If attached_user_id is omitted or 0, the API attaches the current request user; for the base currency the API stores exchange_rate = 1, otherwise a positive exchange_rate must fit decimal(18,8) or the currency directory rate is used. The caller must have partner order add permission; missing body, invalid required fields, unavailable tariff, invalid status type, invalid exchange rate, denied access, database failures or webhook failures 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. If omitted or 0, the document is created without a contract. |
| currency_id | Int64 | Required | Currency ID. |
| date | Int64 | Required | Order-to-partner document date as Unix time in seconds. Negative values are rejected. |
| description | String | Optional | Document note. Maximum length is 300 characters. |
| exchange_rate | Decimal | Optional | Exchange rate. For the base currency the API stores 1; for other currencies a positive value must fit decimal(18,8), otherwise the currency directory exchange rate is used. |
| partner_id | Int64 | Required | Partner ID. |
| status_id | Int64 | Required | Partner order status ID. The status must belong to DocOrderToPartner document type. |
| 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": 201,
"currency_id": 1,
"status_id": 3,
"contract_id": 301,
"exchange_rate": 1,
"vat_calculation_type": "Exclude",
"description": "January supplier order"
}
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": 4501
}
}