Apply Staff Leave
Raises a leave request for a staff member on their behalf. Shared rules: see Writing data.
- The request is not approved by this call. It waits for a decision in the SalaryBox app or the approval flow, and the response
statusispending. In the rare case an approval flow has nobody at any level to act, it is approved straight away andstatusisapproved. - A pending request appears in
GET /requests/leave. leave_typeis the exact (case-sensitive) leave type name fromGET /leave/balance. System leave types are refused.to_datemust be on or afterfrom_date, and the request can cover at most 60 days, counting both ends.is_half_dayneedsfrom_dateandto_dateto be the same day.- A paid leave type needs enough balance (a half day counts 0.5, otherwise every calendar day in the range counts). If the balance is too low the request is refused; raise it as an unpaid leave type instead. Unpaid leave types skip this check.
- Dates before the staff member’s joining date or in a finalised payroll month are refused.
- Admins and approvers get the usual notifications and email, and the staff member sees the request in their feed, as if they had applied.
- A request overlapping a pending or approved one for the same staff member is refused with
400onfrom_date, so repeating is harmless.
API keys need no extra permission.
Authentication
AuthorizationApi-Key
Format: “Api-Key {api-key}”
Request
This endpoint expects an object.
salarybox_id
SalaryBox ID of an active staff member.
leave_type
Exact (case-sensitive) leave type name from GET /leave/balance. System leave types are refused.
from_date
First day of leave, YYYY-MM-DD.
to_date
Last day of leave, YYYY-MM-DD. On or after from_date, and at most 60 days in the request, counting both ends.
is_half_day
Half-day leave. true needs from_date and to_date to be the same day.
reason
Reason for the leave. Outer spaces are trimmed.
Response
The leave request was raised.
message
status
data
Errors
400
Bad Request Error
403
Forbidden Error
404
Not Found Error
