# `POST /ledger` Protected. Requires a valid session cookie (`credentials: 'include'`). Add ledger entry Appends a new entry to the append-only ledger table. `hash_version` is fixed to 1. `prev_hash` is cryptographically chained: for the genesis row it defaults to `TODO_TSE_BASED_INITHASH`, and for subsequent rows it is the SHA-512 hex hash of the canonical JSON representation of the previous highest-id entry. Requires authentication and membership in the company owning the referenced manifest article. ## Body (JSON) ```json { "manifestarticle_id": 1, "transaction_type": "…", "amount": 1, "transaction_text": "…" } ``` ## Response `201` Ledger entry added successfully ```json { "ledger": { "id": 1, "manifestarticle_id": 1, "transaction_type": "…", "amount": 1, "transaction_text": "…", "hash_version": 1, "prev_hash": "…", "sku": "…", "created_at": "2026-08-10T00:00:00.000Z" } } ``` ## Errors | Status | Description | |--------|-------------| | 400 | Invalid ledger entry or no company selected — `{"error":"…"}` | | 401 | Unauthorized — `{"error":"…"}` | | 403 | Not authorized — `{"error":"…"}` | | 404 | Manifest article or company not found — `{"error":"…"}` | --- _Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._