## Batches of every unit, newest first (hr:work:billing)

`GET /api/hr/v1/work-batches`

Module: HR · operationId: `listWorkBatches` · Tag: Work billing · Auth: access token (`Authorization: Bearer <accessToken>`)

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `limit` | query | integer |  | 1–200; another value is a 400 invalid. (default `50`; max 200) |
| `offset` | query | integer |  | (default `0`) |

### Responses

- **200** Batches (`application/json`)
- **400** Error (`application/json`)
- **403** Error (`application/json`)

Fields of the 200 answer:

- `items` (array of WorkBatch, required): Batches of this page
  - `billableMinutes` (integer): Hourly minutes (flat-rate entries are not counted)
  - `contractId` (string): Trade contract of contract batches
  - `createdAt` (string (date-time)): When the batch was created
  - `customerId` (string): Customer (masterdata address id) of contract and customer batches
  - `entryCount` (integer): Number of entries in the batch
  - `grossTotal` (number, nullable): Gross total of trade's invoice
  - `id` (string (uuid)): Id of the batch
  - `invoiceNumber` (string): Given by trade on release
  - `invoicedOn` (string (date), nullable): Date of the invoice (YYYY-MM-DD) once released
  - `label` (string): Names the unit on the invoice and in lists
  - `lastError` (string): Why the last send failed (German)
  - `netAmount` (number): Net amount HR computed
  - `netTotal` (number, nullable): Net total of trade's invoice
  - `periodFrom` (string (date)): First work day of the period (YYYY-MM-DD)
  - `periodTo` (string (date)): Last work day of the period (YYYY-MM-DD)
  - `projectRef` (string): Reference of the project (project batches)
  - `requestedAt` (string (date-time)): When the batch was requested
  - `requestedBy` (string): Who requested it (e-mail)
  - `scope` (string): Billing unit of the batch (one of `project`, `contract`, `customer`)
  - `sendAttempts` (integer): Attempts to send the draft to trade
  - `state` (string): requested → drafted (trade holds the draft) → invoiced; discarded: the draft was deleted, the entries are free again (one of `requested`, `drafted`, `invoiced`, `discarded`)
  - `tradeTransactionId` (string): Id of trade's document
  - `updatedAt` (string (date-time)): When the batch was last changed
  - `version` (integer): Version for optimistic locking: send the version you read with a change (stale: 409 version_conflict)
- `total` (integer): Number of all batches

Example 200 answer:

```json
{
  "items": [
    {
      "billableMinutes": 270,
      "createdAt": "2026-11-03T10:15:00Z",
      "customerId": "1b3d5f7b-9d1f-4b3d-8f5b-9d1f3b5d7f50",
      "entryCount": 2,
      "id": "1f3b5d7f-9b1d-4f3b-8d7f-9b1d3f5b7d61",
      "label": "Kanzlei Hofmann \u0026 Partner",
      "netAmount": 427.5,
      "periodFrom": "2026-10-01",
      "periodTo": "2026-10-31",
      "requestedAt": "2026-11-03T10:15:00Z",
      "requestedBy": "christina.adler@muster-it.example",
      "scope": "customer",
      "sendAttempts": 1,
      "state": "drafted",
      "tradeTransactionId": "3b5d7f9b-1d3f-4b5d-9f9b-1d3f5b7d9f62",
      "updatedAt": "2026-11-03T10:15:04Z",
      "version": 2
    },
    {
      "billableMinutes": 180,
      "createdAt": "2026-10-02T09:00:00Z",
      "customerId": "1b3d5f7b-9d1f-4b3d-8f5b-9d1f3b5d7f50",
      "entryCount": 4,
      "grossTotal": 339.15,
      "id": "5d7f9b1d-3f5b-4d7f-8b1d-3f5b7d9f1b63",
      "invoiceNumber": "RE-2026-0418",
      "invoicedOn": "2026-10-05",
      "label": "Kanzlei Hofmann \u0026 Partner",
      "netAmount": 285,
      "netTotal": 285,
      "periodFrom": "2026-09-01",
      "periodTo": "2026-09-30",
      "requestedAt": "2026-10-02T09:00:00Z",
      "requestedBy": "christina.adler@muster-it.example",
      "scope": "customer",
      "sendAttempts": 1,
      "state": "invoiced",
      "tradeTransactionId": "7f9b1d3f-5b7d-4f9b-9d3f-5b7d9f1b3d64",
      "updatedAt": "2026-10-05T11:30:00Z",
      "version": 4
    }
  ],
  "total": 2
}
```

### Example request

```bash
curl -X GET 'https://api.mbcom.cloud/api/hr/v1/work-batches' \
  -H "Authorization: Bearer $ACCESS_TOKEN"
```
