latestOpenAPI 3.0.42026-08-213579001013.0 KB

5f993bd211f5

Billing

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.

post/billing-periods/close-bulk

Request body

endedBeforestring date-time required

Only periods that ended before this date are closed.

maxNetInvoiceableAmountnumber double nullable

When set, only periods with at most this much left to invoice are closed, and a period whose amount has grown past it since it was last settled is refused.

reasonstring required

Why the remaining amounts will never be invoiced.

dryRunboolean

Report what the sweep would write off without closing anything or minting any vouchers.

Response

Accepted

bulkCloseIdstring required

The run to poll for the sweep's progress.

dryRunboolean required

Whether this run only reports what it would have written off.