0

Create a location

by
Published Oct 17, 2025

Creates a new location. You can think of this as adding a new value to the dimension that you can use to tag transactions for reporting. Permissions and other requirements SubscriptionCompany User typeBusiness user with admin privileges PermissionsAdd Location

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 location
7
 * Creates a new location. You can think of this as adding a new value to the dimension that you can use to tag transactions for reporting.
8

9

10
Permissions and other requirements
11

12
SubscriptionCompany
13
User typeBusiness user with admin privileges
14
PermissionsAdd Location
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
		status?: 'active' | 'activeNonPosting' | 'inactive'
28
		taxId?: string
29
		startDate?: string
30
		endDate?: string
31
		contacts?: {
32
			primary?: {
33
				key?: string
34
				id?: string
35
				href?: string
36
				lastName?: string
37
				firstName?: string
38
				middleName?: string
39
				prefix?: string
40
				printAs?: string
41
				email1?: string
42
				email2?: string
43
				phone1?: string
44
				phone2?: string
45
				mobile?: string
46
				pager?: string
47
				fax?: string
48
				URL1?: string
49
				URL2?: string
50
				companyName?: string
51
				mailingAddress?: {
52
					addressLine1?: string
53
					addressLine2?: string
54
					addressLine3?: string
55
					city?: string
56
					state?: string
57
					postCode?: string
58
					country?: string
59
				}
60
			} & {}
61
			shipTo?: {
62
				key?: string
63
				id?: string
64
				href?: string
65
				lastName?: string
66
				firstName?: string
67
				middleName?: string
68
				prefix?: string
69
				printAs?: string
70
				email1?: string
71
				email2?: string
72
				phone1?: string
73
				phone2?: string
74
				mobile?: string
75
				pager?: string
76
				fax?: string
77
				URL1?: string
78
				URL2?: string
79
				companyName?: string
80
				mailingAddress?: {
81
					addressLine1?: string
82
					addressLine2?: string
83
					addressLine3?: string
84
					city?: string
85
					state?: string
86
					postCode?: string
87
					country?: string
88
				}
89
			} & {}
90
		}
91
		locationReportingTitle?: string
92
		parent?: { key?: string; id?: string; href?: string; name?: string }
93
		manager?: { key?: string; id?: string; href?: string; name?: string }
94
		audit?: {
95
			createdDateTime?: string
96
			modifiedDateTime?: string
97
			createdBy?: string
98
			modifiedBy?: string
99
		}
100
	} & {}
101
) {
102
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/company-config/location`)
103

104
	const response = await fetch(url, {
105
		method: 'POST',
106
		headers: {
107
			'Content-Type': 'application/json',
108
			Authorization: 'Bearer ' + auth.token
109
		},
110
		body: JSON.stringify(body)
111
	})
112
	if (!response.ok) {
113
		const text = await response.text()
114
		throw new Error(`${response.status} ${text}`)
115
	}
116
	return await response.json()
117
}
118