0

Cancel time-off request

by
Published Oct 17, 2025

Cancels a time-off request regardless of its current status. This endpoint provides a simplified approach to time-off management by always setting the request status to CANCELED. **Token scopes**: `time-off:write`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Cancel time-off request
4
 * Cancels a time-off request regardless of its current status. This endpoint provides a simplified approach to time-off management by always setting the request status to CANCELED.
5
 **Token scopes**: `time-off:write`
6
 */
7
export async function main(auth: RT.Deel, time_off_id: string) {
8
	const url = new URL(`https://api.letsdeel.com/rest/v2/time_offs/${time_off_id}`)
9

10
	const response = await fetch(url, {
11
		method: 'DELETE',
12
		headers: {
13
			Authorization: 'Bearer ' + auth.apiKey
14
		},
15
		body: undefined
16
	})
17
	if (!response.ok) {
18
		const text = await response.text()
19
		throw new Error(`${response.status} ${text}`)
20
	}
21
	return await response.json()
22
}
23