0

Amend contract

by
Published Oct 17, 2025

Amend the details of a contract. Please note that if the contract is already signed or active, then the update will have to be approved and re-signed for to take effect. **Token scopes**: `contracts:write`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Amend contract
4
 * Amend the details of a contract. Please note that if the contract is already signed or active, then the update will have to be approved and re-signed for to take effect.
5
 **Token scopes**: `contracts:write`
6
 */
7
export async function main(auth: RT.Deel, contract_id: string, body: Body) {
8
	const url = new URL(`https://api.letsdeel.com/rest/v2/contracts/${contract_id}/amendments`)
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
	/**
34
	 * You can specify any combination of data points that need changing.
35
	 */
36
	data: {
37
		/**
38
		 * Defines the scale at which the amount is paid. For example, enter 'hourly' to define the amount per hour. This field can be excluded when creating a Pay-as-you-go task-based or Milestone contracts.
39
		 */
40
		scale?: 'hourly' | 'daily' | 'weekly' | 'monthly' | 'biweekly' | 'semimonthly' | 'custom'
41
		/**
42
		 * Amount to be paid per scale.
43
		 */
44
		amount?: number
45
		/**
46
		 * Day of the month when the cycle ends.
47
		 */
48
		cycle_end?: number
49
		/**
50
		 * Scale of the invoice cycle.
51
		 */
52
		frequency?: 'weekly' | 'monthly' | 'biweekly' | 'semimonthly' | 'calendar-month'
53
		job_title_id?: string | number
54
		seniority_id?: string | number
55
		/**
56
		 * Currency code in ISO 4217 format.
57
		 */
58
		currency_code?: string
59
		/**
60
		 * Amount to be paid as the first payment.
61
		 */
62
		first_payment?: number
63
		/**
64
		 * Text to describe the scope of work of the contract.
65
		 */
66
		scope_of_work?: string
67
		/**
68
		 * Cycle end can be weekly 1-7 (Monday = 1) or monthly 1-31.
69
		 */
70
		cycle_end_type?: 'DAY_OF_WEEK' | 'DAY_OF_LAST_WEEK' | 'DAY_OF_MONTH'
71
		/**
72
		 * Short date in format ISO-8601 (YYYY-MM-DD). For example: 2022-12-31.
73
		 */
74
		effective_date?: string
75
		/**
76
		 * You can enter new job title.
77
		 */
78
		job_title_name?: string
79
		/**
80
		 * Text to describe any special clause in contract.
81
		 */
82
		special_clause?: string
83
		/**
84
		 * Number of days after the invoice is sent that the payment is due.
85
		 */
86
		payment_due_days?: number
87
		/**
88
		 * Type of payment due. If the payment is due on the last day of month, enter 'WITHIN_MONTH'.
89
		 */
90
		payment_due_type?: 'REGULAR' | 'WITHIN_MONTH'
91
		/**
92
		 * Short date in format ISO-8601 (YYYY-MM-DD). For example: 2022-12-31.
93
		 */
94
		first_payment_date?: string
95
		/**
96
		 * If the payment due is on a weekend, pay on Friday.
97
		 */
98
		pay_before_weekends?: boolean
99
		[k: string]: unknown
100
	}
101
	[k: string]: unknown
102
}
103