0

Create an EOR contract

by
Published Oct 17, 2025

Creates an Employee of Record (EOR) contract quote. This endpoint allows to submit details for an EOR contract. Deel will process the information and return a quote for the requested contract. **Token scopes**: `contracts:write`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Create an EOR contract
4
 * Creates an Employee of Record (EOR) contract quote. This endpoint allows to submit details for an EOR contract. Deel will process the information and return a quote for the requested contract.
5
 **Token scopes**: `contracts:write`
6
 */
7
export async function main(auth: RT.Deel, body: Body) {
8
	const url = new URL(`https://api.letsdeel.com/rest/v2/eor`)
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
		client: {
35
			team: {
36
				id: string | number
37
				[k: string]: unknown
38
			}
39
			legal_entity?: {
40
				id?: string | number
41
				[k: string]: unknown
42
			}
43
			[k: string]: unknown
44
		}
45
		/**
46
		 * Some countries required a pension benefit.
47
		 */
48
		pension?: {
49
			/**
50
			 * Pension provider id. You can see available pension providers in the country guide endpoint.
51
			 */
52
			id?: string
53
			/**
54
			 * Enter the value of pension contribution. You should send this value only if the contribution object is available in the country guide endpoint and the value should be there between minimum and maximum values indicated.
55
			 */
56
			contribution?: string
57
			[k: string]: unknown
58
		}
59
		benefits?: {
60
			/**
61
			 * The ID of a benefits plan to include in the calculation.
62
			 */
63
			plan_id?: string
64
			/**
65
			 * Flag indicating if benefit will fully cover the employee.
66
			 */
67
			cover_all?: boolean
68
			/**
69
			 * The ID of a benefits provider to include in the calculation.
70
			 */
71
			provider_id?: string
72
			/**
73
			 * The amount the client will contribute for the benefit in the currency of the contract. Only taken into account if cover_all is set to false. For Unisure provider contribution is always in USD.
74
			 */
75
			contribution?: number
76
			/**
77
			 * Flag indicating if benefit will cover dependents. Only needed if cover_all is set to true.
78
			 */
79
			cover_dependents?: boolean
80
			[k: string]: unknown
81
		}[]
82
		employee: {
83
			/**
84
			 * Employee's email address.
85
			 */
86
			email?: string
87
			address?: {
88
				/**
89
				 * Zip code.
90
				 */
91
				zip?: string
92
				/**
93
				 * City name.
94
				 */
95
				city?: string
96
				/**
97
				 * State code.
98
				 */
99
				state?: string
100
				/**
101
				 * Street and number.
102
				 */
103
				street?: string
104
				/**
105
				 * Country code.
106
				 */
107
				country?: string
108
				[k: string]: unknown
109
			}
110
			/**
111
			 * Employee's last name.
112
			 */
113
			last_name: string
114
			/**
115
			 * Employee's first name.
116
			 */
117
			first_name: string
118
			/**
119
			 * External identifier of the employee.
120
			 */
121
			external_id?: string
122
			/**
123
			 * Employee's nationality.
124
			 */
125
			nationality: string
126
			/**
127
			 * Employee's PF deductions. Required only for India contracts.
128
			 */
129
			pf_deductions?: '12% of Basic' | '12% of Rs 15,000 (Rs 1,800)'
130
			[k: string]: unknown
131
		}
132
		/**
133
		 * Employee's job title.
134
		 */
135
		job_title: string
136
		seniority: {
137
			id?: string | number
138
			[k: string]: unknown
139
		}
140
		employment: {
141
			/**
142
			 * Is it a full-time contract or a part-time contract?
143
			 */
144
			type?: 'Full-time' | 'Part-time'
145
			/**
146
			 * State code of the state/province where the this person will be employed.
147
			 */
148
			state?: string
149
			/**
150
			 * Country code of employment.
151
			 */
152
			country: string
153
			/**
154
			 * End date in ISO-8601 format (YYYY-MM-DD).
155
			 */
156
			end_date?: string
157
			/**
158
			 * Enter the number of holidays. Leave this field blank if you are chooseing "STANDARD" time_off_type.
159
			 */
160
			holidays?: number
161
			/**
162
			 * Is the employee contract hourly instead of salaried?
163
			 */
164
			is_hourly?: boolean
165
			/**
166
			 * Start date in ISO-8601 format (YYYY-MM-DD).
167
			 */
168
			start_date: string
169
			scope_of_work:
170
				| string
171
				| {
172
						/**
173
						 * Scope template UUID.
174
						 */
175
						scope_template_id?: string
176
						[k: string]: unknown
177
				  }
178
				| {
179
						/**
180
						 * Scope validation UUID.
181
						 */
182
						scope_validation_id?: string
183
						[k: string]: unknown
184
				  }
185
			/**
186
			 * If you want to use standard number of holidays for this employee, choose "STANDARD". If you want to enter a specific number of holidays, choose "SPECIFIC" and enter the number of days in the holidays field.
187
			 */
188
			time_off_type?: 'STANDARD' | 'SPECIFIC'
189
			/**
190
			 * Seniority date
191
			 */
192
			seniority_date?: string
193
			/**
194
			 * Number of sick leave days
195
			 */
196
			sick_leave_days?: number
197
			/**
198
			 * Number of probation days.
199
			 */
200
			probation_period?: number
201
			/**
202
			 * Type of notice period.
203
			 */
204
			notice_period_type?: 'STANDARD' | 'CUSTOM'
205
			/**
206
			 * Do you require Deel to apply for work visa for this person?
207
			 */
208
			work_visa_required: boolean
209
			/**
210
			 * Employee's work hours per week. Required only if contract is set as hourly.
211
			 */
212
			work_hours_per_week?: number
213
			/**
214
			 * Notice period after probation required when type is CUSTOM.
215
			 */
216
			notice_period_after_probation?: number
217
			/**
218
			 * Notice period during probation required when type is CUSTOM.
219
			 */
220
			notice_period_during_probation?: number
221
			/**
222
			 * Whether the employee has previously passed the probation period.
223
			 */
224
			employee_completed_past_probation?: boolean
225
			/**
226
			 * Type of probation period for definite contracts.
227
			 */
228
			probation_period_type_for_definite?: 'STANDARD' | 'CUSTOM'
229
			[k: string]: unknown
230
		}
231
		/**
232
		 * Healthcare plan id. You can see available healthcare plans in the country guide endpoint.
233
		 */
234
		health_plan_id?: string
235
		compensation_details: {
236
			/**
237
			 * Employee's gross annual salary. Required only if contract is salaried.
238
			 */
239
			salary?: number
240
			/**
241
			 * Salary currency.
242
			 */
243
			currency: string
244
			/**
245
			 * Employee's hourly rate. Required only if contract is set as hourly.
246
			 */
247
			hourly_rate?: number
248
			/**
249
			 * Signing bonus amount.
250
			 */
251
			signing_bonus?: number
252
			fixed_adjustments?: {
253
				/**
254
				 * Adjustment name.
255
				 */
256
				name?: string
257
				/**
258
				 * Adjustment value.
259
				 */
260
				value?: number
261
				/**
262
				 * Whether the adjustment is being opted out of.
263
				 */
264
				opt_out?: boolean
265
				/**
266
				 * Whether the adjustment is optional.
267
				 */
268
				optional?: boolean
269
				/**
270
				 * Adjustment description.
271
				 */
272
				description?: string
273
				/**
274
				 * Whether the adjustment is paid recurring monthly or one-time on employee's first payroll.
275
				 */
276
				is_recurring?: boolean
277
				/**
278
				 * Identifier of the rule cost associated with the adjustment.
279
				 */
280
				rule_cost_id?: string
281
				/**
282
				 * Whether this adjustment is country-specific.
283
				 */
284
				is_country_specific?: boolean
285
				/**
286
				 * Optional skipping confirmation text shown to the user.
287
				 */
288
				skipping_confirmation_text?: string
289
				[k: string]: unknown
290
			}[]
291
			/**
292
			 * Variable compensation. For example, if the person will earn 5% of the gross annual salary as the variable compensation, enter 5.
293
			 */
294
			variable_compensation?: number
295
			/**
296
			 * Should be set only if signing_bonus is set. It defines when the bonus is paid.
297
			 */
298
			signing_bonus_payout_type?:
299
				| 'FIRST_CYCLE'
300
				| 'AFTER_PROBATION'
301
				| 'AFTER_FIRST_CONTRACT_ANNIVERSARY'
302
			/**
303
			 * Should be set only if variable_compensation is set. It can be PERCENTAGE or FIXED.
304
			 */
305
			variable_compensation_type?: 'PERCENTAGE' | 'FIXED' | null
306
			/**
307
			 * Variable compensation title.
308
			 */
309
			variable_compensation_title?: string
310
			/**
311
			 * Variable compensation timeline.
312
			 */
313
			variable_compensation_timeline?: 'ANNUALLY' | 'BIANNUALLY' | 'QUARTERLY' | 'MONTHLY'
314
			/**
315
			 * Variable compensation effective date.
316
			 */
317
			variable_compensation_effective_date?: string
318
			[k: string]: unknown
319
		}
320
		/**
321
		 * Some countries require additional employee information for employment contracts.
322
		 */
323
		quote_additional_fields?: {
324
			/**
325
			 * Employee's date of birth.
326
			 */
327
			dob?: string
328
			/**
329
			 * Employee's gender.
330
			 */
331
			gender?: string
332
			/**
333
			 * Type of worker.
334
			 */
335
			worker_type?: 'Skilled' | 'Unskilled'
336
			[k: string]: unknown
337
		}
338
		[k: string]: unknown
339
	}
340
	[k: string]: unknown
341
}
342