Add

[POST] .../v1/docopeningbalance/add

Creates a new opening settlement document with partner. Use this method to create the opening partner balance document before it is posted and reflected in partner balances. The request body is required, the caller needs the opening balance add permission, date, partner_id, firm_id, exchange_rate and currency_id are required, while omitted debit or credit is stored as 0. For the base currency the persistent layer stores exchange_rate as 1; for a non-base currency, a positive exchange_rate is validated with decimal(18,8) precision, otherwise the currency's current exchange rate is used. The response returns new_id for the created document and fires the DocOpeningBalanceAdded webhook; business errors such as missing body, required-field validation, denied access, invalid exchange_rate or database failures are returned as HTTP 200 ErrorResult.

Request Parameters

Name Type Required Description
credit Decimal Optional Credit amount value with up to 3 decimal places. If omitted, the value is stored as 0.
currency_id Int64 Required Required currency ID.
date Int64 Required Required document date as Unix time in seconds.
debit Decimal Optional Debit amount value with up to 3 decimal places. If omitted, the value is stored as 0.
exchange_rate Decimal Required Required exchange rate relative to the base currency. For the base currency the server stores 1; for non-base currency it must fit decimal(18,8).
firm_id Int64 Required Required company ID.
partner_id Int64 Required Required partner ID.

Request Example

{
  "date": 1711929600,
  "partner_id": 18,
  "firm_id": 2,
  "debit": 1250000.000,
  "credit": 250000.000,
  "exchange_rate": 1.00000000,
  "currency_id": 1
}

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": 26
  }
}