0

Create a vendor

by
Published Oct 17, 2025

Creates a new vendor. When you add a new vendor, you can provide key descriptive information about that vendor and establish how you want to pay them. Permissions and other requirements SubscriptionAccounts Payable User typeBusiness PermissionsList, View, Add, Edit Vendors (Bank Details permissions required to access vendor bank account.)

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 vendor
7
 * Creates a new vendor. When you add a new vendor, you can provide key descriptive information about that vendor and establish how you want to pay them.
8

9

10
Permissions and other requirements
11

12
SubscriptionAccounts Payable
13
User typeBusiness
14
PermissionsList, View, Add, Edit Vendors (Bank Details permissions required to access vendor bank account.)
15

16

17

18

19
 */
20
export async function main(
21
	auth: SageIntacct,
22
	body: {
23
		key?: string
24
		id?: string
25
		name?: string
26
		isOneTimeUse?: false | true
27
		href?: string
28
		status?: 'active' | 'activeNonPosting' | 'inactive'
29
		state?: 's' | 'a' | 'r'
30
		vendorType?: { key?: string; id?: string; href?: string }
31
		parent?: { key?: string; id?: string; name?: string; href?: string }
32
		accountGroup?: { key?: string; id?: string; href?: string }
33
		accountlabel?: { key?: string; id?: string; href?: string }
34
		defaultLeadTime?: number
35
		filePaymentService?: 'ach' | 'bankFile' | 'none'
36
		bankFiles?: {
37
			paymentCountryCode?:
38
				| 'us'
39
				| 'af'
40
				| 'ax'
41
				| 'al'
42
				| 'dz'
43
				| 'as'
44
				| 'ad'
45
				| 'ao'
46
				| 'ai'
47
				| 'aq'
48
				| 'ag'
49
				| 'ar'
50
				| 'am'
51
				| 'aw'
52
				| 'au'
53
				| 'at'
54
				| 'az'
55
				| 'bs'
56
				| 'bh'
57
				| 'bd'
58
				| 'bb'
59
				| 'by'
60
				| 'be'
61
				| 'bz'
62
				| 'bj'
63
				| 'bm'
64
				| 'bt'
65
				| 'bo'
66
				| 'bq'
67
				| 'ba'
68
				| 'bw'
69
				| 'bv'
70
				| 'br'
71
				| 'io'
72
				| 'bn'
73
				| 'bg'
74
				| 'bf'
75
				| 'bi'
76
				| 'kh'
77
				| 'cm'
78
				| 'ca'
79
				| 'cv'
80
				| 'ky'
81
				| 'cf'
82
				| 'td'
83
				| 'cl'
84
				| 'cn'
85
				| 'cx'
86
				| 'cc'
87
				| 'co'
88
				| 'km'
89
				| 'cg'
90
				| 'cd'
91
				| 'ck'
92
				| 'cr'
93
				| 'ci'
94
				| 'hr'
95
				| 'cu'
96
				| 'cw'
97
				| 'cy'
98
				| 'cz'
99
				| 'dk'
100
				| 'dj'
101
				| 'dm'
102
				| 'do'
103
				| 'ec'
104
				| 'eg'
105
				| 'sv'
106
				| 'gq'
107
				| 'er'
108
				| 'ee'
109
				| 'sz'
110
				| 'et'
111
				| 'fk'
112
				| 'fo'
113
				| 'fj'
114
				| 'fi'
115
				| 'fr'
116
				| 'gf'
117
				| 'pf'
118
				| 'tf'
119
				| 'ga'
120
				| 'gm'
121
				| 'ge'
122
				| 'de'
123
				| 'gh'
124
				| 'gi'
125
				| 'gr'
126
				| 'gl'
127
				| 'gd'
128
				| 'gp'
129
				| 'gu'
130
				| 'gt'
131
				| 'gg'
132
				| 'gn'
133
				| 'gw'
134
				| 'gy'
135
				| 'ht'
136
				| 'hm'
137
				| 'hn'
138
				| 'hk'
139
				| 'hu'
140
				| 'is'
141
				| 'in'
142
				| 'id'
143
				| 'ir'
144
				| 'iq'
145
				| 'ie'
146
				| 'im'
147
				| 'il'
148
				| 'it'
149
				| 'jm'
150
				| 'jp'
151
				| 'je'
152
				| 'jo'
153
				| 'kz'
154
				| 'ke'
155
				| 'ki'
156
				| 'kr'
157
				| 'kp'
158
				| 'xk'
159
				| 'kw'
160
				| 'kg'
161
				| 'la'
162
				| 'lv'
163
				| 'lb'
164
				| 'ls'
165
				| 'lr'
166
				| 'ly'
167
				| 'li'
168
				| 'lt'
169
				| 'lu'
170
				| 'mo'
171
				| 'mk'
172
				| 'mg'
173
				| 'mw'
174
				| 'my'
175
				| 'mv'
176
				| 'ml'
177
				| 'mt'
178
				| 'mh'
179
				| 'mq'
180
				| 'mr'
181
				| 'mu'
182
				| 'yt'
183
				| 'mx'
184
				| 'fm'
185
				| 'md'
186
				| 'mc'
187
				| 'mn'
188
				| 'me'
189
				| 'ms'
190
				| 'ma'
191
				| 'mz'
192
				| 'mm'
193
				| 'na'
194
				| 'nr'
195
				| 'np'
196
				| 'nl'
197
				| 'an'
198
				| 'nc'
199
				| 'nz'
200
				| 'ni'
201
				| 'ne'
202
				| 'ng'
203
				| 'nu'
204
				| 'nf'
205
				| 'mp'
206
				| 'no'
207
				| 'om'
208
				| 'pk'
209
				| 'pw'
210
				| 'ps'
211
				| 'pa'
212
				| 'pg'
213
				| 'py'
214
				| 'pe'
215
				| 'ph'
216
				| 'pn'
217
				| 'pl'
218
				| 'pt'
219
				| 'pr'
220
				| 'qa'
221
				| 're'
222
				| 'ro'
223
				| 'ru'
224
				| 'rw'
225
				| 'bl'
226
				| 'sh'
227
				| 'kn'
228
				| 'lc'
229
				| 'mf'
230
				| 'pm'
231
				| 'vc'
232
				| 'ws'
233
				| 'sm'
234
				| 'st'
235
				| 'sa'
236
				| 'sn'
237
				| 'rs'
238
				| 'sc'
239
				| 'sl'
240
				| 'sg'
241
				| 'sx'
242
				| 'sk'
243
				| 'si'
244
				| 'sb'
245
				| 'so'
246
				| 'za'
247
				| 'gs'
248
				| 'es'
249
				| 'lk'
250
				| 'sd'
251
				| 'ss'
252
				| 'sr'
253
				| 'sj'
254
				| 'se'
255
				| 'ch'
256
				| 'sy'
257
				| 'tw'
258
				| 'tj'
259
				| 'tz'
260
				| 'th'
261
				| 'tl'
262
				| 'tg'
263
				| 'tk'
264
				| 'to'
265
				| 'tt'
266
				| 'tn'
267
				| 'tr'
268
				| 'tm'
269
				| 'tc'
270
				| 'tv'
271
				| 'ug'
272
				| 'ua'
273
				| 'ae'
274
				| 'gb'
275
				| 'um'
276
				| 'uy'
277
				| 'uz'
278
				| 'vu'
279
				| 'va'
280
				| 've'
281
				| 'vn'
282
				| 'vg'
283
				| 'vi'
284
				| 'wf'
285
				| 'eh'
286
				| 'ye'
287
				| 'zm'
288
				| 'zw'
289
			paymentCurrency?: string
290
		}
291
		taxId?: string
292
		tpar?: { isTparEnabled?: false | true; name?: string }
293
		t5018?: { isT5018Enabled?: false | true; t5018Number?: string }
294
		form1099?: {
295
			is1099Eligible?: false | true
296
			nameOn1099?: string
297
			type?: string
298
			box?: string
299
		}
300
		attachment?: { key?: string; id?: string; href?: string }
301
		isOnHold?: false | true
302
		doNotPay?: false | true
303
		alwaysCreateBill?: false | true
304
		creditLimit?: number
305
		retainagePercentage?: number
306
		notes?: string
307
		priceList?: { key?: string; id?: string; href?: string }
308
		priceSchedule?: { key?: string; id?: string; href?: string }
309
		overrideOffsetGLAccount?: {
310
			key?: string
311
			id?: string
312
			name?: string
313
			href?: string
314
		}
315
		defaultExpenseGLAccount?: {
316
			key?: string
317
			id?: string
318
			name?: string
319
			href?: string
320
		}
321
		discountPercent?: number
322
		contacts?: {
323
			default?: {
324
				key?: string
325
				id?: string
326
				href?: string
327
				lastName?: string
328
				firstName?: string
329
				middleName?: string
330
				prefix?: string
331
				printAs?: string
332
				email1?: string
333
				email2?: string
334
				phone1?: string
335
				phone2?: string
336
				mobile?: string
337
				pager?: string
338
				fax?: string
339
				URL1?: string
340
				URL2?: string
341
				companyName?: string
342
				mailingAddress?: {
343
					addressLine1?: string
344
					addressLine2?: string
345
					addressLine3?: string
346
					city?: string
347
					state?: string
348
					postCode?: string
349
					country?: string
350
				}
351
			} & {
352
				hideContactList?: false | true
353
				tax?: {
354
					isTaxable?: false | true
355
					group?: { key?: string; id?: string; href?: string }
356
				}
357
				electronicInvoiceDetails?: {
358
					legalCategory?: string
359
					mainActivity?: string
360
					typeOfCompany?: string
361
					registeredCapital?: number
362
					valueAddedTaxRegime?: string
363
				}
364
				internationalTaxId?: string
365
			}
366
			primary?: { key?: string; id?: string; href?: string }
367
			payTo?: { key?: string; id?: string; href?: string }
368
			returnTo?: { key?: string; id?: string; href?: string }
369
			recipient1099?: { key?: string; id?: string; href?: string }
370
		}
371
		contactList?: {
372
			key?: string
373
			id?: string
374
			href?: string
375
			categoryName?: string
376
			contact?: { key?: string; id?: string; href?: string }
377
			audit?: {
378
				createdDateTime?: string
379
				modifiedDateTime?: string
380
				createdBy?: string
381
				modifiedBy?: string
382
			}
383
			vendor?: { key?: string; id?: string; href?: string }
384
		}[]
385
		vendorEmailTemplates?: {
386
			key?: string
387
			id?: string
388
			href?: string
389
			vendor?: { key?: string; id?: string; href?: string }
390
			txnDefinitionName?: string
391
			emailTemplate?: {
392
				key?: string
393
				id?: string
394
				name?: string
395
				href?: string
396
			}
397
		}[]
398
		vendorPaymentProviders?: {
399
			key?: string
400
			id?: string
401
			href?: string
402
			paymentProvider?: {
403
				key?: string
404
				id?: string
405
				name?: string
406
				href?: string
407
			}
408
			vendor?: { key?: string; id?: string; name?: string; href?: string }
409
			state?:
410
				| 'requestInitiated'
411
				| 'inProgress'
412
				| 'requestReceived'
413
				| 'requestFailed'
414
				| 'awaitingAuthorization'
415
				| 'subscribed'
416
				| 'canceled'
417
				| 'suspended'
418
			preferredPaymentMethod?: {
419
				key?: string
420
				id?: string
421
				name?: string
422
				href?: string
423
			}
424
			status?: 'active' | 'inactive'
425
			audit?: {
426
				createdDateTime?: string
427
				modifiedDateTime?: string
428
				createdBy?: string
429
				modifiedBy?: string
430
			}
431
		}[]
432
		vendorBankFileSetup?: {
433
			key?: string
434
			id?: string
435
			bankAccountNumber?: string
436
			bankAccountName?: string
437
			bsbNumber?: string
438
			sortCode?: string
439
			paymentReference?: string
440
			branchCode?: string
441
			bankAccountType?: string
442
			bankAccountCode?: string
443
			printPaymentProof?: false | true
444
			businessIdCode?: string
445
			creditorCode?: string
446
			secondaryIdentifier?: string
447
			vendor?: { key?: string; id?: string; href?: string }
448
			href?: string
449
		}[]
450
		vendorAccountNumberList?: {
451
			key?: string
452
			id?: string
453
			location?: { key?: string; id?: string; name?: string; href?: string }
454
			vendorAccountNumber?: string
455
			href?: string
456
			vendor?: { key?: string; id?: string; href?: string }
457
		}[]
458
		preferredPaymentMethod?:
459
			| 'printedCheck'
460
			| 'chargeCard'
461
			| 'EFT'
462
			| 'cash'
463
			| 'ACH'
464
			| 'wellsFargoCheck'
465
			| 'wellsFargoUSDWire'
466
			| 'wellsFargoDomesticACH'
467
		mergePaymentRequests?: false | true
468
		sendPaymentNotification?: false | true
469
		billingType?: 'openItem' | 'balanceForward'
470
		paymentPriority?: 'urgent' | 'high' | 'normal' | 'low'
471
		currency?: string
472
		displayTermDiscountOnCheckStub?: false | true
473
		term?: { key?: string; id?: string; href?: string }
474
		billPayment?: {
475
			defaultDateOptions?: 'none' | 'dueDate' | 'billDate' | 'discountDate'
476
			offsetTypePlusMinus?: '+' | '-'
477
			dueNumberOfDays?: number
478
			billNumberOfDays?: number
479
		}
480
		vendorAccountNumber?: string
481
		displayVendorAccountOnCheckStub?: false | true
482
		totalDue?: string
483
		lastBillCreatedDate?: string
484
		lastPaymentMadeDate?: string
485
		ach?: {
486
			enablePayments?: false | true
487
			routingNumber?: string
488
			accountNumber?: string
489
			accountType?: 'checkingAccount' | 'savingsAccount'
490
			remittanceType?: 'businessCTX' | 'personalPPD' | 'businessCCD'
491
		}
492
		vendorRestriction?: 'unrestricted' | 'rootOnly' | 'restricted'
493
		restrictedLocations?: {
494
			key?: string
495
			id?: string
496
			href?: string
497
			location?: { key?: string; id?: string; href?: string }
498
			locationGroup?: { key?: string; id?: string; href?: string }
499
			vendor?: { key?: string; id?: string; href?: string }
500
		}[]
501
		restrictedDepartments?: {
502
			key?: string
503
			id?: string
504
			href?: string
505
			department?: { key?: string; id?: string; href?: string }
506
			departmentGroup?: { key?: string; id?: string; href?: string }
507
			vendor?: { key?: string; id?: string; href?: string }
508
		}[]
509
		audit?: {
510
			createdDateTime?: string
511
			modifiedDateTime?: string
512
			createdBy?: string
513
			modifiedBy?: string
514
		}
515
		entity?: { key?: string; id?: string; name?: string; href?: string }
516
	} & {}
517
) {
518
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/accounts-payable/vendor`)
519

520
	const response = await fetch(url, {
521
		method: 'POST',
522
		headers: {
523
			'Content-Type': 'application/json',
524
			Authorization: 'Bearer ' + auth.token
525
		},
526
		body: JSON.stringify(body)
527
	})
528
	if (!response.ok) {
529
		const text = await response.text()
530
		throw new Error(`${response.status} ${text}`)
531
	}
532
	return await response.json()
533
}
534