0

Create a role

by
Published Oct 17, 2025

Creates a new role.

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 role
7
 * Creates a new role.
8
 */
9
export async function main(
10
	auth: SageIntacct,
11
	body: {
12
		key?: string
13
		id?: string
14
		href?: string
15
		description?: string
16
		roleType?: 'enterprise' | 'eConsole' | 'multiEntityDistributed' | 'multiEntityShared'
17
		applyTo?: 'loginAndSlideIn' | 'loginOnly' | 'slideInOnly'
18
		rolePermissionAssignments?: {
19
			key?: string
20
			id?: string
21
			href?: string
22
			role?: { key?: string; id?: string; href?: string }
23
			permission?: {
24
				key?: string
25
				id?: string
26
				module?:
27
					| 'accountsPayable'
28
					| 'accountsReceivable'
29
					| 'administration'
30
					| 'advancedAuditTrail'
31
					| 'aiMachineLearning'
32
					| 'avalaraTax'
33
					| 'budgets'
34
					| 'cashManagement'
35
					| 'company'
36
					| 'console'
37
					| 'consolidation'
38
					| 'construction'
39
					| 'constructionPayroll'
40
					| 'contracts'
41
					| 'customizationServices'
42
					| 'dataDeliveryService'
43
					| 'dataImport'
44
					| 'digitalBoardBook'
45
					| 'digitalNetworkSync'
46
					| 'dimensionSync'
47
					| 'dynamicAllocations'
48
					| 'externalServicesProvider'
49
					| 'fixedAssets'
50
					| 'generalLedger'
51
					| 'globalTransactionSecurity'
52
					| 'intacctCollaborate'
53
					| 'intacctSalesforceIntegration'
54
					| 'intacctSalesforceIntegrationV2'
55
					| 'interactiveCustomReportWriter'
56
					| 'interactiveVisualExplorer'
57
					| 'inventoryApplications'
58
					| 'inventoryControl'
59
					| 'managementConsole'
60
					| 'managementConsoleConsolidation'
61
					| 'msTeamsIntegration'
62
					| 'multiEntity'
63
					| 'myAccounting'
64
					| 'myClients'
65
					| 'myPractice'
66
					| 'orderEntry'
67
					| 'outboundPaymentServices'
68
					| 'outsourcedPaymentServices'
69
					| 'paymentServices'
70
					| 'projects'
71
					| 'purchasing'
72
					| 'quickbooksMigration'
73
					| 'realEstate'
74
					| 'revenueManagement'
75
					| 'saasMetrics'
76
					| 'sageCloudServices'
77
					| 'sageIntacctBudgetingAndPlanningConnector'
78
					| 'sagePeople'
79
					| 'siCollaboration'
80
					| 'siFundRaising'
81
					| 'smartTransaction'
82
					| 'spendManagement'
83
					| 'suppliesInventory'
84
					| 'taxExport'
85
					| 'taxes'
86
					| 'timeAndExpenses'
87
					| 'vendorCompliance'
88
					| 'webServices'
89
					| 'wellsFargoPaymentManager'
90
					| 'loanManagement'
91
					| 'budgetVsActual'
92
					| 'depositoryManagement'
93
				name?:
94
					| 'budgets'
95
					| 'contracts'
96
					| 'dataDeliveryService'
97
					| 'generalLedger'
98
					| 'projects'
99
					| 'taxes'
100
					| '1099Reports'
101
					| 'aatrix'
102
					| 'accessLog'
103
					| 'accountAllocationDefinitions'
104
					| 'accountAllocationGroups'
105
					| 'accountGroups'
106
					| 'accountMappingStatus'
107
					| 'accountTitleByEntity'
108
					| 'accountingEntriesFile'
109
					| 'accountingPeriods'
110
					| 'accounts'
111
					| 'accumulationTypes'
112
					| 'achBankConfigurations'
113
					| 'achFileGenerator'
114
					| 'achPaymentFile'
115
					| 'addToCheckRun'
116
					| 'adjustAccount'
117
					| 'adjustedAvailableCash'
118
					| 'adjustmentJournals'
119
					| 'adjustingJournalEntries'
120
					| 'adjustments'
121
					| 'affiliateEntityGroups'
122
					| 'aisle'
123
					| 'analysisAndReporting'
124
					| 'apAccountLabels'
125
					| 'apAdvances'
126
					| 'apBillsApprovalLevels'
127
					| 'apLedger'
128
					| 'apOpenItemsRevaluationReport'
129
					| 'apReleaseRetainage'
130
					| 'apTerms'
131
					| 'applicationAdministration'
132
					| 'applicationSetup'
133
					| 'applicationSubscriptions'
134
					| 'applyPenalties'
135
					| 'approveBills'
136
					| 'approveExpenses'
137
					| 'approveJournalEntries'
138
					| 'approvePayments'
139
					| 'approvePurchaseTransaction'
140
					| 'approveReimbursements'
141
					| 'approveTimesheets'
142
					| 'approveVendors'
143
					| 'arAccountLabelTaxGroups'
144
					| 'arAccountLabels'
145
					| 'arLedger'
146
					| 'arOpenItemsRevaluationReport'
147
					| 'arReleaseRetainage'
148
					| 'arTerms'
149
					| 'archive'
150
					| 'assignmentCategories'
151
					| 'assignmentConstraints'
152
					| 'assignmentDependents'
153
					| 'assignmentStatus'
154
					| 'assignments'
155
					| 'assuranceDocuments'
156
					| 'attachmentFolders'
157
					| 'attachments'
158
					| 'auditLog'
159
					| 'automatedTransactions'
160
					| 'bankAccounts'
161
					| 'bankCheckRegister'
162
					| 'bankFeeds'
163
					| 'bankFile'
164
					| 'bankFileGenerator'
165
					| 'bankInterestAndCharges'
166
					| 'bankTransactionAssignmentRules'
167
					| 'bankTransactionRuleSets'
168
					| 'bankTransactionRules'
169
					| 'bankTransactions'
170
					| 'billBackTemplates'
171
					| 'billingTemplate'
172
					| 'bills'
173
					| 'bin'
174
					| 'binFace'
175
					| 'binSize'
176
					| 'books'
177
					| 'buildAndDisassembleKits'
178
					| 'bulkActionRuns'
179
					| 'caDe542Report'
180
					| 'calculationMethods'
181
					| 'cancelService'
182
					| 'cashAnalysis'
183
					| 'cashBalances'
184
					| 'changeRequestStatus'
185
					| 'changeRequestTypes'
186
					| 'changeRequests'
187
					| 'chargeCardAccounts'
188
					| 'chargeCardRegister'
189
					| 'chargeCardTransactions'
190
					| 'chargePayoffs'
191
					| 'checkReconciliation'
192
					| 'checkRegister'
193
					| 'checkRun'
194
					| 'checkRunDetail'
195
					| 'checkingAccounts'
196
					| 'checklistCategories'
197
					| 'checklistItem'
198
					| 'checklistOptions'
199
					| 'checklistStatus'
200
					| 'checklists'
201
					| 'checks'
202
					| 'class'
203
					| 'classGroups'
204
					| 'clearCompanyData'
205
					| 'clients'
206
					| 'cloudStorage'
207
					| 'cmRevaluationReport'
208
					| 'companyInformationMyPractice'
209
					| 'companySetupChecklist'
210
					| 'compensationTables'
211
					| 'complianceRecords'
212
					| 'complianceSetup'
213
					| 'consolidateStructure'
214
					| 'consolidateSubsidiaryData'
215
					| 'constructionReporting'
216
					| 'contactTaxGroup'
217
					| 'contacts'
218
					| 'contract'
219
					| 'contractBillingTemplate'
220
					| 'contractComplianceChecklist'
221
					| 'contractComplianceTaskItem'
222
					| 'contractExpenseTemplate'
223
					| 'contractGroups'
224
					| 'contractMEAPriceList'
225
					| 'contractPriceList'
226
					| 'contractRevenueTemplate'
227
					| 'contractTypes'
228
					| 'contributions'
229
					| 'costCodeOverrides'
230
					| 'costTypeGroups'
231
					| 'costTypes'
232
					| 'costingChanges'
233
					| 'coverLetters'
234
					| 'creditCardChargesAndOtherFees'
235
					| 'customApplicationsWithUserDefinedDimensions'
236
					| 'customReports'
237
					| 'customerAgingReportsGraphs'
238
					| 'customerBacklog'
239
					| 'customerBankAccounts'
240
					| 'customerCardAccounts'
241
					| 'customerGLGroups'
242
					| 'customerGroups'
243
					| 'customerListReport'
244
					| 'customerReconciliation'
245
					| 'customerTypes'
246
					| 'customers'
247
					| 'cycleCounts'
248
					| 'dashboard'
249
					| 'datevDataExport'
250
					| 'deferredRevenueDetails'
251
					| 'deferredRevenueForecast'
252
					| 'deferredRevenueForecastGraph'
253
					| 'deferredRevenueRevaluationReport'
254
					| 'departmentActivityReport'
255
					| 'departmentGroups'
256
					| 'departmentMappingStatus'
257
					| 'departments'
258
					| 'deposits'
259
					| 'depositsRegister'
260
					| 'documentNumbering'
261
					| 'drillDownToAllTransactionsFromReports'
262
					| 'dunningLevels'
263
					| 'earningTypes'
264
					| 'electronicReceipts'
265
					| 'emailDeliveryLog'
266
					| 'emailTemplates'
267
					| 'employeeAgingReportsGraphs'
268
					| 'employeeGroups'
269
					| 'employeeOutOfOffice'
270
					| 'employeePositions'
271
					| 'employeeRates'
272
					| 'employeeTypes'
273
					| 'employees'
274
					| 'entities'
275
					| 'entity'
276
					| 'estimateTypes'
277
					| 'evergreenTemplates'
278
					| 'exchangeRate'
279
					| 'exchangeRateTypes'
280
					| 'executiveSummary'
281
					| 'expenseAdjustments'
282
					| 'expenseApprovalLevels'
283
					| 'expenseLedger'
284
					| 'expensePaymentTypes'
285
					| 'expenseSummaries'
286
					| 'expenseTypes'
287
					| 'exportClientTaxData'
288
					| 'extendedGeneralLedger'
289
					| 'externalAuthorizations'
290
					| 'fairValuePriceListEntry'
291
					| 'fairValuePriceLists'
292
					| 'financialInstitution'
293
					| 'financials'
294
					| 'form1099'
295
					| 'fulfillment'
296
					| 'fundsTransfers'
297
					| 'gaapAdjustingEntries'
298
					| 'gaapAdjustmentJournals'
299
					| 'ganttChart'
300
					| 'generalLedgerRevaluationReport'
301
					| 'generateAllocation'
302
					| 'generateInvoices'
303
					| 'generateLateCharges'
304
					| 'generateReceipt'
305
					| 'generateScheduledCharges'
306
					| 'goBDDataExport'
307
					| 'glAccountId'
308
					| 'glMatching'
309
					| 'glMatchingActivity'
310
					| 'grantAdminRights'
311
					| 'graphs'
312
					| 'hourTypes'
313
					| 'imports'
314
					| 'initialOpenItems'
315
					| 'interEntityAccountMapping'
316
					| 'interactiveAccountGroups'
317
					| 'interactiveCustomReports'
318
					| 'interactiveDataVisualizationReports'
319
					| 'interactiveReportAreas'
320
					| 'interactiveReportsMasterConsumerRole'
321
					| 'interEntityTransactions'
322
					| 'inventoryAnalysis'
323
					| 'inventoryControlSetup'
324
					| 'inventoryCosting'
325
					| 'inventoryCycles'
326
					| 'inventoryFulfillment'
327
					| 'inventoryJournal'
328
					| 'inventoryRecurring'
329
					| 'inventoryRegister'
330
					| 'inventoryReorders'
331
					| 'inventorySelfHelp'
332
					| 'inventoryStatus'
333
					| 'inventoryTotals'
334
					| 'inventoryTransactionDefinitions'
335
					| 'inventoryTransactions'
336
					| 'inventoryValuation'
337
					| 'invoicePolicies'
338
					| 'invoices'
339
					| 'itemActivity'
340
					| 'itemGLGroups'
341
					| 'itemGroups'
342
					| 'itemProfitability'
343
					| 'itemTaxGroups'
344
					| 'items'
345
					| 'jobs'
346
					| 'journalActivityReport'
347
					| 'journalEntries'
348
					| 'journalEntryMappingLink'
349
					| 'journals'
350
					| 'kitAnalysis'
351
					| 'laborClasses'
352
					| 'laborShifts'
353
					| 'laborUnions'
354
					| 'landedCostAdjustment'
355
					| 'landedCostsCategory'
356
					| 'leases'
357
					| 'linkSubsidiaries'
358
					| 'loanTypes'
359
					| 'loans'
360
					| 'locationActivityReport'
361
					| 'locationGroups'
362
					| 'locationMappingStatus'
363
					| 'locations'
364
					| 'lotCategory'
365
					| 'lotTracking'
366
					| 'maintainInventoryValuation'
367
					| 'manageBooks'
368
					| 'manageContributions'
369
					| 'managementFees'
370
					| 'managePayments'
371
					| 'managePlan'
372
					| 'manageResourceSchedules'
373
					| 'manageSchedules'
374
					| 'manageSupplies'
375
					| 'manageTimesheets'
376
					| 'managersAndBrokers'
377
					| 'manualPayment'
378
					| 'meaAllocation'
379
					| 'memorizedReportGroups'
380
					| 'memorizedReports'
381
					| 'messages'
382
					| 'multiCurrencyProcessing'
383
					| 'myExpenses'
384
					| 'myTimesheets'
385
					| 'notes'
386
					| 'offlineJobQueue'
387
					| 'opsbidBills'
388
					| 'orderAnalysis'
389
					| 'orderEntrySetup'
390
					| 'orderEntryStatus'
391
					| 'orderEntryTransactionDefinitions'
392
					| 'orderEntryTransactions'
393
					| 'otherReceipts'
394
					| 'ownerDistribution'
395
					| 'ownerInformation'
396
					| 'ownershipStructure'
397
					| 'partnerSyncEvents'
398
					| 'payBills'
399
					| 'payGroups'
400
					| 'payInAdvance'
401
					| 'paymentAccountInformation'
402
					| 'paymentDefaults'
403
					| 'paymentExchangeRateInformation'
404
					| 'paymentManagerPayments'
405
					| 'paymentRequests'
406
					| 'payments'
407
					| 'payrollReportCheck'
408
					| 'payrollReportCheckSummary'
409
					| 'payrollReportGrossPay'
410
					| 'payrollReportPayModifier'
411
					| 'payrollReportPtoActivity'
412
					| 'payrollReportTax'
413
					| 'payrollReportTaxSetup'
414
					| 'payrollReportTimecard'
415
					| 'payrollReportTimecardReport'
416
					| 'pendingReimbursements'
417
					| 'period'
418
					| 'periodMappingStatus'
419
					| 'physicalInventory'
420
					| 'pickEngagements'
421
					| 'pickList'
422
					| 'pickingList'
423
					| 'planStatement'
424
					| 'poTransactionDefinitions'
425
					| 'positionsAndSkills'
426
					| 'postExpenseReports'
427
					| 'postScheduledTransactions'
428
					| 'postTemplates'
429
					| 'postedAdvances'
430
					| 'postedPayments'
431
					| 'postedReimbursements'
432
					| 'preparerSignoff'
433
					| 'priceListEntry'
434
					| 'priceLists'
435
					| 'priceSchedules'
436
					| 'printChecks'
437
					| 'printEMailDocuments'
438
					| 'printEMailDunningNotice'
439
					| 'printEMailInvoices'
440
					| 'printEMailStatements'
441
					| 'printPaymentCopies'
442
					| 'printedDocumentTemplates'
443
					| 'priorPeriodCogsAdjustments'
444
					| 'processContractSchedules'
445
					| 'productLine'
446
					| 'productLines'
447
					| 'projectChangeOrders'
448
					| 'projectContractRateTables'
449
					| 'projectContractTypes'
450
					| 'projectContracts'
451
					| 'projectDetailReporting'
452
					| 'projectEstimates'
453
					| 'projectGroups'
454
					| 'projectResources'
455
					| 'projectStatus'
456
					| 'projectTransactions'
457
					| 'projectTypes'
458
					| 'properties'
459
					| 'ptoAccrualSchedules'
460
					| 'ptoTypes'
461
					| 'purchasePriceVarianceInvoicePriceVariance'
462
					| 'purchasingAnalysis'
463
					| 'purchasingApprovalLevels'
464
					| 'purchasingRecurring'
465
					| 'purchasingSetup'
466
					| 'purchasingTransaction'
467
					| 'purchasingTransactions'
468
					| 'quickCheckEntry'
469
					| 'quickDeposits'
470
					| 'receiptHistory'
471
					| 'receiptsRegister'
472
					| 'receiveAdvances'
473
					| 'reclassificationReport'
474
					| 'reconcileBank'
475
					| 'reconcileCreditCard'
476
					| 'recoveryTemplates'
477
					| 'recurringAllocations'
478
					| 'recurringBills'
479
					| 'recurringInvoices'
480
					| 'recurringJournalEntries'
481
					| 'recurringSchedules'
482
					| 'recurringStatisticalJournalEntries'
483
					| 'recurringTransactionForecast'
484
					| 'recurringTransactionStatus'
485
					| 'recurringTransactions'
486
					| 'releaseToPay'
487
					| 'renewalTemplates'
488
					| 'renewalsForecast'
489
					| 'replenishInventory'
490
					| 'replenishmentFluctuatingForecasts'
491
					| 'reporting'
492
					| 'reportingAccounts'
493
					| 'reportingAccountsMappingReport'
494
					| 'reportingPeriods'
495
					| 'requestSupplies'
496
					| 'restrictionRelease'
497
					| 'revenueRecognitionCategory'
498
					| 'revenueRecognitionSchedule'
499
					| 'revenueRecognitionTemplate'
500
					| 'reverseConversions'
501
					| 'reviewNote'
502
					| 'reviewerSignoff'
503
					| 'row'
504
					| 'ruleSetPerformanceLog'
505
					| 'runConsolidations'
506
					| 'saasChangeType'
507
					| 'saasSchedule'
508
					| 'saasScheduleEntry'
509
					| 'salesAnalysis'
510
					| 'salesRecurring'
511
					| 'salesTaxReport'
512
					| 'salesforceSyncJobs'
513
					| 'salesforceSynchronizationReport'
514
					| 'salesforceSynchronizationStatus'
515
					| 'sandbox'
516
					| 'savingsAccounts'
517
					| 'selectToReimburse'
518
					| 'sendgridEmailDeliveryLog'
519
					| 'serialMask'
520
					| 'serialTracking'
521
					| 'serviceAuthorizations'
522
					| 'sharedLimits'
523
					| 'shipmentHistory'
524
					| 'shippingMethods'
525
					| 'smartEventJobs'
526
					| 'spendInsight'
527
					| 'staffTimesheets'
528
					| 'standardCostTypes'
529
					| 'standardTasks'
530
					| 'statisticalAccountId'
531
					| 'statisticalAccountMappingStatus'
532
					| 'statisticalAccounts'
533
					| 'statisticalAdjustingJournals'
534
					| 'statisticalAdjustingJournalEntries'
535
					| 'statisticalJournalEntries'
536
					| 'statisticalJournals'
537
					| 'subledgerAndScmCombinedObjects'
538
					| 'subledgerDocument'
539
					| 'subscriptionUsage'
540
					| 'subsidiaryAccounts'
541
					| 'subsidiaryDepartments'
542
					| 'subsidiaryLocations'
543
					| 'subsidiaryReportingPeriods'
544
					| 'subsidiaryStatisticalAccounts'
545
					| 'summaries'
546
					| 'switchToConsole'
547
					| 'switchToManagementConsole'
548
					| 'switchToMyAccounting'
549
					| 'systemPayModifiers'
550
					| 't5018ReportForCanada'
551
					| 'taskGroups'
552
					| 'taskResources'
553
					| 'taskTypes'
554
					| 'tasks'
555
					| 'taxAdjustingEntries'
556
					| 'taxAdjustmentJournals'
557
					| 'taxAuthority'
558
					| 'taxDetail'
559
					| 'taxReciprocity'
560
					| 'taxRecords'
561
					| 'taxDetailBox'
562
					| 'taxReport'
563
					| 'taxSchedule'
564
					| 'taxScheduleMap'
565
					| 'taxSolutions'
566
					| 'taxSubmissions'
567
					| 'taxablePaymentsAnnualReport'
568
					| 'taxesLink'
569
					| 'templates'
570
					| 'tenants'
571
					| 'tenantConfiguration'
572
					| 'territories'
573
					| 'territoryGroups'
574
					| 'timePreferences'
575
					| 'timeSources'
576
					| 'timeTypes'
577
					| 'timeCards'
578
					| 'timesheetRules'
579
					| 'trades'
580
					| 'transactionAllocations'
581
					| 'transactionCurrencies'
582
					| 'transactionRule'
583
					| 'transactionTemplates'
584
					| 'trialBalance'
585
					| 'triggerLogs'
586
					| 'unions'
587
					| 'units'
588
					| 'unitsOfMeasure'
589
					| 'usageAndMetrics'
590
					| 'userDefinedBooks'
591
					| 'userDefinedJournalEntries'
592
					| 'userDefinedJournals'
593
					| 'users'
594
					| 'vendorAgingReportsGraphs'
595
					| 'vendorException'
596
					| 'vendorGLGroups'
597
					| 'vendorGroups'
598
					| 'vendorInsuranceReport'
599
					| 'vendorReconciliation'
600
					| 'vendorTypes'
601
					| 'vendors'
602
					| 'viewAllocationLog'
603
					| 'viewMyClients'
604
					| 'viewMyServiceAuthorizations'
605
					| 'warehouseGroups'
606
					| 'warehouseTransfer'
607
					| 'wipManagement'
608
					| 'warehouses'
609
					| 'zone'
610
					| 'preferences'
611
					| 'managementCompanies'
612
					| 'billPercentageRent'
613
					| 'salesEntry'
614
					| 'leaseRenewal'
615
					| 'expenseRecovery'
616
					| 'reconcileCharges'
617
					| 'reports'
618
					| 'configuration'
619
					| 'refunds'
620
					| 'budgetVariance'
621
					| 'revenueTxnEntries'
622
					| 'payrollReportEmployee'
623
					| 'payrollReportTrade'
624
					| 'payrollReportPTOAccrualSchedule'
625
					| 'glDynamicAccountReclassificationReport'
626
				href?: string
627
			}
628
			accessRights?:
629
				| 'ach'
630
				| 'achSetup'
631
				| 'add'
632
				| 'addExpense'
633
				| 'apiProxy'
634
				| 'approvalLevel1'
635
				| 'approvalLevel2'
636
				| 'approvalLevel3'
637
				| 'approvalLevel4'
638
				| 'approvalLevel5'
639
				| 'approvalLevel6'
640
				| 'authorize'
641
				| 'cancel'
642
				| 'calendar'
643
				| 'clone'
644
				| 'close'
645
				| 'config'
646
				| 'confirm'
647
				| 'delete'
648
				| 'deleteExpense'
649
				| 'edit'
650
				| 'editExpense'
651
				| 'enable'
652
				| 'export'
653
				| 'final'
654
				| 'financial'
655
				| 'group'
656
				| 'ignore'
657
				| 'import'
658
				| 'impersonate'
659
				| 'level1'
660
				| 'level2'
661
				| 'level3'
662
				| 'level4'
663
				| 'level5'
664
				| 'level6'
665
				| 'list'
666
				| 'listExpenses'
667
				| 'manualMatch'
668
				| 'mapAccount'
669
				| 'menu'
670
				| 'modify'
671
				| 'offsetAccount'
672
				| 'open'
673
				| 'overrideException'
674
				| 'permission'
675
				| 'post'
676
				| 'print'
677
				| 'readonly'
678
				| 'readonlyExpense'
679
				| 'receipts'
680
				| 'reclass'
681
				| 'reclassExpense'
682
				| 'reconcile'
683
				| 'refresh'
684
				| 'release'
685
				| 'reopen'
686
				| 'report'
687
				| 'resend'
688
				| 'reversalEdit'
689
				| 'reverse'
690
				| 'reverseExpense'
691
				| 'run'
692
				| 'statutoryReportingPeriod'
693
				| 'submit'
694
				| 'subscribe'
695
				| 'template'
696
				| 'uncancel'
697
				| 'unmask'
698
				| 'upload'
699
				| 'view'
700
				| 'viewAll'
701
				| 'void'[]
702
			audit?: {
703
				createdDateTime?: string
704
				modifiedDateTime?: string
705
				createdBy?: string
706
				modifiedBy?: string
707
			}
708
		}[]
709
		roleUsers?: {
710
			key?: string
711
			id?: string
712
			href?: string
713
			role?: { key?: string; id?: string; href?: string }
714
			user?: { key?: string; id?: string; href?: string }
715
			audit?: {
716
				createdDateTime?: string
717
				modifiedDateTime?: string
718
				createdBy?: string
719
				modifiedBy?: string
720
			}
721
		}[]
722
		roleGroups?: {
723
			key?: string
724
			id?: string
725
			href?: string
726
			role?: { key?: string; id?: string; href?: string }
727
			userGroup?: { key?: string; id?: string; href?: string }
728
			audit?: {
729
				createdDateTime?: string
730
				modifiedDateTime?: string
731
				createdBy?: string
732
				modifiedBy?: string
733
			}
734
		}[]
735
		audit?: {
736
			createdDateTime?: string
737
			modifiedDateTime?: string
738
			createdBy?: string
739
			modifiedBy?: string
740
		}
741
	} & {}
742
) {
743
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/company-config/role`)
744

745
	const response = await fetch(url, {
746
		method: 'POST',
747
		headers: {
748
			'Content-Type': 'application/json',
749
			Authorization: 'Bearer ' + auth.token
750
		},
751
		body: JSON.stringify(body)
752
	})
753
	if (!response.ok) {
754
		const text = await response.text()
755
		throw new Error(`${response.status} ${text}`)
756
	}
757
	return await response.json()
758
}
759