0

Update a warehouse

by
Published Oct 17, 2025

Updates an existing warehouse by setting field values. Any fields not provided remain unchanged. Permissions and other requirements SubscriptionInventory Control User typeBusiness PermissionsList, View, Edit Warehouses

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

9

10
Permissions and other requirements
11

12
SubscriptionInventory Control
13
User typeBusiness
14
PermissionsList, View, Edit Warehouses
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
		name?: string
27
		href?: string
28
		status?: 'active' | 'inactive'
29
		isReplenishmentEnabled?: false | true
30
		enableNegativeInv?: false | true
31
		location?: { id?: string; key?: string; href?: string }
32
		parent?: { id?: string; key?: string; href?: string }
33
		manager?: { id?: string; key?: string; href?: string }
34
		contacts?: {
35
			primary?: { id?: string; key?: string; href?: string }
36
			shipTo?: { id?: string; key?: string; href?: string }
37
		}
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/inventory-control/warehouse/${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