0

List of background check options

by
Published Oct 17, 2025

Retrieve the list of background check options. **Token scopes**: `contracts:read`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * List of background check options
4
 * Retrieve the list of background check options.
5
 **Token scopes**: `contracts:read`
6
 */
7
export async function main(
8
	auth: RT.Deel,
9
	country?: string | undefined,
10
	prices?: 'true' | 'false' | undefined
11
) {
12
	const url = new URL(`https://api.letsdeel.com/rest/v2/background-checks/options`)
13
	for (const [k, v] of [
14
		['country', country],
15
		['prices', prices]
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
			Authorization: 'Bearer ' + auth.apiKey
25
		},
26
		body: undefined
27
	})
28
	if (!response.ok) {
29
		const text = await response.text()
30
		throw new Error(`${response.status} ${text}`)
31
	}
32
	return await response.json()
33
}
34