0

Termination Request

by
Published Oct 17, 2025

This API enables clients with group admin and people manager permissions to initiate a request for the termination of an Employee of Record (EOR) contract for members of their team. **Token scopes**: `contracts:read`, `contracts:write`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Termination Request
4
 * This API enables clients with group admin and people manager permissions to initiate a request for the termination of an Employee of Record (EOR) contract for members of their team.
5
 **Token scopes**: `contracts:read`, `contracts:write`
6
 */
7
export async function main(auth: RT.Deel, oid: string, body: Body) {
8
	const url = new URL(`https://api.letsdeel.com/rest/v2/eor/${oid}/terminations/regular`)
9

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

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

32
export interface Body {
33
	data: {
34
		/**
35
		 * Reason why the contract is being terminated
36
		 */
37
		reason:
38
			| 'DEEL_COLLECTIONS'
39
			| 'STATUS_CHANGE'
40
			| 'RELOCATION'
41
			| 'COMPENSATION'
42
			| 'RETIREMENT'
43
			| 'JOB_ABANDONMENT'
44
			| 'WORK_RELATED'
45
			| 'PERSONAL'
46
			| 'OTHER_OPPORTUNITY'
47
			| 'NON_RENEWAL'
48
			| 'PROBATION'
49
			| 'ASSIGNMENT_ENDED'
50
			| 'POSITION_ELIMINATION'
51
			| 'FORCE_REDUCTION'
52
			| 'DEATH'
53
			| 'FOR_CAUSE'
54
			| 'PERFORMANCE'
55
			| 'MEDICAL'
56
			| 'PERFORMANCE_ISSUES'
57
			| 'ATTENDANCE_ISSUES'
58
			| 'REORGANIZATION_DOWNSIZING_BUDGET_OR_REDUCTION_OF_WORKFORCE'
59
			| 'ROLE_BECAME_REDUNDANT_OR_ROLE_CHANGED'
60
			| 'OFFER_WAS_REVOKED'
61
			| 'EXITING_THE_MARKET'
62
			| 'NO_LONGER_WISH_TO_WORK_WITH_DEEL'
63
			| 'COMPANY_ACQUIRED'
64
			| 'STEALING'
65
			| 'MISCONDUCT'
66
			| 'FALSIFYING'
67
			| 'HARASSMENT'
68
			| 'VIOLENCE'
69
			| 'REORGANIZATION_DOWNSIZING_BUDGET_OR_REDUCTION_OF_WORKFORCE_OR_ROLE_BECAME_REDUNDANT_OR_ROLE_CHANGED'
70
			| 'UNAUTHORIZED_ABSENCES_OR_LACK_OF_ATTENDANCE'
71
			| 'STANDARD_RESELLER_PRACTICE'
72
			| 'MOVING_EMPLOYEE_TO_INTERNAL_ENTITY'
73
			| 'MOVING_EMPLOYEE_TO_DEEL_PEO'
74
			| 'OTHER'
75
		/**
76
		 * Any document that is important for the request to terminate the contract
77
		 */
78
		attachments?: {
79
			key: string
80
			file_name?: string
81
			[k: string]: unknown
82
		}[]
83
		/**
84
		 * Defines whether the termination is sensitive. In this case, only the person requesting the termination will be able to view the termination, receive emails or notifications.
85
		 */
86
		is_sensitive?: boolean
87
		/**
88
		 * Field to better explain how communication with the employee will be and/or their reaction to the communication, or other necessary information
89
		 */
90
		reason_detail: string
91
		used_time_off: {
92
			/**
93
			 * All time-off used by the employee during contract period
94
			 */
95
			time_offs?: {
96
				/**
97
				 * Time off unit
98
				 */
99
				unit: 'BUSINESS_DAY' | 'CALENDAR_DAY' | 'HOUR' | 'WEEK' | 'MONTH' | 'YEAR'
100
				/**
101
				 * Time off policy type
102
				 */
103
				policy_type?:
104
					| 'Vacation'
105
					| 'Sick leave'
106
					| 'Maternity leave'
107
					| 'Paternity leave'
108
					| 'Parental leave'
109
					| 'Bereavement leave'
110
					| 'Childcare leave'
111
					| 'Civic/public duty leave'
112
					| 'Personal leave'
113
					| 'Adoption leave'
114
					| 'Blood donation leave'
115
					| 'Childbirth leave'
116
					| 'Disability leave'
117
					| "Doctor's appointment leave"
118
					| 'Family & domestic violence leave'
119
					| 'Hajj leave'
120
					| 'Marriage/wedding leave'
121
					| 'Military leave'
122
					| 'Moving leave'
123
					| 'Pregnancy leave'
124
					| 'Study leave'
125
					| 'Volunteer leave'
126
					| 'Unpaid leave'
127
					| 'Paid leave'
128
					| 'Other leave'
129
					| 'RTT'
130
					| 'Regional holiday'
131
					| 'Breastfeeding leave'
132
					| 'Advanced vacation'
133
					| 'Supplementary Leave'
134
					| 'Floating Holiday Allowance'
135
				tracking_periods?: {
136
					/**
137
					 * Time off used in the period
138
					 */
139
					used: number
140
					/**
141
					 * Time off start period
142
					 */
143
					end_date?: string
144
					/**
145
					 * Time off end period
146
					 */
147
					start_date?: string
148
					[k: string]: unknown
149
				}[]
150
				/**
151
				 * Time off escheduled until contract end date
152
				 */
153
				scheduled_until_end_date?: number
154
				[k: string]: unknown
155
			}[]
156
			/**
157
			 * Any additional details regarding time off that HRX should know
158
			 */
159
			additional_details?: string
160
			/**
161
			 * Defines whether the client agrees with the time off values ​​that are registered in Deel. If false, it means that the client changed the values.
162
			 */
163
			is_deel_pto_confirmed?: boolean
164
			[k: string]: unknown
165
		}
166
		/**
167
		 * The type of severance selected by the client. It's an optional field
168
		 */
169
		severance_type?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'CASH'
170
		/**
171
		 * The desired end date. If the date is not provided, it will be selected by HRX the closest date possible
172
		 */
173
		desired_end_date?: string
174
		/**
175
		 * The amount of severance needed
176
		 */
177
		severance_amount?: number
178
		/**
179
		 * An additional reason can be provided in case the reason selected is NO_LONGER_WISH_TO_WORK_WITH_DEEL
180
		 */
181
		additional_reason?:
182
			| 'DISSATISFIED_WITH_DEEL_SERVICE'
183
			| 'DISSATISFIED_WITH_DEEL_PRICING'
184
			| 'DISSATISFIED_WITH_DEEL_PRODUCT'
185
		/**
186
		 * Additional notes can be provided regarding the termination for Deel, like questions and doubts
187
		 */
188
		termination_notes?: string[]
189
		/**
190
		 * Parameter to inform whether it would be possible for the client to hire the employee again
191
		 */
192
		eligible_for_rehire?: 'YES' | 'NO' | 'DONT_KNOW'
193
		/**
194
		 * The current country data id
195
		 */
196
		eor_country_data_id?: number
197
		/**
198
		 * Defines if employee was informed by client or not before the termination
199
		 */
200
		is_employee_notified: boolean
201
		/**
202
		 * Termination impact data if there is some configured on HR module
203
		 */
204
		termination_impact_id?: string
205
		/**
206
		 * For some countries some data is needed to help Deel to process the termination. The questions comes from another endpoint to get the additional country data
207
		 */
208
		additional_country_data?: {
209
			answer: boolean
210
			question: string
211
			[k: string]: unknown
212
		}[]
213
		/**
214
		 * Custom termination reason ID. A custom termination reason can be added on Client HR module
215
		 */
216
		custom_termination_reason_id?: string
217
		/**
218
		 * If it's an termination contract ending and employee was already informed, the employee notification details should be provided
219
		 */
220
		employee_notification_detail?: string
221
		/**
222
		 * Any proof such as correspondence, documentation of previous warnings or attendance records for the reason select above.
223
		 */
224
		additional_supporting_documents?: {
225
			key: string
226
			file_name?: string
227
			[k: string]: unknown
228
		}[]
229
		[k: string]: unknown
230
	}
231
	[k: string]: unknown
232
}
233