0

Create an employee expense summary

by
Published Oct 17, 2025

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

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

9

10
Permissions and other requirements
11

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

16

17

18

19
 */
20
export async function main(
21
	auth: SageIntacct,
22
	body: {
23
		key?: string
24
		id?: string
25
		name?: string
26
		postingDate?: string
27
		totalAmount?: string
28
		state?: 'open' | 'closed'
29
		recordType?: 'expense' | 'adjustment' | 'reimbursement'
30
		summaryCreationType?: 'system' | 'manual'
31
		bankAccount?: { key?: string; id?: string; href?: string }
32
		preventGLPosting?: false | true
33
		href?: string
34
		status?: 'active' | 'inactive'
35
		entity?: { key?: string; id?: string; name?: string; href?: string }
36
	} & {}
37
) {
38
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/expenses/employee-expense-summary`)
39

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