Run Generation Now
POST/api/ledger/generation/run
Trigger on-demand entry generation: every candidate in scope (see List Generation Candidates) is enqueued as an updated ledger outbox row and the drain job is dispatched immediately — the SAME pipeline the per-minute schedule runs, just started now. The posting service's source_version_hash makes already-current documents a free no-op, so the trigger is idempotent.
Any valid API token can call this endpoint — no specific scope required. Manage tokens.
Authentication: Requires Bearer token + accounting.sync permission (403 without it).
Request body (all optional):
candidates(array|null, max 1000) — explicit selection of documents to generate:[{source_type, source_id}, ...]. When present, ONLY these are enqueued and the type/date scope is ignored (the modal's multi-select). Eachsource_typemust be a registered source FQN (422 otherwise).source_type(string|null) — restrict to one source document FQN from the posting-rule registry; omit/null for all typesdate_from/date_to(Y-m-d|null) — restrict by each document's accounting date;date_tomust be >=date_frominclude_frozen(boolean, default false) — scope runs normally skip documents dated before the tenant's accounting cutover (their imported history is frozen so it is never rewritten by accident). Set true to deliberately re-derive that frozen history with the current posting rules — this replaces the migrated figures and can update linked, still-editable provider documents, so treat it as a confirmed administrative action. Ignored whencandidatesis present (hand-picked documents always regenerate).
Errors: 422 with an enabled error when ledger generation is disabled for the tenant (enable it under Settings → Generation first); 422 for unknown source_type.
Response: data.result.enqueued is the number of documents processed/enqueued. data.result.skipped_locked_period counts documents that were skipped because they are dated in a locked accounting period — these are not generated (unlock the period or change the document date, then try again). A locked-period document is reported this way rather than failing the whole run.
Request
Responses
- 200
- 401
- 403
- 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.
Unprocessable Content
Response Headers
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.