0

Update a specific EOR contract amendment

by
Published Oct 17, 2025

Updates a specific contract amendment. This can only be performed on amendments in a DRAFT status. This action is irreversible and will overwrite any previous draft data. **Token scopes**: `contracts:write`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Update a specific EOR contract amendment
4
 * Updates a specific contract amendment. This can only be performed on amendments in a DRAFT status. This action is irreversible and will overwrite any previous draft data.
5
 **Token scopes**: `contracts:write`
6
 */
7
export async function main(auth: RT.Deel, contract_id: string, amendment_id: string, body: Body) {
8
	const url = new URL(
9
		`https://api.letsdeel.com/rest/v2/eor/contracts/${contract_id}/amendments/${amendment_id}`
10
	)
11

12
	const response = await fetch(url, {
13
		method: 'PATCH',
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
		 * Scope of the amendment.
38
		 */
39
		scope?: string
40
		/**
41
		 * An optional array of custom objects.
42
		 */
43
		custom?: {
44
			/**
45
			 * An optional identifier for the custom object.
46
			 */
47
			id?: string
48
			/**
49
			 * The type of the custom object. Must be one of the valid custom types.
50
			 */
51
			type: string
52
			/**
53
			 * A required description for the custom object.
54
			 */
55
			description: string
56
			[k: string]: unknown
57
		}[]
58
		/**
59
		 * Salary for the amendment.
60
		 */
61
		salary?: number
62
		/**
63
		 * End date of the employment.
64
		 */
65
		end_date?: string
66
		/**
67
		 * Number of holidays.
68
		 */
69
		holidays?: number
70
		/**
71
		 * Job title associated with the amendment.
72
		 */
73
		job_title?: string
74
		/**
75
		 * Start date of the employment.
76
		 */
77
		start_date?: string
78
		/**
79
		 * Hourly rate of the amendment. The max value supported is 1e19
80
		 */
81
		hourly_rate?: number
82
		/**
83
		 * Seniority level identifier.
84
		 */
85
		seniority_id?: number
86
		/**
87
		 * Type of time off.
88
		 */
89
		time_off_type?: 'STANDARD' | 'SPECIFIC' | 'PRORATED'
90
		/**
91
		 * Effective date for the amendment.
92
		 */
93
		effective_date?: string
94
		/**
95
		 * The seniority date represents the employee’s original start date with a previous employer. It is used to preserve employment tenure when the employee transfers to this company. Can be null if not applicable.
96
		 */
97
		seniority_date?: string
98
		/**
99
		 * Additional metadata related to job validation and categorisation
100
		 */
101
		additional_info?: {
102
			/**
103
			 * Identifier or flag for AI scope validation check
104
			 */
105
			ai_scope_check_public_id?: string | boolean
106
			/**
107
			 * Identifier for job categorisation log
108
			 */
109
			job_categorization_log_id?: string
110
			[k: string]: unknown
111
		}
112
		/**
113
		 * Type of employment.
114
		 */
115
		employment_type?: 'FULL_TIME' | 'PART_TIME'
116
		/**
117
		 * State of employment.
118
		 */
119
		employment_state?: string
120
		/**
121
		 * Duration of the probation period.
122
		 */
123
		probation_period?: number
124
		/**
125
		 * Type of notice period.
126
		 */
127
		notice_period_type?: 'STANDARD' | 'CUSTOM'
128
		/**
129
		 * Number of work hours per week.
130
		 */
131
		work_hours_per_week?: number
132
		/**
133
		 * Notice period after probation.
134
		 */
135
		notice_period_after_probation?: number
136
		/**
137
		 * Notice period during probation.
138
		 */
139
		notice_period_during_probation?: number
140
		/**
141
		 * Type of probation period for definite contracts.
142
		 */
143
		probation_period_type_for_definite?: 'STANDARD' | 'CUSTOM'
144
		[k: string]: unknown
145
	}
146
	[k: string]: unknown
147
}
148