0

Submit employee resignation PTO review

by
Published Oct 17, 2025

Allows a client to review and submit the Paid Time Off (PTO) details for an employee resignation request. This endpoint updates the resignation with the provided PTO information, triggers related notifications, and finalizes the PTO review process. Only available when the resignation status is AWAITING_PTO. **Token scopes**: `contracts:write`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Submit employee resignation PTO review
4
 * Allows a client to review and submit the Paid Time Off (PTO) details for an employee resignation request. This endpoint updates the resignation with the provided PTO information, triggers related notifications, and finalizes the PTO review process. Only available when the resignation status is AWAITING_PTO.
5
 **Token scopes**: `contracts:write`
6
 */
7
export async function main(auth: RT.Deel, contract_id: string, body: Body) {
8
	const url = new URL(
9
		`https://api.letsdeel.com/rest/v2/eor/contracts/${contract_id}/offboarding/resignations/review-pto`
10
	)
11

12
	const response = await fetch(url, {
13
		method: 'POST',
14
		headers: {
15
			'Content-Type': 'application/json',
16
			Authorization: 'Bearer ' + auth.apiKey
17
		},
18
		body: JSON.stringify(body)
19
	})
20
	if (!response.ok) {
21
		const text = await response.text()
22
		throw new Error(`${response.status} ${text}`)
23
	}
24
	return await response.json()
25
}
26

27
/* eslint-disable */
28
/**
29
 * This file was automatically generated by json-schema-to-typescript.
30
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
31
 * and run json-schema-to-typescript to regenerate this file.
32
 */
33

34
export interface Body {
35
	data?: {
36
		/**
37
		 * Time-off usage data including policy information and tracking periods
38
		 */
39
		used_time_off?: {
40
			/**
41
			 * Type of time off tracking - whether it's tracked on Deel platform or off platform
42
			 */
43
			tracking_type?: 'ON_PLATFORM' | 'OFF_PLATFORM'
44
			/**
45
			 * Required when tracking_type is OFF_PLATFORM, null otherwise
46
			 */
47
			off_platform_used_time_off?: {
48
				/**
49
				 * Array of time off entitlements for different tracking periods
50
				 */
51
				entitlements: {
52
					/**
53
					 * Amount of time off used in the period
54
					 */
55
					used: number
56
					/**
57
					 * Start date of the tracking period
58
					 */
59
					tracking_period: string
60
					/**
61
					 * End date of the tracking period
62
					 */
63
					tracking_period_end_date: string
64
					[k: string]: unknown
65
				}[]
66
				/**
67
				 * Total amount of time off scheduled until the end date
68
				 */
69
				total_scheduled: number
70
				/**
71
				 * Unit of measurement for the time off entitlements
72
				 */
73
				entitlement_unit: 'BUSINESS_DAY' | 'CALENDAR_DAY' | 'HOUR' | 'WEEK' | 'MONTH' | 'YEAR'
74
				[k: string]: unknown
75
			}
76
			[k: string]: unknown
77
		}
78
		/**
79
		 * Reason for declining the resignation request
80
		 */
81
		decline_reason?:
82
			| 'NOT_AGREE_WITH_END_DATE'
83
			| 'NOT_A_RESIGNATION_BUT_TERMINATION'
84
			| 'EMPLOYEE_UNDER_REVIEW_OR_INVESTIGATION_FOR_DISCIPLINARY_ACTIONS'
85
			| 'OTHER'
86
		/**
87
		 * Type of severance offered to the employee
88
		 */
89
		severance_type?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'CASH'
90
		/**
91
		 * Amount of severance offered to the employee
92
		 */
93
		severance_amount?: number
94
		/**
95
		 * Detailed explanation for declining the resignation request
96
		 */
97
		decline_reason_detail?: string
98
		/**
99
		 * Indicates whether the client has accepted the resignation request
100
		 */
101
		has_client_accepted_resignation_request?: boolean
102
		[k: string]: unknown
103
	}
104
	[k: string]: unknown
105
}
106