Set the hours of an absence registration
Sets an existing absence registration to a number of hours and minutes.
Changes the absence to an hours-based duration (TimeTrackingFormat Hours) using Hours and Minutes (Minutes is applied last and wins). Optionally moves it to another Date and replaces the Comment (omitted Comment = cleared). Absence code, employee and additional comment are kept.
Not for:
- Project or travel time →
POST /v1/time-registration/update-time
Behaviour:
- Idempotent.
- Safe to retry.
- Side effect: Same as PUT update: overwrites Created/CreatedBy; rejected → …RejectedAndResolved; TimeRegistrationUpdated event.
Call first:
GET /v1/time-registration/{timeRegistrationID}
Next: GET /v1/time-registration/{timeRegistrationID}
See also: POST /v1/time-registration/update-half-or-full-day-absence
curl -X POST "https://app3.timelog.com/your-account/api/v1/time-registration/update-hours-absence" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"TimeRegistrationID": 123,
"Type": 42,
"Hours": 3.14,
"Minutes": 42,
"Date": "2024-12-25T10:00:00Z",
"Comment": "example_string",
"AdditionalComment": "example_string"
}'
import requests
import json
url = "https://app3.timelog.com/your-account/api/v1/time-registration/update-hours-absence"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"TimeRegistrationID": 123,
"Type": 42,
"Hours": 3.14,
"Minutes": 42,
"Date": "2024-12-25T10:00:00Z",
"Comment": "example_string",
"AdditionalComment": "example_string"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://app3.timelog.com/your-account/api/v1/time-registration/update-hours-absence", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"TimeRegistrationID": 123,
"Type": 42,
"Hours": 3.14,
"Minutes": 42,
"Date": "2024-12-25T10:00:00Z",
"Comment": "example_string",
"AdditionalComment": "example_string"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"TimeRegistrationID": 123,
"Type": 42,
"Hours": 3.14,
"Minutes": 42,
"Date": "2024-12-25T10:00:00Z",
"Comment": "example_string",
"AdditionalComment": "example_string"
}`)
req, err := http.NewRequest("POST", "https://app3.timelog.com/your-account/api/v1/time-registration/update-hours-absence", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://app3.timelog.com/your-account/api/v1/time-registration/update-hours-absence')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
request.body = '{
"TimeRegistrationID": 123,
"Type": 42,
"Hours": 3.14,
"Minutes": 42,
"Date": "2024-12-25T10:00:00Z",
"Comment": "example_string",
"AdditionalComment": "example_string"
}'
response = http.request(request)
puts response.body
"null"
{
"Code": 200,
"Message": "Invalid model state error.",
"Details": [
"…"
],
"Parameters": "…",
"Url": "https://app{server-number}.timelog.com/{account}/api/v1/time-registration/update-hours-absence"
}
{
"Message": "Authorization has been denied for this request."
}
{
"Code": 103,
"Message": "…",
"Details": [],
"Parameters": "…",
"Url": "https://app{server-number}.timelog.com/{account}/api/v1/time-registration/update-hours-absence"
}
{
"Code": 102,
"Message": "Unprocessable entity.",
"Details": [
{
"Message": "…",
"ErrorCode": 37982
}
],
"Parameters": "…",
"Url": "https://app{server-number}.timelog.com/{account}/api/v1/time-registration/update-hours-absence"
}
{
"Code": 100,
"Message": "Unknown error occur in system, please contact system administrator.",
"Details": [],
"Parameters": "…",
"Url": "https://app{server-number}.timelog.com/{account}/api/v1/time-registration/update-hours-absence"
}
/v1/time-registration/update-hours-absence
Target server for requests. Edit to use your own host.
OAuth 2.0 bearer token, sent as Authorization: Bearer <token>. JWT and reference tokens are both accepted. The token must carry the required scope (default tlp).
The token's sub claim is the acting user. A token WITHOUT sub (client-credentials) acts as the system service user. If the sub user cannot log in (inactive, locked, deleted), the request is rejected with 401 — it is no longer let through without a user.
Authorization: Bearer <token>. JWT and reference tokens are both accepted. The token must carry the required scope (default tlp).
The token's sub claim is the acting user. A token WITHOUT sub (client-credentials) acts as the system service user. If the sub user cannot log in (inactive, locked, deleted), the request is rejected with 401 — it is no longer let through without a user.The media type of the request body
Integer ID of the absence registration to change. Identifier of this object, unique per TimeLog site. Validated as non-zero on update-half-or-full-day-absence and update-hours-absence (400). update-full-day-absence has NO validator: 0 or an unknown ID gives HTTP 500 (Code 100). The registration is not checked to be an absence.
Whether the absence covers a half or a full day of the employee's normal working time.
The NotNull rule cannot fail on a non-nullable enum: omitting Type means HalfDay (0).
Allowed values:
| Value | Name | Meaning |
|---|---|---|
| 0 | HalfDay | Half of the employee's normal working time on that date. |
| 1 | FullDay | The employee's full normal working time on that date. |
New absence duration in decimal hours. Unit: hours (decimal) The validator's NotNull rule cannot fail on a non-nullable double; Hours = 0 passes validation (it then meets the zero-duration rule 37982 unless Minutes is set).
Absence duration in minutes. Unit: minutes - always — Applied after Hours (TimeTrackingFormat Hours), so Minutes wins over Hours.
Moves the absence to another date.
Free-text comment.
Accepted by the model but not used. - always — The stored additional comment is kept; the sent value is discarded.
Request Preview
Response
Response will appear here after sending the request
Authentication
Bearer token. OAuth 2.0 bearer token, sent as Authorization: Bearer <token>. JWT and reference tokens are both accepted. The token must carry the required scope (default tlp).
The token's sub claim is the acting user. A token WITHOUT sub (client-credentials) acts as the system service user. If the sub user cannot log in (inactive, locked, deleted), the request is rejected with 401 — it is no longer let through without a user.
Body
Integer ID of the absence registration to change.
Identifier of this object, unique per TimeLog site.
Validated as non-zero on update-half-or-full-day-absence and update-hours-absence (400). update-full-day-absence has NO validator: 0 or an unknown ID gives HTTP 500 (Code 100). The registration is not checked to be an absence.
Whether the absence covers a half or a full day of the employee's normal working time.
The NotNull rule cannot fail on a non-nullable enum: omitting Type means HalfDay (0).
Allowed values:
| Value | Name | Meaning |
|---|---|---|
0 | HalfDay | Half of the employee's normal working time on that date. |
1 | FullDay | The employee's full normal working time on that date. |
01New absence duration in decimal hours.
Unit: hours (decimal)
The validator's NotNull rule cannot fail on a non-nullable double; Hours = 0 passes validation (it then meets the zero-duration rule 37982 unless Minutes is set).
Absence duration in minutes.
Unit: minutes
- always — Applied after Hours (TimeTrackingFormat Hours), so Minutes wins over Hours.
Moves the absence to another date.
Free-text comment.
Accepted by the model but not used.
- always — The stored additional comment is kept; the sent value is discarded.
Responses
Success without content: HTTP 200 with the literal JSON body null. Body is the literal JSON null. Call GET to read the result.