0

Retrieve restricted offboarding dates

by
Published Oct 17, 2025

Retrieves a list of dates, including weekends and public holidays, that are restricted for employee offboarding based on country-specific rules. Use this endpoint to plan employee offboarding by validating end-date selection. Call it when initiating an EOR offboarding flow to determine which dates are unavailable and what is the first day available. **Token scopes**: `contracts:read`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Retrieve restricted offboarding dates
4
 * Retrieves a list of dates, including weekends and public holidays, that are restricted for employee offboarding based on country-specific rules. Use this endpoint to plan employee offboarding by validating end-date selection. Call it when initiating an EOR offboarding flow to determine which dates are unavailable and what is the first day available.
5
 **Token scopes**: `contracts:read`
6
 */
7
export async function main(
8
	auth: RT.Deel,
9
	contract_id: string,
10
	termination_type?: 'TERMINATION' | 'RESIGNATION' | undefined
11
) {
12
	const url = new URL(
13
		`https://api.letsdeel.com/rest/v2/eor/contracts/${contract_id}/offboarding/restricted-dates`
14
	)
15
	for (const [k, v] of [['termination_type', termination_type]]) {
16
		if (v !== undefined && v !== '') {
17
			url.searchParams.append(k, v)
18
		}
19
	}
20
	const response = await fetch(url, {
21
		method: 'GET',
22
		headers: {
23
			Authorization: 'Bearer ' + auth.apiKey
24
		},
25
		body: undefined
26
	})
27
	if (!response.ok) {
28
		const text = await response.text()
29
		throw new Error(`${response.status} ${text}`)
30
	}
31
	return await response.json()
32
}
33