Skip to main content

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.

Authorization

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). Each source_type must 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 types
  • date_from / date_to (Y-m-d|null) — restrict by each document's accounting date; date_to must be >= date_from
  • include_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 when candidates is 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

OK

Response Headers
    Content-Type