0

Update personal information

by
Published Oct 17, 2025

Update worker's personal information. **Token scopes**: `people:write`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Update personal information
4
 * Update worker's personal information.
5
 **Token scopes**: `people:write`
6
 */
7
export async function main(auth: RT.Deel, worker_id: string, body: Body) {
8
	const url = new URL(`https://api.letsdeel.com/rest/v2/people/${worker_id}/personal`)
9

10
	const response = await fetch(url, {
11
		method: 'PATCH',
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.text()
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 personal email of the worker.
36
		 */
37
		work_email?: string
38
		/**
39
		 * The date of birth of the worker. Format: YYYY-MM-DD.
40
		 */
41
		date_of_birth?: string
42
		phone_numbers?: {
43
			/**
44
			 * The type of the phone number.
45
			 */
46
			type: 'PERSONAL' | 'WORK' | 'HOME'
47
			/**
48
			 * The dial code (also known as country code).
49
			 */
50
			dial_code: string
51
			/**
52
			 * The phone number.
53
			 */
54
			phone_number: string
55
			[k: string]: unknown
56
		}[]
57
		/**
58
		 * The personal email of the worker.
59
		 */
60
		personal_email?: string
61
		/**
62
		 * The preferred name of the worker.
63
		 */
64
		preferred_name?: string
65
		/**
66
		 * The legal last name of the worker.
67
		 */
68
		legal_last_name?: string
69
		/**
70
		 * The legal first name of the worker.
71
		 */
72
		legal_first_name?: string
73
		[k: string]: unknown
74
	}
75
	[k: string]: unknown
76
}
77