## Change a rate at its version (hr:work:billing)

`PUT /api/hr/v1/work-rates/{id}`

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

Batches keep the rate their entries were billed at. A stale `version` is `409 version_conflict`.

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string (uuid) | yes |  |

### Request body

`application/json` (required)

- `scope` (string, required): What the rate applies to; a project rate comes first, then contract, customer, default (one of `default`, `customer`, `contract`, `project`)
- `createdAt` (string (date-time), read-only): When the rate was created
- `flatRateArticle` (WorkArticleRef | null): Only on project rows
- `id` (string (uuid), read-only): Id of the rate
- `kind` (string): Work kind key; empty for every kind
- `label` (string): Name shown in the table
- `rate` (number, nullable): Net hourly rate; `null` on a project row that names only the flat-rate article
- `scopeRef` (string): The customer or contract id, the project reference (`desk:project:<id>`); empty for `default`
- `updatedAt` (string (date-time), read-only): When the rate was last changed
- `updatedBy` (string, read-only): Who last changed the rate (e-mail)
- `validFrom` (string (date), nullable): First work date the rate applies to; `null` always
- `version` (integer): Version for optimistic locking: send the version you read with a change (stale: 409 version_conflict)

Example:

```json
{
  "kind": "",
  "label": "Kanzlei Hofmann \u0026 Partner",
  "rate": 98,
  "scope": "customer",
  "scopeRef": "1b3d5f7b-9d1f-4b3d-8f5b-9d1f3b5d7f50",
  "validFrom": "2027-01-01",
  "version": 1
}
```

### Responses

- **200** The rate (`application/json`)
- **400** Error (`application/json`)
- **404** Error (`application/json`)
- **409** Error (`application/json`)

Fields of the 200 answer:

- `scope` (string, required): What the rate applies to; a project rate comes first, then contract, customer, default (one of `default`, `customer`, `contract`, `project`)
- `createdAt` (string (date-time), read-only): When the rate was created
- `flatRateArticle` (WorkArticleRef | null): Only on project rows
- `id` (string (uuid), read-only): Id of the rate
- `kind` (string): Work kind key; empty for every kind
- `label` (string): Name shown in the table
- `rate` (number, nullable): Net hourly rate; `null` on a project row that names only the flat-rate article
- `scopeRef` (string): The customer or contract id, the project reference (`desk:project:<id>`); empty for `default`
- `updatedAt` (string (date-time), read-only): When the rate was last changed
- `updatedBy` (string, read-only): Who last changed the rate (e-mail)
- `validFrom` (string (date), nullable): First work date the rate applies to; `null` always
- `version` (integer): Version for optimistic locking: send the version you read with a change (stale: 409 version_conflict)

Example 200 answer:

```json
{
  "createdAt": "2025-12-15T10:00:00Z",
  "id": "3f5b7d9f-1b3d-4f5b-8d9f-1b3d5f7b9d73",
  "kind": "",
  "label": "Kanzlei Hofmann \u0026 Partner",
  "rate": 95,
  "scope": "customer",
  "scopeRef": "1b3d5f7b-9d1f-4b3d-8f5b-9d1f3b5d7f50",
  "updatedAt": "2025-12-15T10:00:00Z",
  "updatedBy": "christina.adler@muster-it.example",
  "validFrom": "2026-01-01",
  "version": 1
}
```

### Example request

```bash
curl -X PUT 'https://api.mbcom.cloud/api/hr/v1/work-rates/3f2b8c1e-7d4a-4e9b-9c2a-5b1d6e8f0a12' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"kind":"","label":"Kanzlei Hofmann \u0026 Partner","rate":98,"scope":"customer","scopeRef":"1b3d5f7b-9d1f-4b3d-8f5b-9d1f3b5d7f50","validFrom":"2027-01-01","version":1}'
```
