## Add a rate (hr:work:billing)

`POST /api/hr/v1/work-rates`

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

A net hourly rate for the tenant (`default`), a customer, a contract or a project (`scopeRef`: its id or
reference), for one work kind or all (`kind` empty), from `validFrom` on. A project row may name only the
project's flat-rate article (`flatRateArticle.id`; HR stores its masterdata snapshot). One rate per scope,
reference, kind and start (`409 duplicate`).

### 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
{
  "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
}
```

### Responses

- **201** The rate (`application/json`)
- **400** Error (`application/json`)
- **403** Error (`application/json`)
- **409** Error (`application/json`)
- **503** Error (`application/json`)

Fields of the 201 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 201 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 POST 'https://api.mbcom.cloud/api/hr/v1/work-rates' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"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}'
```
