0

Update an account label

by
Published Oct 17, 2025

Updates an existing AR account label by setting field values. Any fields not provided remain unchanged. Permissions and other requirements SubscriptionAccounts Receivable User typeBusiness PermissionsList, View, Edit AR Account Labels

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 an account label
7
 * Updates an existing AR account label by setting field values. Any fields not provided remain unchanged.
8

9

10
Permissions and other requirements
11

12
SubscriptionAccounts Receivable
13
User typeBusiness
14
PermissionsList, View, Edit AR Account Labels
15

16

17

18

19
 */
20
export async function main(
21
	auth: SageIntacct,
22
	key: string,
23
	body: {
24
		key?: string
25
		id?: string
26
		href?: string
27
		description?: string
28
		isTaxable?: false | true
29
		isSubtotal?: false | true
30
		isTax?: false | true
31
		taxGroup?: { key?: string; id?: string; href?: string }
32
		taxCode?: string
33
		offsetGLAccount?: { key?: string; id?: string; href?: string }
34
		glAccount?: { href?: string; id?: string; key?: string }
35
		revenueRecognitionTemplate?: { key?: string; id?: string; href?: string }
36
		deferredRevenueGLAccount?: { key?: string; id?: string; href?: string }
37
		status?: 'active' | 'inactive'
38
		audit?: {
39
			createdDateTime?: string
40
			modifiedDateTime?: string
41
			createdBy?: string
42
			modifiedBy?: string
43
		}
44
		entity?: { key?: string; id?: string; name?: string; href?: string }
45
	} & { id?: {} }
46
) {
47
	const url = new URL(
48
		`https://api.intacct.com/ia/api/v1/objects/accounts-receivable/account-label/${key}`
49
	)
50

51
	const response = await fetch(url, {
52
		method: 'PATCH',
53
		headers: {
54
			'Content-Type': 'application/json',
55
			Authorization: 'Bearer ' + auth.token
56
		},
57
		body: JSON.stringify(body)
58
	})
59
	if (!response.ok) {
60
		const text = await response.text()
61
		throw new Error(`${response.status} ${text}`)
62
	}
63
	return await response.json()
64
}
65