0

List invoice adjustments

by
Published Oct 17, 2025

Retrieve invoice adjustments. You can filter the list by providing additional parameters e.g. contract_id, contract_type etc. **Token scopes**: `invoice-adjustments:read`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * List invoice adjustments
4
 * Retrieve invoice adjustments. You can filter the list by providing additional parameters e.g. contract_id, contract_type etc.
5
 **Token scopes**: `invoice-adjustments:read`
6
 */
7
export async function main(
8
	auth: RT.Deel,
9
	contract_id?: string | undefined,
10
	contract_types?: string | undefined,
11
	types?: string | undefined,
12
	statuses?: string | undefined,
13
	invoice_id?: string | undefined,
14
	reporter_id?: string | undefined,
15
	date_from?: string | undefined,
16
	date_to?: string | undefined,
17
	limit?: string | undefined,
18
	offset?: string | undefined
19
) {
20
	const url = new URL(`https://api.letsdeel.com/rest/v2/invoice-adjustments`)
21
	for (const [k, v] of [
22
		['contract_id', contract_id],
23
		['contract_types', contract_types],
24
		['types', types],
25
		['statuses', statuses],
26
		['invoice_id', invoice_id],
27
		['reporter_id', reporter_id],
28
		['date_from', date_from],
29
		['date_to', date_to],
30
		['limit', limit],
31
		['offset', offset]
32
	]) {
33
		if (v !== undefined && v !== '') {
34
			url.searchParams.append(k, v)
35
		}
36
	}
37
	const response = await fetch(url, {
38
		method: 'GET',
39
		headers: {
40
			Authorization: 'Bearer ' + auth.apiKey
41
		},
42
		body: undefined
43
	})
44
	if (!response.ok) {
45
		const text = await response.text()
46
		throw new Error(`${response.status} ${text}`)
47
	}
48
	return await response.json()
49
}
50