Add

[POST] .../v1/docperiodclosing/add

Creates a new period closing document. Use this method after DocPeriodClosing/IsCanDo shows that the firm is ready to create a new period closing document. The request body is required, firm_id and close_date are required, run_date is optional and when run_date is supplied it must be at least four hours after the end of the account-local close_date day; if run_date is omitted the server schedules it from close_date. The persistent layer rejects a new document when a later non-canceled closing document already exists or an earlier closing document is still in work for the same firm. The response returns new_id and fires the DocPeriodClosingAdded webhook; business errors such as missing body, invalid dates, denied access, missing firm, conflicting closing periods or database failures are returned as HTTP 200 ErrorResult.

Request Parameters

Name Type Required Description
close_date Int64 Required Required period closing date as Unix time in seconds. The period day is resolved in the account timezone.
description String Optional Optional additional description. Maximum length is 300 characters.
firm_id Int64 Required Required company ID.
run_date Int64 Optional Optional period closing processing date as Unix time in seconds. When supplied, it must be at least four hours after the end of the account-local close_date day.

Request Example

{
  "firm_id": 2,
  "close_date": 1714521599,
  "run_date": 1714535999,
  "description": "April 2024 closing"
}

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