0

Get Job Summaries

by
Published Oct 17, 2025

Get a list of job summaries. The owner of the API key used must have access to ATS settings. Combine as many different optional parameter filters as you like.

Script bamboo_hr Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Get Job Summaries
4
 * Get a list of job summaries. The owner of the API key used must have access to ATS settings. Combine as many different optional parameter filters as you like.
5
 */
6
export async function main(
7
	auth: RT.BambooHr,
8
	statusGroups?:
9
		| 'ALL'
10
		| 'DRAFT_AND_OPEN'
11
		| 'Open'
12
		| 'Filled'
13
		| 'Draft'
14
		| 'Deleted'
15
		| 'On Hold'
16
		| 'Canceled'
17
		| undefined,
18
	sortBy?: 'count' | 'title' | 'lead' | 'created' | 'status' | undefined,
19
	sortOrder?: 'ASC' | 'DESC' | undefined
20
) {
21
	const url = new URL(`https://${auth.companyDomain}.bamboohr.com/api/v1/applicant_tracking/jobs`)
22
	for (const [k, v] of [
23
		['statusGroups', statusGroups],
24
		['sortBy', sortBy],
25
		['sortOrder', sortOrder]
26
	]) {
27
		if (v !== undefined && v !== '') {
28
			url.searchParams.append(k, v)
29
		}
30
	}
31
	const response = await fetch(url, {
32
		method: 'GET',
33
		headers: {
34
			Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`)
35
		},
36
		body: undefined
37
	})
38
	if (!response.ok) {
39
		const text = await response.text()
40
		throw new Error(`${response.status} ${text}`)
41
	}
42
	return await response.json()
43
}
44