0

Create a statistical journal

by
Published Oct 17, 2025

Creates a new statistical journal Permissions and other requirements SubscriptionGeneral Ledger User typeBusiness PermissionsAdd Statistical Journals

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 a statistical journal
7
 * Creates a new statistical journal
8

9

10
Permissions and other requirements
11

12
SubscriptionGeneral Ledger
13
User typeBusiness
14
PermissionsAdd Statistical Journals
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
		bookId?: string
27
		bookType?: 'accrual' | 'cash' | 'cashAndAccrual' | 'consolidation'
28
		disallowDirectPosting?: false | true
29
		status?: 'active' | 'inactive'
30
		audit?: {
31
			createdDateTime?: string
32
			modifiedDateTime?: string
33
			createdBy?: string
34
			modifiedBy?: string
35
		}
36
		href?: string
37
	} & {}
38
) {
39
	const url = new URL(
40
		`https://api.intacct.com/ia/api/v1/objects/general-ledger/statistical-journal`
41
	)
42

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