[POST] .../v1/docpayment/edit
Edits payment document. Use this method to update a payment document while preserving the existing document identity and workflow state. It returns row_affected. Main payment fields are updated only while the document is not posted; description and custom fields can still be changed through the edit path. contract_id and attached_user_id are nullable patch fields: null leaves the current value unchanged, 0 clears it and a positive ID sets a new value. The edit permission is selected from the existing document category direction and is checked for the current request user before the persistent layer changes the row. Missing body, invalid id or description, missing document, denied permission, tariff limitations, category direction mismatch, missing references, no changed fields and storage conflicts are returned as HTTP 200 ErrorResult business errors.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| amount | Decimal | Optional | New payment amount with up to 3 decimal places. Values less than or equal to 0 leave the existing amount unchanged. |
| attached_user_id | Int64 | Optional | Responsible user patch value: null leaves it unchanged, 0 clears it and a positive ID sets a responsible user. |
| category_id | Int64 | Optional | New income or expense category ID. It must keep the same direction as the existing document category. |
| contract_id | Int64 | Optional | Contract document patch value: null leaves it unchanged, 0 clears it and a positive ID sets a new contract. |
| date | Int64 | Optional | New document date as Unix time in seconds. Values less than or equal to 0 leave the existing date unchanged. |
| description | String | Optional | Additional description patch value. Null leaves it unchanged; an empty string clears the description. Maximum length is 300 characters. |
| exchange_rate | Decimal | Optional | New exchange rate for non-base currency payments with up to 8 decimal places. 0 leaves the existing rate unchanged. |
| fields | Array of FieldValueEdit | Optional | Custom field values to add, update or remove. |
| firm_id | Int64 | Optional | New company ID. Values less than or equal to 0 leave the existing company unchanged. |
| id | Int64 | Required | Required payment document ID. |
| partner_id | Int64 | Optional | New partner ID. Values less than or equal to 0 leave the existing partner unchanged. |
| type_id | Int64 | Optional | New payment type ID. Values less than or equal to 0 leave the existing type unchanged. |
Request Example
{
"id": 42,
"date": 1714554000,
"amount": 2550000.000,
"exchange_rate": 1.00000000,
"description": "Updated prepayment description",
"attached_user_id": 0
}
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
}
}