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.
Valid Attributes
Section titled “Valid Attributes”| Attribute | Description | Details |
|---|---|---|
| pattern | The pattern for the working time model | Must be set to weekly. |
| start_date | The date the model becomes effective | Must be set. Format: YYYY-MM-DD. |
| discarded_at | Time of removal (or null) | Cannot be set manually. Automatically set when deleted (soft-delete). |
| workdays | ||
| id | ID of the workday to update/delete | Must be set to update or delete an existing workday; if not set, a new workday will be created. |
| day_of_week | The day of the week represented by the workday | Must be set on creation, cannot be updated; must be between 0 (Monday) and 6 (Sunday) |
| seconds | The user’s target working time on the given day of week, in seconds | Must be set. |
| _delete | Indicator to delete the workday | Don’t send this parameter if you don’t want to delete the workday. Set it to true if you do. |
Relationships
Section titled “Relationships”The following relationships can be included in the request using the include
parameter:
| Relationship | Type |
|---|---|
| weekly_workdays | has_many |
Create
Section titled “Create”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.
Endpoint
Section titled “Endpoint”POST /api/v1/users/:user_id/working_time_models
URL Parameters
Section titled “URL Parameters”| Parameter | Description |
|---|---|
| user_id | The ID of the user to create the working time model for |
Request
Section titled “Request”{ "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 } ] } }}Response
Section titled “Response”{ "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 } }}Response
Section titled “Response”{ "data": [ { "id": "c5df543a-3324-4a48-9d26-7b92eaf97e52", "type": "working_time_model", "attributes": { ... } }, { ... } ]}This endpoint returns the user’s working time models.
HTTP Request
Section titled “HTTP Request”GET /api/v1/users/:user_id/working_time_models
Response
Section titled “Response”{ "data": { "id": "54e993e0-8088-4094-99ba-4d62303483ec", "type": "working_time_model", "attributes": { ... } }}This endpoint returns a working time model.
HTTP Request
Section titled “HTTP Request”GET /api/v1/users/:user_id/working_time_models/:working_time_model_id
| Parameter | Description |
|---|---|
| user_id | The ID of the user |
| working_time_model | The ID of the working time model to return |
Update
Section titled “Update”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.
Endpoint
Section titled “Endpoint”PUT /api/v1/users/:user_id/working_time_models/:working_time_model_id
URL Parameters
Section titled “URL Parameters”| Parameter | Description |
|---|---|
| user_id | The ID of the user to update a working time model for |
| working_time_model_id | The ID of the working time model to update |
Request
Section titled “Request”{ "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 } ] } }}Response
Section titled “Response”{ "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 } }}Delete
Section titled “Delete”Example response:
{ "data": { "id": "f5e9e2c8-5d4f-4a3b-8c7e-6a5b4d3c2b1a", "type": "working_time_model", "attributes": { ... } }}This endpoint deletes a working time model.
HTTP Request
Section titled “HTTP Request”DELETE /api/v1/users/:user_id/working_time_models/:working_time_model_id
URL Parameters
Section titled “URL Parameters”| Parameter | Description |
|---|---|
| user_id | The ID of the user to delete a working time model from |
| working_time_model_id | ID of the working time model to delete |