0

Create an inventory total

by
Published Oct 17, 2025

Creates a new inventory total. Permissions and other requirements SubscriptionInventory Control ConfigurationAdvanced workflows must be enabled to add inventory totals User typeBusiness PermissionsList, View, Add Inventory totals

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 an inventory total
7
 * Creates a new inventory total.
8

9

10
Permissions and other requirements
11

12
SubscriptionInventory Control
13
ConfigurationAdvanced workflows must be enabled to add inventory totals
14
User typeBusiness
15
PermissionsList, View, Add Inventory totals
16

17

18

19

20
 */
21
export async function main(
22
	auth: SageIntacct,
23
	body: {
24
		key?: string
25
		id?: string
26
		href?: string
27
		updateType?: 'accumulative' | 'perPeriod' | 'continuous'
28
		status?: 'active' | 'inactive'
29
	} & {}
30
) {
31
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/inventory-control/total`)
32

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