0

Create a customer account group

by
Published Oct 17, 2025

Creates a new customer account group.

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
 * Create a customer account group
7
 * Creates a new customer account group.
8
 */
9
export async function main(
10
	auth: SageIntacct,
11
	body: {
12
		key?: string
13
		id?: string
14
		groupType?: 'customer'
15
		status?: 'active' | 'inactive'
16
		href?: string
17
	} & {}
18
) {
19
	const url = new URL(
20
		`https://api.intacct.com/ia/api/v1/objects/accounts-receivable/customer-account-group`
21
	)
22

23
	const response = await fetch(url, {
24
		method: 'POST',
25
		headers: {
26
			'Content-Type': 'application/json',
27
			Authorization: 'Bearer ' + auth.token
28
		},
29
		body: JSON.stringify(body)
30
	})
31
	if (!response.ok) {
32
		const text = await response.text()
33
		throw new Error(`${response.status} ${text}`)
34
	}
35
	return await response.json()
36
}
37