Export a generic accounting file (journal entries / configurable CSV)
Returns balanced double-entry journal entries (écritures comptables) for a date period over the per-ticket sales read model, serialised to a CONFIGURABLE, tool-agnostic ledger CSV importable into the common French accounting tools (Sage, Cegid, EBP, Quadra) WITHOUT a vendor-specific connector. Each ticket books a debit on the encaissement account of its settlement method (PCG 531/512/511/419…) and per-VAT-rate credits on revenue (707) + collected TVA (44571), so Σ débit = Σ crédit. The account mapping is FR-PCG-defaulted but OVERRIDABLE (revenueAccount, vatAccount, roundingAccount, cashAccount, bankAccount) and the CSV delimiter + decimalSeparator are configurable. REQUIRES from and to as YYYY-MM-DD with from <= to; a missing, malformed or inverted period returns 400. format defaults to json (the structured payload); format=csv streams the raw ledger CSV as a text/csv attachment (ecritures_<from>_<to>.csv). Optionally narrow to a single store.
Authorizations
Authorization: Bearer <token>. Accepts EITHER a Keycloak access token (scopes-in-token) OR an opaque POS session token; both resolve to the same pos.* scope vocabulary the route guards enforce.
Query Parameters
REQUIRED — inclusive period start (YYYY-MM-DD, from <= to). Missing/inverted → 400.
REQUIRED — inclusive period end (YYYY-MM-DD, from <= to). Missing/inverted → 400.
Optional — narrow the écritures to one store by its canonical id.
json (default) returns the structured payload; csv streams the raw ledger CSV as a text/csv; charset=utf-8 attachment (ecritures_<from>_<to>.csv). Any other value 400s.
CSV field delimiter (default ;). One character.
Euro amount decimal separator, , (default) or ..
Override the revenue (707) account. 3–20 digits.
Override the collected-VAT (44571) account. 3–20 digits.
Override the rounding/suspense (471) account. 3–20 digits.
Override the cash encaissement (531) account. 3–20 digits.
Override the bank encaissement (512) account for card + split payments. 3–20 digits.
Response
For format=json (default): the structured export — balanced entries, totals and the CSV text. For format=csv: this JSON envelope is REPLACED by the raw ledger CSV streamed as a text/csv; charset=utf-8 attachment (Content-Disposition: attachment; filename="ecritures_<from>_<to>.csv") — the content field below is exactly that file body.
For format=json (default): the structured export — balanced entries, totals and the CSV text. For format=csv: this JSON envelope is REPLACED by the raw ledger CSV streamed as a text/csv; charset=utf-8 attachment (Content-Disposition: attachment; filename="ecritures_<from>_<to>.csv") — the content field below is exactly that file body.
-9007199254740991 <= x <= 9007199254740991-9007199254740991 <= x <= 9007199254740991-9007199254740991 <= x <= 9007199254740991
