Skip to navigation

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 status is pending. In the rare case an approval flow has nobody at any level to act, it is approved straight away and status is approved.
  • A pending request appears in GET /requests/leave.
  • leave_type is the exact (case-sensitive) leave type name from GET /leave/balance. System leave types are refused.
  • to_date must be on or after from_date, and the request can cover at most 60 days, counting both ends.
  • is_half_day needs from_date and to_date to 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 400 on from_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_idstringRequired1-50 characters
SalaryBox ID of an active staff member.
leave_typestringRequired

Exact (case-sensitive) leave type name from GET /leave/balance. System leave types are refused.

from_datestringRequired

First day of leave, YYYY-MM-DD.

to_datestringRequired

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_daybooleanOptionalDefaults to false

Half-day leave. true needs from_date and to_date to be the same day.

reasonstringOptional1-500 characters
Reason for the leave. Outer spaces are trimmed.

Response

The leave request was raised.
messagestringOptional
statusbooleanOptional
dataobjectOptional

Errors

400
Bad Request Error
403
Forbidden Error
404
Not Found Error