Skip to main content

Rebuild Batch

POST 

/api/ledger/batches/:batch/rebuild

Manually rebuild the batch's aggregate journal entry: marks the batch dirty (posted batches flip to reopened — the post-post correction pathway, where the rebuild reverses + replaces the posted aggregate entry) and dispatches a background job immediately (no debounce for a manual request; the job's per-batch uniqueness still collapses doubles).

Authorization

Any valid API token can call this endpoint — no specific scope required. Manage tokens.

Deliberately NOT a tracked job: batch builds run in seconds on the per-tenant serial queue, and the batch row's status transition (dirty/reopened → open/closing) is the user-visible completion signal.

Authentication: Requires Bearer token.

Request body: none.

Response: accepted-style 200 — the work is queued (App\Response normalizes every 2xx to 200). Returns 404 when the batch does not exist.

Permission: requires accounting.sync (granular permissions; admins bypass; unenforced when the tenant's granular_permissions feature flag is off). Returns 403 without it.

Request

Responses

OK

Response Headers
    Content-Type