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).
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
- 200
- 401
- 403
- 404
- 422
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Validation failed — the body is a field → messages map (Laravel shape) or the platform envelope with a stable machine-readable code. Fix the payload and resubmit.
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.