Create Absence
This endpoint allows you to create a new absence.
Request
curl --request POST \
--url 'https://www.zep-online.de/zepinstanz/next/api/v1/absences' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {token}' \
--header 'Content-Type: application/json' \
--data '{
"employee_id": "john.doe",
"absence_reason_id": "vacation",
"start_date": "2024-10-15",
"end_date": "2024-10-17",
"type": 1,
"hours": 8.0,
"from": "09:00:00",
"to": "17:00:00",
"timezone": "Europe/Berlin",
"note": "Family vacation",
"planned": true
}'
Response
{
"data": {
"id": 12345,
"employee_id": "john.doe",
"absence_reason_id": "vacation",
"start_date": "2024-10-15",
"end_date": "2024-10-17",
"type": 1,
"hours": 24.0,
"from": "09:00",
"to": "17:00",
"timezone": "Europe/Berlin",
"note": "Family vacation",
"planned": 1,
"leave_approval_application_id": null,
"created": "2024-10-01T14:30:00.000000Z",
"modified": "2024-10-01T14:30:00.000000Z"
}
}
Important Note about planned
and approved
Please note: The request field planned
and the response field approved
have inverted logic:
- Using
planned: false
in request → Absence is approved (approved: true
in response) - Using
planned: true
in request → Absence needs approval (approved: false
in response)
The relationship is: approved = !planned
Required Parameters
- Name
employee_id
- Type
- string
- Description
The employee ID. Max 32 characters. Must exist in the system.
- Name
absence_reason_id
- Type
- string
- Description
The absence reason ID. Must exist in the absence reasons table.
- Name
start_date
- Type
- date | Y-m-d
- Description
The start date of the absence.
- Name
end_date
- Type
- date | Y-m-d
- Description
The end date of the absence. Must be on or after
start_date
.
Optional Parameters
- Name
type
- Type
- integer
- Description
The absence type. AbsenceType enum:
1
for FULL_DAY (default),2
for HOURS.
- Name
hours
- Type
- numeric
- Description
Number of absence hours. Required when type is HOURS. Minimum 0.
- Name
from
- Type
- time | H:i:s
- Description
Start time (format: HH:MM:SS). Required when type is HOURS.
- Name
to
- Type
- time | H:i:s
- Description
End time (format: HH:MM:SS). Required when type is HOURS. Must be after or equal to
from
.
- Name
timezone
- Type
- string
- Description
Valid timezone identifier. Required when type is HOURS. Defaults to system timezone.
- Name
note
- Type
- string
- Description
Additional notes about the absence. Max 255 characters.
- Name
planned
- Type
- boolean
- Description
Whether the absence is planned. Default is
false
.