0

Review multiple tasks

by
Published Oct 17, 2025

Review multiple tasks associated with a Deel contract to approve or decline the submitted work. The review includes a status (approved or declined) for each task and an optional reason for declined tasks. **Token scopes**: `contracts:write`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Review multiple tasks
4
 * Review multiple tasks associated with a Deel contract to approve or decline the submitted work. The review includes a status (approved or declined) for each task and an optional reason for declined tasks.
5
 **Token scopes**: `contracts:write`
6
 */
7
export async function main(auth: RT.Deel, contract_id: string, body: Body) {
8
	const url = new URL(
9
		`https://api.letsdeel.com/rest/v2/contracts/${contract_id}/tasks/many/reviews`
10
	)
11

12
	const response = await fetch(url, {
13
		method: 'POST',
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
		 * An array of task IDs to review. A maximum of 1000 task IDs is allowed per request.
38
		 *
39
		 * @minItems 1
40
		 * @maxItems 1000
41
		 */
42
		ids: string[]
43
		/**
44
		 * Optional reason for declining the tasks.
45
		 */
46
		reason?: string
47
		/**
48
		 * The review status of the tasks. Possible values are 'approved' or 'declined'.
49
		 */
50
		status: 'approved' | 'declined'
51
		[k: string]: unknown
52
	}
53
	[k: string]: unknown
54
}
55