0

Update an employee expense type

Published Oct 17, 2025

Updates an existing employee expense type by setting field values. Any fields not provided remain unchanged. Permissions and other requirements SubscriptionTime & Expenses User typeBusiness, Employee PermissionsList, View, Edit Expense Types

Script sage_intacct Verified

The script

Submitted by hugo697 Bun
Verified 389 days ago
1
//native
2
type SageIntacct = {
3
	token: string
4
}
5
/**
6
 * Update an employee expense type
7
 * Updates an existing employee expense type by setting field values. Any fields not provided remain unchanged.
8

9

10
Permissions and other requirements
11

12
SubscriptionTime & Expenses
13
User typeBusiness, Employee
14
PermissionsList, View, Edit Expense Types
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
		status?: 'active' | 'inactive'
27
		description?: string
28
		href?: string
29
		glAccount?: { key?: string; id?: string; name?: string; href?: string }
30
		offsetGLAccount?: {
31
			key?: string
32
			id?: string
33
			name?: string
34
			href?: string
35
		}
36
		item?: { key?: string; id?: string; name?: string; href?: string }
37
		unitCurrency?: string
38
		form1099?: { type?: string; box?: string }
39
		audit?: {
40
			createdDateTime?: string
41
			modifiedDateTime?: string
42
			createdBy?: string
43
			modifiedBy?: string
44
		}
45
		entity?: { key?: string; id?: string; name?: string; href?: string }
46
		unitRates?: {
47
			key?: string
48
			id?: string
49
			href?: string
50
			rate?: string
51
			startDate?: string
52
			audit?: {
53
				createdDateTime?: string
54
				modifiedDateTime?: string
55
				createdBy?: string
56
				modifiedBy?: string
57
			}
58
			employeeExpenseType?: { key?: string; id?: string; href?: string }
59
		}[]
60
	} & { id?: {} }
61
) {
62
	const url = new URL(
63
		`https://api.intacct.com/ia/api/v1/objects/expenses/employee-expense-type/${key}`
64
	)
65

66
	const response = await fetch(url, {
67
		method: 'PATCH',
68
		headers: {
69
			'Content-Type': 'application/json',
70
			Authorization: 'Bearer ' + auth.token
71
		},
72
		body: JSON.stringify(body)
73
	})
74
	if (!response.ok) {
75
		const text = await response.text()
76
		throw new Error(`${response.status} ${text}`)
77
	}
78
	return await response.json()
79
}
80