0

Create a class

by
Published Oct 17, 2025

Creates a new class. You can think of this as adding a new value to the dimension that you can use to tag transactions for reporting. Permissions and other requirements SubscriptionCompany User typeBusiness user with admin privileges PermissionsAdd Classes

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 class
7
 * Creates a new class. You can think of this as adding a new value to the dimension that you can use to tag transactions for reporting.
8

9

10
Permissions and other requirements
11

12
SubscriptionCompany
13
User typeBusiness user with admin privileges
14
PermissionsAdd Classes
15

16

17

18

19
 */
20
export async function main(
21
	auth: SageIntacct,
22
	body: {
23
		key?: string
24
		id?: string
25
		href?: string
26
		name?: string
27
		description?: string
28
		status?: 'active' | 'activeNonPosting' | 'inactive'
29
		locationKey?: string
30
		parent?: { id?: string; key?: string; href?: string; name?: string }
31
		audit?: {
32
			createdDateTime?: string
33
			modifiedDateTime?: string
34
			createdBy?: string
35
			modifiedBy?: string
36
		}
37
	} & {}
38
) {
39
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/company-config/class`)
40

41
	const response = await fetch(url, {
42
		method: 'POST',
43
		headers: {
44
			'Content-Type': 'application/json',
45
			Authorization: 'Bearer ' + auth.token
46
		},
47
		body: JSON.stringify(body)
48
	})
49
	if (!response.ok) {
50
		const text = await response.text()
51
		throw new Error(`${response.status} ${text}`)
52
	}
53
	return await response.json()
54
}
55