Register a half or full day of absence (for the caller)
Registers half a day (Type 0) or a full day (Type 1) of absence for the calling user on an absence code.
Creates an absence time registration for the authenticated user on Date. Any Type other than 1 means half day. On a full/half-day absence CODE a second registration on the same code and date is refused (37954). Returns no body.
Use it to:
- Self-service: register a half day off (morning appointment) from an employee app.
Not for:
- Absence for another employee — use
POST /v1/time-registration(GroupType 3, TimeTrackingFormat 1/2).
Behaviour:
- Not idempotent.
- Safe to retry only under a condition. On a full/half-day CODE a retry after success is refused with 37954 (no duplicate). On an hours-format code a retry creates a second registration.
- Duplicates: Same code + same date refused (37954) only when the absence CODE's own format is full/half day.
- Side effect: Creates an absence time registration for the caller and posts it to the code's salary account.
- Side effect: Same save path as
POST /v1/time-registration(TimeRegistrationCreated event). Call first:GET /v1/absence-code/{status}
See also: POST /v1/time-registration/update-half-or-full-day-absence, POST /v1/absence-code/registration-by-full-day
curl -X POST "https://app3.timelog.com/your-account/api/v1/absence-code/registration-by-half-day" \
-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-half-day"
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-half-day", {
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-half-day", 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-half-day')
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"
{
"Code": 200,
"Message": "Invalid model state error.",
"Details": [
"…"
],
"Parameters": "…",
"Url": "https://app{server-number}.timelog.com/{account}/api/v1/absence-code/registration-by-half-day"
}
{
"Message": "Authorization has been denied for this request."
}
{
"Code": 102,
"Message": "Unprocessable entity.",
"Details": [
{
"Message": "…",
"ErrorCode": 38034
}
],
"Parameters": "…",
"Url": "https://app{server-number}.timelog.com/{account}/api/v1/absence-code/registration-by-half-day"
}
{
"Code": 100,
"Message": "Unknown error occur in system, please contact system administrator.",
"Details": [],
"Parameters": "…",
"Url": "https://app{server-number}.timelog.com/{account}/api/v1/absence-code/registration-by-half-day"
}
/v1/absence-code/registration-by-half-day
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
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.
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. Can be set on create only. Unit: minutes
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.
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.
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.
Can be set on create only.
Unit: minutes
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.