Files
dashback/docs/api/routes/ledger/history.md
2026-10-18 03:15:23 +02:00

55 lines
1.3 KiB
Markdown

# `GET /ledger/history`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Query company-wide ledger history
Queries ledger entries across all articles for the authenticated user's selected company.
Supports pagination, search filter, and date cutoff via `seekMonths`.
## Query parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `offset` | no | integer | Paging offset |
| `limit` | no | integer | Page size |
| `search` | no | string | Optional search filter across SKU, article name, manifest number, external number, transaction type, and transaction text |
| `seekMonths` | no | integer | Negative integer cutoff months ago (e.g. -1) |
## Response `200`
Paged ledger history list
```json
{
"ledger": [
{
"id": 1,
"date": "2026-08-10T00:00:00.000Z",
"sku": "…",
"name": "…",
"transaction_type": "…",
"transaction_text": "…",
"amount": 1
}
],
"total": 1,
"unfilteredTotal": 1,
"offset": 1,
"limit": 1
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Validation error or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._