0

Create a direct employee

by
Published Oct 17, 2025

Create employee hired under your own entity to Deel's HRIS. Manage your employee through Deel and export a payroll report to your own providers. **Token scopes**: `people:write`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Create a direct employee
4
 * Create employee hired under your own entity to Deel's HRIS. Manage your employee through Deel and export a payroll report to your own providers.
5
 **Token scopes**: `people:write`
6
 */
7
export async function main(auth: RT.Deel, body: Body) {
8
	const url = new URL(`https://api.letsdeel.com/rest/v2/people`)
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
		 * The entity that is hiring the employee
36
		 */
37
		client: {
38
			team: {
39
				/**
40
				 * The team that the employee is part of
41
				 */
42
				id: string
43
				/**
44
				 * The direct manager of the employee
45
				 */
46
				direct_manager_id?: string
47
				[k: string]: unknown
48
			}
49
			department?: {
50
				/**
51
				 * The department that the employee is part of
52
				 */
53
				id: string
54
				[k: string]: unknown
55
			}
56
			legal_entity: {
57
				/**
58
				 * The legal entity that the employee is part of
59
				 */
60
				id: string
61
				[k: string]: unknown
62
			}
63
			[k: string]: unknown
64
		}
65
		/**
66
		 * The person that is being hired
67
		 */
68
		employee: {
69
			/**
70
			 * The personal email of the person being hired
71
			 */
72
			email: string
73
			/**
74
			 * The state of the person being hired
75
			 */
76
			state?: string
77
			/**
78
			 * The country of the person being hired
79
			 */
80
			country: string
81
			/**
82
			 * The last name of the person being hired
83
			 */
84
			last_name: string
85
			/**
86
			 * The first name of the person being hired
87
			 */
88
			first_name: string
89
			/**
90
			 * The work email of the person being hired
91
			 */
92
			work_email?: string
93
			/**
94
			 * An external identifier for the person being hired
95
			 */
96
			external_id?: string
97
			/**
98
			 * The nationality of the person being hired
99
			 */
100
			nationality: string
101
			[k: string]: unknown
102
		}
103
		/**
104
		 * The employment details of the employee
105
		 */
106
		employment:
107
			| {
108
					/**
109
					 * The type of employment
110
					 */
111
					type: 'PART_TIME'
112
					/**
113
					 * The end date of the employment
114
					 */
115
					end_date?: string
116
					/**
117
					 * The job title of the employment
118
					 */
119
					job_title: string
120
					/**
121
					 * The seniority of the employment
122
					 */
123
					seniority: string
124
					/**
125
					 * The start date of the employment
126
					 */
127
					start_date: string
128
					/**
129
					 * The document template ID for the employment contract
130
					 */
131
					document_template_id?: string
132
					/**
133
					 * The percentage of PART_TIME employment
134
					 */
135
					part_time_percentage: number
136
					[k: string]: unknown
137
			  }
138
			| {
139
					type: 'FULL_TIME'
140
					/**
141
					 * The end date of the employment
142
					 */
143
					end_date?: string
144
					/**
145
					 * The job title of the employment
146
					 */
147
					job_title: string
148
					/**
149
					 * The seniority of the employment
150
					 */
151
					seniority: string
152
					/**
153
					 * The start date of the employment
154
					 */
155
					start_date: string
156
					/**
157
					 * The document template ID for the employment contract
158
					 */
159
					document_template_id?: string
160
					[k: string]: unknown
161
			  }
162
		/**
163
		 * The compensation details of the employee
164
		 */
165
		compensation_details: {
166
			/**
167
			 * The salary of the employee
168
			 */
169
			salary: number
170
			/**
171
			 * The currency of the salary
172
			 */
173
			currency: string
174
			[k: string]: unknown
175
		}
176
		[k: string]: unknown
177
	}
178
	[k: string]: unknown
179
}
180