Absence Rules
Absence rules define automatic entitlement accruals for employees. For example, a rule can grant 30 vacation days per year to an employee. Rules generate absence transactions automatically based on their configuration.
The Absence Rule Object
- Name
id- Type
- string (UUID)
- Description
Unique identifier for the rule.
- Name
employee_id- Type
- string (UUID)
- Description
The employee this rule applies to.
- Name
label- Type
- string
- Description
Description of the rule.
- Name
missing_type- Type
- string
- Description
The absence type this rule generates entitlements for.
- Name
amount- Type
- decimal
- Description
Number of days to grant per period. Must be >= 0.
- Name
priority- Type
- integer
- Description
Evaluation priority. Lower values are evaluated first.
- Name
available_from- Type
- string (YYYY-MM-DD)
- Description
Date from which the rule is active.
- Name
expires_at- Type
- string (YYYY-MM-DD) or null
- Description
Date when the rule expires, or
nullfor no expiry.
- Name
source- Type
- string
- Description
How the rule was created:
manualorsetting. Read-only.
List all Rules
Retrieve a paginated list of absence rules.
Query Parameters
- Name
employee_ids- Type
- string
- Description
Filter by employee IDs, pipe-separated.
- Name
daterange- Type
- string
- Description
Filter by date range:
YYYY-MM-DD|YYYY-MM-DD.
- Name
sources- Type
- string
- Description
Filter by source:
manualorsetting.
Request
curl -X GET "https://api.zeitstrom.com/api/v2/timestamps/absence-rules/?employee_ids=a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
-H "Authorization: Token <YOUR_API_TOKEN>"
Response
{
"count": 1,
"results": [
{
"id": "r1r1r1r1-r2r2-r3r3-r4r4-r5r5r5r5r5r5",
"employee_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"label": "Annual vacation entitlement",
"missing_type": "holiday",
"amount": 30.0,
"priority": 0,
"available_from": "2024-01-01",
"expires_at": null,
"source": "manual"
}
]
}
Create a Rule
Create a new absence entitlement rule for an employee.
- Name
employee_id- Type
- string (UUID)
- Description
The employee. Required.
- Name
label- Type
- string
- Description
Description of the rule.
- Name
missing_type- Type
- string
- Description
The absence type.
- Name
amount- Type
- decimal
- Description
Days to grant per period.
- Name
priority- Type
- integer
- Description
Evaluation priority (lower = higher priority).
- Name
available_from- Type
- string (YYYY-MM-DD)
- Description
Activation date.
- Name
expires_at- Type
- string (YYYY-MM-DD)
- Description
Expiration date. Omit for no expiry.
Request
curl -X POST "https://api.zeitstrom.com/api/v2/timestamps/absence-rules/" \
-H "Authorization: Token <YOUR_API_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"employee_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"label": "Annual vacation entitlement",
"missing_type": "holiday",
"amount": 30.0,
"priority": 0,
"available_from": "2024-01-01"
}'
Update a Rule
Update an existing absence rule.
Request
curl -X PUT "https://api.zeitstrom.com/api/v2/timestamps/absence-rules/r1r1r1r1-r2r2-r3r3-r4r4-r5r5r5r5r5r5/" \
-H "Authorization: Token <YOUR_API_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"employee_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"label": "Updated vacation entitlement",
"missing_type": "holiday",
"amount": 28.0,
"priority": 0,
"available_from": "2024-01-01",
"expires_at": "2024-12-31"
}'
Delete a Rule
Delete an absence rule. This does not affect previously generated transactions.
Request
curl -X DELETE "https://api.zeitstrom.com/api/v2/timestamps/absence-rules/r1r1r1r1-r2r2-r3r3-r4r4-r5r5r5r5r5r5/" \
-H "Authorization: Token <YOUR_API_TOKEN>"