0

Update a role

by
Published Oct 17, 2025

Updates an existing role by setting field values. Any fields not provided remain unchanged.

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

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