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 aFormData 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
- Presign: request a presigned upload URL from the API
- Upload: upload the file directly to the presigned URL
- 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 returnBlob objects that can be saved or streamed: