Skip to main content

File Uploads

The Smartbills SDK supports two upload patterns: direct FormData uploads and presigned URL uploads for large files. Both patterns are available for expenses, bills, and vendor logos.

FormData uploads

The simplest approach, construct a FormData object and pass it to the upload method. The SDK handles multipart encoding and content-type headers automatically.

Upload expense receipts

Upload in Node.js

Upload scopes

Different upload methods scope the created expenses to different contexts:

Upload bill documents

Validation before upload

Validate files without creating expense or bill records. Useful for client-side checks before committing:

Presigned URL uploads

For large files or when you want to upload directly to cloud storage (bypassing the API server), use the presigned upload flow.

How it works

  1. Presign: request a presigned upload URL from the API
  2. Upload: upload the file directly to the presigned URL
  3. Confirm: notify the API that the upload is complete

Step-by-step example

Employee-scoped presigned uploads

Vendor logo uploads

Upload logos for vendor records:

Downloading files

Download expense attachments

Download bill attachments

Download vendor import template

Exporting data

Export endpoints return Blob objects that can be saved or streamed:

Saving to disk in Node.js

Triggering download in the browser

Supported file types