Salary and absenceRegister absence in hours (for the caller)

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
}'
"null"
POST
/v1/absence-code/registration-by-hours
POST
Base URLstring

Target server for requests. Edit to use your own host.

Bearer Token
Bearer Tokenstring
Required

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.

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.
Content-Typestring
Required

The media type of the request body

Options: application/json
AbsenceIDinteger
Required

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}.

Format: int32
Datestring
Required

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).

Format: date-time
Commentstringnull

Conditional. Required when the account feature MandatoryComment is active (300116); optional otherwise. Can be set on create only. > Not yet documented: constraints → max length.

Hoursnumber
Required

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'.

Format: double
Minutesinteger

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.

Format: int32
Typeinteger

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. |

Options: 0, 1
Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

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

application/json
AbsenceIDinteger
Required

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}.

Datestring
Required

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).

Commentstring,null

Conditional. Required when the account feature MandatoryComment is active (300116); optional otherwise.

Can be set on create only.

Not yet documented: constraints → max length.

Hoursnumber
Required

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'.

Minutesinteger

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.

Typeinteger

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:

ValueNameMeaning
0HalfDayHalf-day endpoint: register half of the caller's normal working time on the date. Full-day endpoint (FullDay = 0 there): ignored.
1FullDayHalf-day endpoint: register the caller's full normal working time on the date.
Allowed values:01

Responses

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).