0

Create a project type

by
Published Oct 17, 2025

Creates a new project type. Permissions and other requirements SubscriptionProjects Basic Project Tracking and General Ledger User typeBusiness, Project Manager PermissionsAdd Project Type

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

9

10
Permissions and other requirements
11

12
SubscriptionProjects Basic Project Tracking and General Ledger
13
User typeBusiness, Project Manager
14
PermissionsAdd Project Type
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
		parent?: { key?: string; id?: string; href?: string }
27
		status?: 'active' | 'inactive'
28
		entity?: { key?: string; id?: string; name?: string; href?: string }
29
		audit?: {
30
			createdDateTime?: string
31
			modifiedDateTime?: string
32
			createdBy?: string
33
			modifiedBy?: string
34
		}
35
	} & {}
36
) {
37
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/projects/project-type`)
38

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