API Reference
API Reference

/timeoff/requests

Returns a collection of time off requests. Required scope: r_timeoff.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

🚧

This endpoint uses the r_timeoff scope, which can be enabled through the Integrations section found within the Settings menu.

Token behaviour

This endpoint supports both user tokens and account tokens.

Account token — when employee_id and employee_ids are omitted, the response contains every time off request in the account. Either parameter can be used to scope the result to specific employees.

User token — when employee_id and employee_ids are omitted, the response contains the authenticated user's own requests plus those of all direct and indirect descendants in the org chart. Users with the time off requests view permission receive every request in the account regardless of the org chart.

When either filter is provided, the user token is authorized per employee: if any supplied id cannot be viewed, the request fails with 403.

When both employee_id and employee_ids are provided, the values are merged and deduplicated.

Results

Calling the /timeoff/requests endpoint will return a paginated collection of time off requests between the time frame of from_date and to_date. An example of the response follows:

{
	"total_count": 2,
	"requests": [
		{
			"id": "135b",
			"employee_id": "4d3",
			"from_date": "2024-04-04T00:00:00.000",
			"to_date": "2024-04-12T00:00:00.000",
			"formatted_period": "04 April 2024 - 12 April 2024",
			"state": "approved",
			"requesting_total": 7,
			"timeoff_tracking_unit": "half_days",
			"half_days": [],
			"updated_by": "Dan Snow",
			"updated_at": "2024-04-04T09:58:08.724Z",
			"category_name": "Paid time off ",
			"pending_approvals": []
		},
		{
			"id": "135c",
			"employee_id": "4d4",
			"from_date": "2024-05-02T00:00:00.000",
			"to_date": "2024-05-09T00:00:00.000",
			"formatted_period": "02 May 2024 - 09 May 2024",
			"state": "pending",
			"requesting_total": 4,
			"timeoff_tracking_unit": "full_days",
			"half_days": [],
			"updated_by": "Dan Snow",
			"updated_at": "2024-04-04T09:58:40.252Z",
			"category_name": "Sick leave",
			"pending_approvals": []
		}
	]
}

The response object has the following top-level keys:

keytypedescription
total_countintegerTotal number of requests matching the query, ignoring limit/offset
requestsarrayPage of time off requests

Each timeoff request has the following keys:

keytypedescription
idstringUnique identifier for the time off request
employee_idstringSPI key of the employee the request belongs to
from_datestringIso date without timezone string
to_datestringIso date without timezone string
formatted_periodstringMore convenient way to display the period of the time off request
statestringAvailable states are: pending, approved, rejected and canceled
requesting_totalintegerTotal days that will be deducted from the relevant time off category pool
timeoff_tracking_unitstringfull_days, half_days, or hours
half_daysstringThe days that were counted as half day requests
updated_bystringThe full name of the time off requester
updated_atstringIso date without timezone string
pending_approvalsarrayList of approvals still awaiting action. Empty array when no approvals are pending

half_days

keytypedescription
datestringIso date without timezone string
halfstringvalid options are first and second half of the day

pending_approvals

keytypedescription
idstringSPI key of the approval — used with PATCH /timeoff/approvals/:key
approver_idstringIdentifier of the member whose approval action is required

Query parameters

parametertypedescription
from_datestringIso date without timezone string. Required.
to_datestringIso date without timezone string
category_idsstring[]Filter by category ids (see GET /timeoff/categories)
statesstring[]Filter by request state: pending, approved, rejected, canceled
employee_idstringFilter by a single employee SPI key. Optional. Merged with employee_ids when both are provided.
employee_idsstring[]Filter by one or more employee SPI keys. Optional. Merged with employee_id when both are provided.
limitintegerNumber of results per page. Allowed values: 10, 20, 50, 100. Default 10.
offsetintegerNumber of requests to skip (for pagination). Default 0.

Error responses

StatusCondition
400Invalid query parameters (e.g. limit not in the allowed enum, offset negative, malformed from_date)
403Missing required scope r_timeoff, or a user token supplied an employee_id/employee_ids value it cannot view
404Account token supplied an employee_id that does not belong to the account
Query Params
string
required

Iso date without timezone string

string

Iso date without timezone string

category_ids
array of strings

Filter the response by category ids that can be retrieved through /timeoff/categories endpoint

category_ids
states
array of strings

Filter the response by states

states
string

Filter by a single employee SPI key. Optional. When combined with employee_ids, the values are merged and deduplicated. User tokens are authorized per employee and receive a 403 if any id cannot be viewed.

employee_ids
array of strings

Filter by one or more employee SPI keys. Optional. When combined with employee_id, the values are merged and deduplicated. User tokens are authorized per employee and receive a 403 if any id cannot be viewed.

employee_ids
integer
enum
Defaults to 10

Number of results per page. Allowed values: 10, 20, 50, 100. Default 10.

Allowed:
integer
Defaults to 0

Number of requests to skip (for pagination). Default 0.

Responses

Language
Credentials
Header
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json