## Book working time manually

`POST /api/hr/v1/time-entries`

Module: HR · operationId: `createTimeEntry` · Tag: Working time · Auth: access token (`Authorization: Bearer <accessToken>`)

A `reason` is required for other people's time and for own entries older than the
tenant's `selfEditDays`. Overlapping entries fail with `409 overlap`, closed months with
`409 period_closed`.

### Request body

`application/json` (required)

- `start` (string (date-time), required): Start of the segment
- `breakMinutes` (integer): Break inside the segment in minutes
- `employeeId` (string): Defaults to the caller
- `end` (string (date-time)): End of the segment; omitted for an open (running) one
- `endedForBreak` (boolean): The end is a break stamp („Pause“), not „Gehen“. Omitted on PATCH keeps the stored value; ignored without an end.
- `note` (string): Note on the entry
- `reason` (string): Reason of the change; required for other people's time and own entries older than the self-edit window
- `version` (integer): Required for PATCH

Example:

```json
{
  "breakMinutes": 30,
  "end": "2026-11-17T15:00:00Z",
  "note": "Kundentermin Kanzlei Hofmann",
  "reason": "Stempeln am Morgen vergessen",
  "start": "2026-11-17T06:30:00Z"
}
```

### Responses

- **201** Created (`application/json`)
- **400** Error (`application/json`)
- **409** Error (`application/json`)

Fields of the 201 answer:

- `autoEnded` (boolean): HR ended the segment at midnight because nobody clocked out (setting `autoEndAtMidnight`). It counts no working time until it is corrected; any change clears the mark.
- `breakMinutes` (integer): Break inside the segment in minutes (manual entries)
- `createdAt` (string (date-time)): When the time entry was created
- `createdBy` (string): Who created the time entry (e-mail of the caller)
- `employeeId` (string): Id of the employee
- `end` (string (date-time)): Missing while running
- `endedForBreak` (boolean): The segment was closed by starting a break
- `id` (string): Id of the time entry
- `note` (string): Note on the entry
- `source` (string): clock: stamped, manual: entered by hand (one of `clock`, `manual`)
- `start` (string (date-time)): Start of the segment
- `updatedAt` (string (date-time)): When the time entry was last changed
- `updatedBy` (string): Who last changed the time entry (e-mail of the caller)
- `version` (integer): Version for optimistic locking: send the version you read with a change (stale: 409 version_conflict)

Example 201 answer:

```json
{
  "autoEnded": false,
  "breakMinutes": 30,
  "createdAt": "2026-11-18T06:28:00Z",
  "createdBy": "sophie.huber@muster-it.example",
  "employeeId": "e5a1c3d7-2b4f-4c6e-8a0b-1d3f5b7c9e02",
  "end": "2026-11-18T15:00:00Z",
  "endedForBreak": false,
  "id": "3a5c7e9a-1c3e-4a5c-9e7a-1c3e5a7c9e36",
  "source": "clock",
  "start": "2026-11-18T06:28:00Z",
  "updatedAt": "2026-11-18T15:00:00Z",
  "updatedBy": "sophie.huber@muster-it.example",
  "version": 1
}
```

### Example request

```bash
curl -X POST 'https://api.mbcom.cloud/api/hr/v1/time-entries' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"breakMinutes":30,"end":"2026-11-17T15:00:00Z","note":"Kundentermin Kanzlei Hofmann","reason":"Stempeln am Morgen vergessen","start":"2026-11-17T06:30:00Z"}'
```
