0

Create an account

by
Published Oct 17, 2025

Creates a new General Ledger account. Permissions and other requirements SubscriptionCompany User typeBusiness user with admin privileges PermissionsAdd Accounts

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 account
7
 * Creates a new General Ledger account.
8

9

10
Permissions and other requirements
11

12
SubscriptionCompany
13
User typeBusiness user with admin privileges
14
PermissionsAdd Accounts
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
		accountType?: 'balanceSheet' | 'incomeStatement'
27
		normalBalance?: 'debit' | 'credit'
28
		closingType?: 'nonClosingAccount' | 'closingAccount' | 'closedToAccount'
29
		closeToGLAccount?: { key?: string; id?: string; href?: string }
30
		alternativeGLAccount?: 'none' | 'payablesAccount' | 'receivablesAccount'
31
		disallowDirectPosting?: false | true
32
		status?: 'active' | 'inactive'
33
		requireDimensions?: {
34
			class?: false | true
35
			contract?: false | true
36
			customer?: false | true
37
			department?: false | true
38
			employee?: false | true
39
			item?: false | true
40
			location?: false | true
41
			project?: false | true
42
			vendor?: false | true
43
			warehouse?: false | true
44
			asset?: false | true
45
			affiliateEntity?: false | true
46
		}
47
		category?: string
48
		isTaxable?: false | true
49
		taxCode?: string
50
		mrcCode?: string
51
		entity?: { key?: string; id?: string; name?: string; href?: string }
52
		audit?: {
53
			createdDateTime?: string
54
			modifiedDateTime?: string
55
			createdBy?: string
56
			modifiedBy?: string
57
		}
58
		href?: string
59
	} & {}
60
) {
61
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/general-ledger/account`)
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