Edit

[POST] .../v1/docinvoice/edit

Edits an invoice document. Use this method to update an editable invoice header after DocInvoice/Lock and before posting or sending the invoice. The request body must contain id; optional fields update the stored values when provided and the method returns UpdateResult with row_affected for the changed invoice. The invoice must exist, be locked by the current request user, not be marked for deletion, not be posted and have status New or ErrorSent; contract changes must match invoice direction and corrective invoices validate their source DocWholeSale document. The current request user must have invoice edit permission; missing body, validation errors, denied access, unlocked document, non-editable status, tariff restriction, source document, currency, database or transaction failures are returned as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
attached_user_id Int64 Optional Responsible user ID. Null means no change, 0 clears the responsible user and a positive value assigns that user.
code String Optional Invoice code. If omitted, the stored code is not changed. Maximum length is 50 characters.
contract_id Int64 Optional Contract ID. Positive values assign a contract and must match the invoice direction.
corrected_code String Optional Code of the corrected source document. Used for corrective invoices. Maximum length is 50 characters.
corrected_date Int64 Optional Date of the corrected source document as Unix time in seconds. Used for corrective invoices.
currency_id Int64 Optional Currency ID. If 0, the stored currency is not changed.
date Int64 Optional Invoice date as Unix time in seconds. If 0, the stored date is not changed.
description String Optional Additional description. Maximum length is 300 characters; null means no change.
document_id Int64 Optional ID of the document that the corrective invoice is created from.
document_type_id Int64 Optional ID of the document type that the corrective invoice is created from.
exchange_rate Decimal Optional Exchange rate. If 0, the stored rate is not changed unless the selected currency is the base currency; negative values are invalid.
firm_id Int64 Optional Company ID. If 0, the stored company is not changed.
id Int64 Required Invoice ID.
partner_id Int64 Optional Partner ID. If 0, the stored partner is not changed.
vat_calculation_type String Optional VAT calculation mode: No - do not accrue, Exclude - included in the amount, Include - added on top. Allowed values: No, Exclude, Include.

Request Example

{
  "id": 9101,
  "date": 1767229200,
  "code": "INV-0009101-A",
  "currency_id": 1,
  "exchange_rate": 1,
  "description": "Adjusted invoice header",
  "vat_calculation_type": "Exclude",
  "attached_user_id": 5
}

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
  }
}