0

Create a project estimate type

by
Published Oct 17, 2025

Creates a new project estimate type. Permissions and other requirements SubscriptionProject Costing and Billing User typeBusiness, Employee, Project Manager PermissionsAdd Estimate 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 project estimate type
7
 * Creates a new project estimate type.
8

9

10
Permissions and other requirements
11

12
SubscriptionProject Costing and Billing
13
User typeBusiness, Employee, Project Manager
14
PermissionsAdd Estimate 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
		workflowTypes?:
27
			| 'original'
28
			| 'revision'
29
			| 'forecast'
30
			| 'approvedChange'
31
			| 'pendingChange'
32
			| 'other'[]
33
		estimateCategory?:
34
			| 'currentEstimate'
35
			| 'originalEstimate'
36
			| 'currentForecastAtCompletion'
37
			| 'historicalForecastAtCompletion'
38
			| 'futureForecastAtCompletion'
39
			| 'currentForecastToCompletion'
40
			| 'historicalForecastToCompletion'
41
			| 'futureForecastToCompletion'
42
		status?: 'active' | 'inactive'
43
		audit?: {
44
			createdDateTime?: string
45
			modifiedDateTime?: string
46
			createdBy?: string
47
			modifiedBy?: string
48
		}
49
	} & {}
50
) {
51
	const url = new URL(
52
		`https://api.intacct.com/ia/api/v1/objects/construction/project-estimate-type`
53
	)
54

55
	const response = await fetch(url, {
56
		method: 'POST',
57
		headers: {
58
			'Content-Type': 'application/json',
59
			Authorization: 'Bearer ' + auth.token
60
		},
61
		body: JSON.stringify(body)
62
	})
63
	if (!response.ok) {
64
		const text = await response.text()
65
		throw new Error(`${response.status} ${text}`)
66
	}
67
	return await response.json()
68
}
69