Register absence in hours (for the caller)
Registers absence for the calling user on one date, as a number of minutes, on an absence code.
Creates an absence time registration for the authenticated user (never for someone else) on Date with absence code AbsenceID, TimeTrackingFormat Hours. The stored duration is Minutes: Hours must be sent and > 0 to pass validation, but Minutes is applied after it and replaces it — omit Minutes and the call fails with 37982. The code's own TimeTrackingFormat is not checked. Returns no body; the new registration's ID is not returned.
Use it to:
- Self-service: an employee app or HR portal registers the user's own partial-day absence (doctor's visit, 2 h).
Not for:
- Registering absence for another employee — use
POST /v1/time-registration(GroupType 3, UserID). - Full or half days — use
POST /v1/absence-code/registration-by-full-day/ createregistrationbyhalffullday.
Rules across fields:
- R1: Hours > 0 is required by validation, but the duration is Minutes (Minutes replaces Hours); Minutes 0 → 37982.
Behaviour:
- Not idempotent.
- Not safe to retry blindly.
- Duplicates: Not deduplicated: on an hours-format code every call adds another registration. (The same-day duplicate check 37954 runs only for full/half-day CODES.)
- Side effect: Creates an absence time registration for the caller (new GUID per call); posts it to the absence code's salary account (duration × SalaryAccountFactor × SalaryAccountFactorEffect).
- Side effect: Same save path as
POST /v1/time-registration: TimeRegistrationCreated event, financial data recalculated after commit. - Read-after-write consistency: not yet documented.
Call first: GET /v1/absence-code/{status}, GET /v1/absence-code/get-recently-registered
See also: POST /v1/time-registration/update-hours-absence, POST /v1/time-registration, POST /v1/absence-code/time-tracker
Not yet documented: behaviour → consistency; examples (success); response (registration ID).
curl -X POST "https://app3.timelog.com/your-account/api/v1/absence-code/registration-by-hours" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"AbsenceID": 123,
"Date": "2024-12-25T10:00:00Z",
"Comment": "null",
"Hours": 3.14,
"Minutes": 42,
"Type": 42
}'
import requests
import json
url = "https://app3.timelog.com/your-account/api/v1/absence-code/registration-by-hours"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"AbsenceID": 123,
"Date": "2024-12-25T10:00:00Z",
"Comment": "null",
"Hours": 3.14,
"Minutes": 42,
"Type": 42
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://app3.timelog.com/your-account/api/v1/absence-code/registration-by-hours", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"AbsenceID": 123,
"Date": "2024-12-25T10:00:00Z",
"Comment": "null",
"Hours": 3.14,
"Minutes": 42,
"Type": 42
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"AbsenceID": 123,
"Date": "2024-12-25T10:00:00Z",
"Comment": "null",
"Hours": 3.14,
"Minutes": 42,
"Type": 42
}`)
req, err := http.NewRequest("POST", "https://app3.timelog.com/your-account/api/v1/absence-code/registration-by-hours", 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/absence-code/registration-by-hours')
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 = '{
"AbsenceID": 123,
"Date": "2024-12-25T10:00:00Z",
"Comment": "null",
"Hours": 3.14,
"Minutes": 42,
"Type": 42
}'
response = http.request(request)
puts response.body
"null"
{
"error": "Bad Request",
"message": "The request contains invalid parameters or malformed data",
"code": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
{
"error": "Unprocessable Entity",
"message": "The request was well-formed but contains semantic errors",
"code": 422,
"details": [
{
"field": "password",
"message": "Password must be at least 8 characters long"
}
]
}
{
"error": "Internal Server Error",
"message": "An unexpected error occurred on the server",
"code": 500,
"requestId": "req_1234567890"
}
/v1/absence-code/registration-by-hours
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.
> Not yet documented: how to obtain a token.
> Not yet documented: token lifetime.
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.
> Not yet documented: how to obtain a token.
> Not yet documented: token lifetime.The media type of the request body
The absence code to register on (AbsenceCodeID from GET /v1/absence-code/{status}).
Can be set on create only.
Refers to AbsenceCodeRead.AbsenceCodeID. Look up valid values with GET /v1/absence-code/{status}.
- Not an existing absence code — 38034 absence-not-found (HTTP 422).
- Code's salary account is inactive — 37977 (HTTP 422).
- Code's own TimeTrackingFormat differs from the endpoint called — Not checked — the registration takes the endpoint's format.
Valid values come from GET /v1/absence-code/{status}.
The day of the absence. Only the date part is used (time is discarded). Can be set on create only. Date only — no time component. - Always — Truncated to the date (Date.Date). - The caller has no normal working time on the date — 37588 (HTTP 422). - Full/half-day code and the caller already has an absence on this code on the date — 37954 (HTTP 422).
Conditional. Required when the account feature MandatoryComment is active (300116); optional otherwise. Can be set on create only. > Not yet documented: constraints → max length.
Must be > 0 to pass validation, but does NOT set the duration: Minutes is applied after Hours and replaces it. Send the duration in Minutes; send any Hours > 0. Can be set on create only. Unit: hours - Always (Minutes is always applied afterwards, default 0) — Replaced by Minutes / 60 (rounded to 2 decimals). With Minutes omitted the duration becomes 0 and the call fails with 37982 (HTTP 422). - Hours ≤ 0 — 400 'Hours' must be greater than '0'.
The absence duration in minutes — the value that is actually stored. Conditional. Not validated, but effectively required: omitted or 0 → zero duration → 37982 (HTTP 422). Can be set on create only. Unit: minutes > Not yet documented: constraints → min.
Half-day endpoint: 1 = full day, anything else = half day. Full-day endpoint: ignored (always a full day).
Can be set on create only.
- Half-day endpoint, value other than 1 (including undefined values) — Treated as half day — the enum is not range-checked.
- Full-day endpoint — The controller always uses FullDay.
Allowed values:
| Value | Name | Meaning |
|---|---|---|
| 0 | HalfDay | Half-day endpoint: register half of the caller's normal working time on the date. Full-day endpoint (FullDay = 0 there): ignored. |
| 1 | FullDay | Half-day endpoint: register the caller's full normal working time on the date. |
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.
Not yet documented: how to obtain a token.
Not yet documented: token lifetime.
Body
The absence code to register on (AbsenceCodeID from GET /v1/absence-code/{status}).
Can be set on create only.
Refers to AbsenceCodeRead.AbsenceCodeID. Look up valid values with GET /v1/absence-code/{status}.
-
Not an existing absence code — 38034 absence-not-found (HTTP 422).
-
Code's salary account is inactive — 37977 (HTTP 422).
-
Code's own TimeTrackingFormat differs from the endpoint called — Not checked — the registration takes the endpoint's format.
Valid values come from GET /v1/absence-code/{status}.
The day of the absence. Only the date part is used (time is discarded).
Can be set on create only.
Date only — no time component.
-
Always — Truncated to the date (Date.Date).
-
The caller has no normal working time on the date — 37588 (HTTP 422).
-
Full/half-day code and the caller already has an absence on this code on the date — 37954 (HTTP 422).
Conditional. Required when the account feature MandatoryComment is active (300116); optional otherwise.
Can be set on create only.
Not yet documented: constraints → max length.
Must be > 0 to pass validation, but does NOT set the duration: Minutes is applied after Hours and replaces it. Send the duration in Minutes; send any Hours > 0.
Can be set on create only.
Unit: hours
-
Always (Minutes is always applied afterwards, default 0) — Replaced by Minutes / 60 (rounded to 2 decimals). With Minutes omitted the duration becomes 0 and the call fails with 37982 (HTTP 422).
-
Hours ≤ 0 — 400 'Hours' must be greater than '0'.
The absence duration in minutes — the value that is actually stored.
Conditional. Not validated, but effectively required: omitted or 0 → zero duration → 37982 (HTTP 422).
Can be set on create only.
Unit: minutes
Not yet documented: constraints → min.
Half-day endpoint: 1 = full day, anything else = half day. Full-day endpoint: ignored (always a full day).
Can be set on create only.
-
Half-day endpoint, value other than 1 (including undefined values) — Treated as half day — the enum is not range-checked.
-
Full-day endpoint — The controller always uses FullDay.
Allowed values:
| Value | Name | Meaning |
|---|---|---|
0 | HalfDay | Half-day endpoint: register half of the caller's normal working time on the date. Full-day endpoint (FullDay = 0 there): ignored. |
1 | FullDay | Half-day endpoint: register the caller's full normal working time on the date. |
01Responses
Success without content: HTTP 200 with the literal JSON body null. Body is the literal JSON null. The registration's ID is not returned; read it back with GET /v1/time-registration/{timeRegistrationID} … (no list-by-date in this service).