Skip to content

User Working Time Models

This module describes the API endpoints for managing working time models. A working time model represents the expected working time for an employee, starting from a given date and following a specific pattern. The system compares actual logged time against these models for reporting and balance tracking.

AttributeDescriptionDetails
patternThe pattern for the working time modelMust be set to weekly.
start_dateThe date the model becomes effectiveMust be set. Format: YYYY-MM-DD.
discarded_atTime of removal (or null)Cannot be set manually. Automatically set when deleted (soft-delete).
workdays
idID of the workday to update/deleteMust be set to update or delete an existing workday; if not set, a new workday will be created.
day_of_weekThe day of the week represented by the workdayMust be set on creation, cannot be updated; must be between 0 (Monday) and 6 (Sunday)
secondsThe user’s target working time on the given day of week, in secondsMust be set.
_deleteIndicator to delete the workdayDon’t send this parameter if you don’t want to delete the workday. Set it to true if you do.

The following relationships can be included in the request using the include parameter:

RelationshipType
weekly_workdayshas_many

Use this endpoint to create a new working time model for a user.

You can optionally include workdays during creation using the workdays attribute. Each workday must specify day_of_week and seconds.

POST /api/v1/users/:user_id/working_time_models

ParameterDescription
user_idThe ID of the user to create the working time model for
{
"data": {
"type": "working_time_model",
"attributes": {
"pattern": "weekly",
"start_date": "2025-10-01",
"workdays": [
{
"day_of_week": 0,
"seconds": 28800
},
{
"day_of_week": 1,
"seconds": 28800
}
]
}
}
}
{
"data": {
"id": "f5e9e2c8-5d4f-4a3b-8c7e-6a5b4d3c2b1a",
"type": "working_time_model",
"attributes": {
"pattern": "weekly",
"start_date": "2025-10-01",
"user_id": "c2c3a4c9-5a9e-4ad8-9b7b-9a7d6c5b2e1f",
"discarded_at": null
}
}
}
{
"data": [
{
"id": "c5df543a-3324-4a48-9d26-7b92eaf97e52",
"type": "working_time_model",
"attributes": {
...
}
},
{
...
}
]
}

This endpoint returns the user’s working time models.

GET /api/v1/users/:user_id/working_time_models

{
"data": {
"id": "54e993e0-8088-4094-99ba-4d62303483ec",
"type": "working_time_model",
"attributes": {
...
}
}
}

This endpoint returns a working time model.

GET /api/v1/users/:user_id/working_time_models/:working_time_model_id

ParameterDescription
user_idThe ID of the user
working_time_modelThe ID of the working time model to return

Use this endpoint to update an existing working time model and to create/update/delete the associated workdays.

Creating/updating/deleting the associated workdays works via a “pseudo-attribute” called workdays which can be included in the request body. It is expected to be an array of objects with fields as described in the “Valid Attributes” section.

PUT /api/v1/users/:user_id/working_time_models/:working_time_model_id

ParameterDescription
user_idThe ID of the user to update a working time model for
working_time_model_idThe ID of the working time model to update
{
"data": {
"type": "working_time_model",
"attributes": {
"pattern": "weekly",
"start_date": "2025-10-01",
"workdays": [
{
"id": "ae4d41fc-b838-4f8a-9e49-dac5b9b42a12",
"seconds": 28800
},
{
"id": "7d16b8e8-9140-431a-8cfb-1b6d8ff47231",
"_delete": true
},
{
"day_of_week": 3,
"seconds": 14400
}
]
}
}
}
{
"data": {
"id": "f5e9e2c8-5d4f-4a3b-8c7e-6a5b4d3c2b1a",
"type": "working_time_model",
"attributes": {
"pattern": "weekly",
"start_date": "2025-10-01",
"user_id": "c2c3a4c9-5a9e-4ad8-9b7b-9a7d6c5b2e1f",
"discarded_at": null
}
}
}

Example response:

{
"data": {
"id": "f5e9e2c8-5d4f-4a3b-8c7e-6a5b4d3c2b1a",
"type": "working_time_model",
"attributes": {
...
}
}
}

This endpoint deletes a working time model.

DELETE /api/v1/users/:user_id/working_time_models/:working_time_model_id

ParameterDescription
user_idThe ID of the user to delete a working time model from
working_time_model_idID of the working time model to delete