## A project's open work and its batches (hr:work:billing)

`GET /api/hr/v1/projects/{ref}/work-batches`

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

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `ref` | path | string | yes | The project reference |

### Responses

- **200** Open work and batches, newest first (`application/json`)
- **400** Error (`application/json`)
- **403** Error (`application/json`)

Fields of the 200 answer:

- `items` (array of WorkBatch, required): Batches of the project, newest first
  - `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)
- `openEntries` (integer): Approved billable entries no batch holds (any date)
- `openMinutes` (integer): Billable hourly minutes of the approved entries no batch holds
- `projectRef` (string): Reference of the project (e.g. desk:project:<id>)
- `unapproved` (integer): Confirmed entries waiting for approval

Example 200 answer:

```json
{
  "items": [
    {
      "billableMinutes": 1680,
      "createdAt": "2026-11-02T08:30:00Z",
      "customerId": "5f7b9d1f-3b5d-4f7b-8d1f-3b5d7f9b1d71",
      "entryCount": 14,
      "grossTotal": 3498.6,
      "id": "9b1d3f5b-7d9f-4b1d-9f5b-7d9f1b3d5f70",
      "invoiceNumber": "RE-2026-0431",
      "invoicedOn": "2026-11-04",
      "label": "PRJ-3 Netzwerkerneuerung Donau Maschinenbau",
      "netAmount": 2940,
      "netTotal": 2940,
      "periodFrom": "2026-10-01",
      "periodTo": "2026-10-31",
      "projectRef": "desk:project:5b7d9f1b-3d5f-4b7d-8f1b-3d5f7b9d1f69",
      "requestedAt": "2026-11-02T08:30:00Z",
      "requestedBy": "christina.adler@muster-it.example",
      "scope": "project",
      "sendAttempts": 1,
      "state": "invoiced",
      "tradeTransactionId": "1d3f5b7d-9f1b-4d3f-8b7d-9f1b3d5f7b72",
      "updatedAt": "2026-11-04T09:12:00Z",
      "version": 4
    }
  ],
  "openEntries": 3,
  "openMinutes": 330,
  "projectRef": "desk:project:5b7d9f1b-3d5f-4b7d-8f1b-3d5f7b9d1f69",
  "unapproved": 2
}
```

### Example request

```bash
curl -X GET 'https://api.mbcom.cloud/api/hr/v1/projects/desk:project:0b0b0b0b-1111-4222-8333-444444444444/work-batches' \
  -H "Authorization: Bearer $ACCESS_TOKEN"
```
