Skip to main content

Working Time Journal

The WorkTimeJournals controller lets an integration keep an employee's working time journal up to date, for example from an access control or time registration system. An integration gets the employee's week, fills in its periods, saves it, checks it for violations and submits it.

The week follows the same rules as when the employee fills it in in MindKey: the same calculation of working hours and flextime, the same validation, and the same leave created when the week is submitted. Changes are recorded with the system user you send in the SystemUser header. Without a TimeZone header, the installation’s time zone is used to decide which week is the current one.

The flow​

  1. Get the week: GET .../WorkTimeJournals/{employeeId}/current.
  2. Fill in the periods of the days you want to change, in the week you got.
  3. Save it: POST .../WorkTimeJournals/{employeeId}/save, or go straight to submit.
  4. Check it for violations, if you want to know before submitting: POST .../WorkTimeJournals/{employeeId}/check.
  5. Submit it: POST .../WorkTimeJournals/{employeeId}/submit.

Always send the whole week back as you got it, with your changes. Each day you send gets exactly the periods you send for it.

warning

Send WeekVersion exactly as you read it. If the week has changed since you read it, for example because the employee clocked in or saved the week in MindKey, the save or submit is refused. Get the week again and apply your changes to it.

Endpoints​

All paths are relative to https://integration.mindkey.com/api/{customerId}/WorkTimeJournals.

MethodPathDescription
GET{employeeId}/currentThe employee's open week, created when the employee has reached a new week. Until the next week begins, the last submitted week (Submitted true).
GET{employeeId}/week/{year}/{week}The employee's week with the given ISO year and week number.
POST{employeeId}/saveSaves a week that is not submitted, without submitting it.
POST{employeeId}/checkReturns the violations the week would be submitted with. Saves nothing.
POST{employeeId}/submitSubmits the week.
POSTfind, get, countThe weeks with their totals, as for any other controller.

find, get and count are POST with a JSON body, as described in the introduction; the GET variants are obsolete. They take the parameters EmployeeId, YearWeek (for example 202647), Submitted, WorkTimeJournalId and RowNumber. Each week has its totals: WorkingHours, CalendarHours (the calendar's hours less lunch), CalendarDeviation and NumberOfViolations.

A week cannot be inserted, updated or deleted as a row: insert, update, write and delete are refused. A week is changed through save and submit only, and a submitted week through submit only: a save would change its days without updating its leave and flextime.

The week​

The week you get, and send back, looks like this (shortened):

{
"RowNumber": 236,
"WeekVersion": -1263423478,
"Year": 2026,
"Week": 47,
"Submitted": false,
"CanReopen": false,
"Lines": [
{
"DayOfWeek": 3,
"TransDate": "2026-11-18T00:00:00",
"AllowEdit": true,
"BreaksHeld": true,
"OfferedPeriodTypes": [0, 1, 2, 3],
"WorkingHours": 7.5,
"FlexHours": 0.0,
"Periods": [
{ "LineNum": 1, "PeriodType": 0, "WorkTimePurposeId": null, "StartTime": "2026-11-18T08:00:00", "EndTime": "2026-11-18T12:00:00" },
{ "LineNum": 2, "PeriodType": 4, "WorkTimePurposeId": "1", "StartTime": "2026-11-18T12:30:00", "EndTime": "2026-11-18T15:00:00" }
]
}
],
"Purposes": [{ "WorkTimePurposeId": "1", "Description": "Meeting", "LeaveCodeName": null, "EarnsFlex": true }],
"Violations": []
}
  • Lines are the days of the week, Monday (DayOfWeek 1) to Sunday (7). A day with AllowEdit false, such as a day of leave registered in the leave module, keeps its periods whatever you send for it.

  • Periods are the day's registrations. PeriodType is one of:

    ValueTypeTimes
    0WorkStart and end time
    1AbsenceNone for a whole day
    2VacationNone for a whole day
    3Day offNone
    4PurposeStart and end time, and WorkTimePurposeId is required

    Only the types in the day's OfferedPeriodTypes can be used, plus purposes.

  • Purposes are the purposes the employee's working time group offers, with their IDs. A purpose with a LeaveCodeName creates leave when the week is submitted.

  • WorkingHours and FlexHours are calculated by MindKey. You do not send them.

The body of a save, check or submit is the week as above. Only RowNumber, WeekVersion and Lines are needed, plus Note and ViolationsApproved for a submit.

tip

A period without an end time can be saved, so you can save a day that is still running. It is refused when the week is submitted.

Submitting​

A submit creates the week's leave and books its flextime, as when the employee submits the week in MindKey. It is logged as "Auto submitted", in the system language, as an automatically submitted week is. If you send a Note, it is added after it, so it is visible why or from where the week was submitted. The note and the text before it can be at most 4000 characters together.

As when the employee submits, the employee's manager gets a message when the week reaches the thresholds set on the working time group. If you submit every week for all employees, their managers get these messages too.

{ "RowNumber": 236, "WeekVersion": -1263423478, "Lines": [ ... ], "Note": "From the access control system" }

Violations​

A week that breaks the working time rules, for example rest or breaks not held, has violations. A submit with violations is refused with 409 Conflict, the violations and the week’s WeekVersion now:

{
"Message": "The week has violations and was not submitted. Submit it with ViolationsApproved and this WeekVersion to approve them.",
"WeekVersion": -1263422838,
"Violations": [
{
"DayOfWeek": 5,
"TransDate": "2026-11-20T00:00:00",
"ViolationType": 1,
"ViolationMessage": "Friday 11/20/2026: Your daily breaks have not been taken."
}
]
}

To submit the week anyway, send it again with "ViolationsApproved": true and the WeekVersion from the answer. A week that was not submitted before is saved with its violations when the submit is refused, which gives it a new version. The violations are then stored and logged with the week, as when an employee approves them.

caution

With ViolationsApproved the integration approves the violations on the employee's behalf, which the employee otherwise does in the journal. The customer who runs the integration is responsible for that approval, for example by agreeing it with the employees or getting it from the source system. Use the Note to record where the approval comes from.

info

ViolationsApproved approves violations only. A week that MindKey refuses for an error, such as more vacation or absence days in the week than the working time group allows, or a period without an end time, is refused also when the violations are approved.

Changing a submitted week​

A submitted week with CanReopen true can be changed and submitted again: get it with GET .../{employeeId}/week/{year}/{week}, change it and submit it. The changes are logged with your note. A week submitted again without changes is refused.

CanReopen is true for a submitted week no older than the number of weeks set in the system parameters, as in MindKey, where only those weeks can be reopened. A submit of a submitted week with CanReopen false is refused with 400 Bad Request, because its leave and flextime may already have gone to payroll.

Responses​

StatusMeaning
200The week, saved or submitted, as MindKey has it now. For check: the list of violations, empty when none.
400The request or the week is refused, with a message: missing WeekVersion, the week changed since you read it, a save of a submitted week, a submit of a week that can no longer be reopened, a period that is not valid, a limit of the working time group, a note that is too long.
404The employee has no such week.
409Submit only: the week has violations and ViolationsApproved was not set.

Examples​

PowerShell​

$base = "https://integration.mindkey.com/api/$customerId/WorkTimeJournals"
$headers = @{ SystemUser = 'Access control sync'; TimeZone = 'Europe/Copenhagen' }

# Get the employee's open week
$week = Invoke-RestMethod -Uri "$base/E1001/current" -CertificateThumbprint $thumbprint -Headers $headers

# Fill in Wednesday: work 08:00-16:00
$day = $week.Lines | Where-Object DayOfWeek -eq 3
$date = ([datetime]$day.TransDate).ToString('yyyy-MM-dd')
$day.Periods = @(@{ LineNum = 1; PeriodType = 0; StartTime = "${date}T08:00:00"; EndTime = "${date}T16:00:00" })
$day.BreaksHeld = $true

# Submit it with a note
$body = @{ RowNumber = $week.RowNumber; WeekVersion = $week.WeekVersion; Lines = $week.Lines; Note = 'From the access control system' } | ConvertTo-Json -Depth 10
Invoke-RestMethod -Method Post -Uri "$base/E1001/submit" -CertificateThumbprint $thumbprint -Headers $headers -ContentType 'application/json' -Body $body

curl​

curl --cert client.pem --key client.key \
-H "SystemUser: Access control sync" -H "Content-Type: application/json" -d '{}' \
-X POST "https://integration.mindkey.com/api/$CUSTOMER_ID/WorkTimeJournals/find?EmployeeId=E1001&YearWeek=202647"