0

Create a standard cost type

by
Published Oct 17, 2025

Creates a new standard cost type. Permissions and other requirements SubscriptionProject Costing or Construction User typeBusiness, Project Manager PermissionsAdd Standard Cost 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 a standard cost type
7
 * Creates a new standard cost type.
8

9

10
Permissions and other requirements
11

12
SubscriptionProject Costing or Construction
13
User typeBusiness, Project Manager
14
PermissionsAdd Standard Cost Types
15

16

17

18

19
 */
20
export async function main(
21
	auth: SageIntacct,
22
	body: {
23
		key?: string
24
		id?: string
25
		href?: string
26
		name?: string
27
		description?: string
28
		costUnitDescription?: string
29
		status?: 'active' | 'inactive'
30
		glAccount?: { key?: string; id?: string; href?: string }
31
		accumulationType?: { key?: string; id?: string; href?: string }
32
		parent?: { key?: string; id?: string; name?: string; href?: string }
33
		item?: { key?: string; id?: string; name?: string; href?: string }
34
		audit?: {
35
			createdDateTime?: string
36
			modifiedDateTime?: string
37
			createdBy?: string
38
			modifiedBy?: string
39
		}
40
	} & {}
41
) {
42
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/construction/standard-cost-type`)
43

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