Vendors
TheVendorService (client.vendors) manages supplier records used for expense categorization and bill management. Operations are available at both the user level (across all businesses) and the business level.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Complete reference for the VendorService in the Smartbills JavaScript SDK, CRUD, batch operations, merge, and CSV import.
VendorService (client.vendors) manages supplier records used for expense categorization and bill management. Operations are available at both the user level (across all businesses) and the business level.
const { data: vendors, pagination } = await client.vendors.list({
page: 1,
limit: 50,
});
const vendor = await client.vendors.getById(vendorId);
console.log(vendor.name, vendor.email);
const vendor = await client.vendors.create({
name: 'Acme Supplies',
email: '[email protected]',
});
const updated = await client.vendors.update(vendorId, {
name: 'Acme Supplies Inc.',
phone: '555-0123',
});
const deleted = await client.vendors.delete(vendorId);
const updated = await client.vendors.uploadLogo(vendorId, logoFile);
const { data: vendors } = await client.vendors.listBusiness({
limit: 100,
});
const vendor = await client.vendors.getBusinessVendor(vendorId);
const vendor = await client.vendors.createBusiness({
name: 'Office Depot',
category: 'Office Supplies',
});
const updated = await client.vendors.updateBusiness(vendorId, {
name: 'Office Depot (Main)',
});
const deleted = await client.vendors.deleteBusiness(vendorId);
await client.vendors.refreshBusiness(vendorId);
const updated = await client.vendors.uploadBusinessLogo(vendorId, logoFile);
const vendors = await client.vendors.batchCreate([
{ name: 'Vendor A' },
{ name: 'Vendor B' },
{ name: 'Vendor C' },
]);
console.log(`Created ${vendors.length} vendors`);
const updated = await client.vendors.batchUpdate([
{ id: 1, name: 'Vendor A (Updated)' },
{ id: 2, category: 'Consulting' },
]);
const result = await client.vendors.bulkDelete({
vendorIds: [10, 11, 12],
});
console.log(`Deleted: ${result.succeeded}, Failed: ${result.failed}`);
const merged = await client.vendors.merge({
targetVendorId: 1,
sourceVendorIds: [2, 3, 4],
});
console.log(`Merged into vendor: ${merged.name}`);
const result = await client.vendors.importCsv(csvFile);
console.log(`Imported: ${result.created}, Errors: ${result.errors?.length}`);
const templateBlob = await client.vendors.downloadImportTemplate();
| Method | Parameters | Returns |
|---|---|---|
list | params?, options? | SBListResponse<SBVendor> |
getById | id, options? | SBVendor |
create | data, options? | SBVendor |
update | id, data, options? | SBVendor |
delete | id, options? | SBVendor |
listBusiness | params?, options? | SBListResponse<SBVendor> |
getBusinessVendor | vendorId, options? | SBVendor |
createBusiness | data, options? | SBVendor |
updateBusiness | vendorId, data, options? | SBVendor |
deleteBusiness | vendorId, options? | SBVendor |
refreshBusiness | vendorId, options? | void |
batchCreate | data[], options? | SBVendor[] |
batchUpdate | data[], options? | SBVendor[] |
bulkDelete | data, options? | SBVendorBulkActionResponse |
merge | data, options? | SBVendor |
importCsv | file, options? | SBVendorImportResult |
downloadImportTemplate | options? | Blob |
uploadLogo | vendorId, file, options? | SBVendor |
uploadBusinessLogo | vendorId, file, options? | SBVendor |
Was this page helpful?