0

Update a billing price list

by
Published Oct 17, 2025

Updates an existing billing price list by setting field values. Any fields not provided remain unchanged.

Script sage_intacct Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type SageIntacct = {
3
	token: string
4
}
5
/**
6
 * Update a billing price list
7
 * Updates an existing billing price list by setting field values. Any fields not provided remain unchanged.
8
 */
9
export async function main(
10
	auth: SageIntacct,
11
	key: string,
12
	body: {
13
		key?: string
14
		id?: string
15
		description?: string
16
		status?: 'active' | 'inactive'
17
		audit?: {
18
			createdDateTime?: string
19
			modifiedDateTime?: string
20
			createdBy?: string
21
			modifiedBy?: string
22
			createdByUser?: { key?: string; id?: string; href?: string }
23
			modifiedByUser?: { key?: string; id?: string; href?: string }
24
		}
25
	} & { id?: {} }
26
) {
27
	const url = new URL(
28
		`https://api.intacct.com/ia/api/v1/objects/contracts/billing-price-list/${key}`
29
	)
30

31
	const response = await fetch(url, {
32
		method: 'PATCH',
33
		headers: {
34
			'Content-Type': 'application/json',
35
			Authorization: 'Bearer ' + auth.token
36
		},
37
		body: JSON.stringify(body)
38
	})
39
	if (!response.ok) {
40
		const text = await response.text()
41
		throw new Error(`${response.status} ${text}`)
42
	}
43
	return await response.json()
44
}
45