0

Create an employee expense type

by
Published Oct 17, 2025

Creates a new employee expense type. Permissions and other requirements SubscriptionTime & Expenses User typeBusiness, Employee PermissionsList, View, Add, Expense Types

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 employee expense type
7
 * Creates a new employee expense type.
8

9

10
Permissions and other requirements
11

12
SubscriptionTime & Expenses
13
User typeBusiness, Employee
14
PermissionsList, View, Add, Expense Types
15

16

17

18

19
 */
20
export async function main(
21
	auth: SageIntacct,
22
	body: {
23
		key?: string
24
		id?: string
25
		status?: 'active' | 'inactive'
26
		description?: string
27
		href?: string
28
		glAccount?: { key?: string; id?: string; name?: string; href?: string }
29
		offsetGLAccount?: {
30
			key?: string
31
			id?: string
32
			name?: string
33
			href?: string
34
		}
35
		item?: { key?: string; id?: string; name?: string; href?: string }
36
		unitCurrency?: string
37
		form1099?: { type?: string; box?: string }
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
		unitRates?: {
46
			key?: string
47
			id?: string
48
			href?: string
49
			rate?: string
50
			startDate?: string
51
			audit?: {
52
				createdDateTime?: string
53
				modifiedDateTime?: string
54
				createdBy?: string
55
				modifiedBy?: string
56
			}
57
			employeeExpenseType?: { key?: string; id?: string; href?: string }
58
		}[]
59
	} & {}
60
) {
61
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/expenses/employee-expense-type`)
62

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