0

Get a list of Who's Out

by
Published Oct 17, 2025

This endpoint will return a list, sorted by date, of employees who will be out, and company holidays, for a period of time.

Script bamboo_hr Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Get a list of Who's Out
4
 * This endpoint will return a list, sorted by date, of employees who will be out, and company holidays, for a period of time.
5
 */
6
export async function main(
7
	auth: RT.BambooHr,
8
	start?: string | undefined,
9
	end?: string | undefined,
10
	AcceptHeaderParameter?: string
11
) {
12
	const url = new URL(`https://${auth.companyDomain}.bamboohr.com/api/v1/time_off/whos_out`)
13
	for (const [k, v] of [
14
		['start', start],
15
		['end', end]
16
	]) {
17
		if (v !== undefined && v !== '') {
18
			url.searchParams.append(k, v)
19
		}
20
	}
21
	const response = await fetch(url, {
22
		method: 'GET',
23
		headers: {
24
			...(AcceptHeaderParameter ? { AcceptHeaderParameter: AcceptHeaderParameter } : {}),
25
			Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`)
26
		},
27
		body: undefined
28
	})
29
	if (!response.ok) {
30
		const text = await response.text()
31
		throw new Error(`${response.status} ${text}`)
32
	}
33
	return await response.json()
34
}
35