5f993bd211f5
Starts closing every billing period awaiting review that ended before a date, optionally limited to those worth no more than a given amount.
Answers 202 with a run identifier and closes the periods in the background — each one costs a full invoice recomputation, so a selection of a few hundred takes minutes. Poll GET /billing-periods/close-bulk/{bulkCloseId} for progress, per-period verdicts and the total written off. Each period is closed exactly as the per-period close does, and one period failing is recorded against that period rather than abandoning the rest. A period whose live residual exceeds maxNetInvoiceableAmount is refused rather than written off, so a selection built for small residuals cannot write off a real bill that arrived after the last settlement. Set dryRun to compute what the sweep would write off without minting write-off vouchers or closing anything. Answers 409 Conflict while another sweep is still running; only one runs at a time.
Request body
Response
Accepted