Overview
The Upload Attachment endpoint allows you to attach a single file to an expense record. This is essential for maintaining proper documentation, compliance with tax regulations, and audit trails. Expenses support one attachment at a time - uploading a new file replaces the previous one.Security Note: Files undergo multiple validation checks including MIME type verification and content validation to ensure security.
Each expense supports only one attachment. Uploading a new file will replace the existing attachment.
Path Parameters
The CzUid of the expense to attach the file to
Request Body
This endpoint usesmultipart/form-data
encoding for file uploads:
The file to upload. See supported file types below.
Supported File Types
Files are validated at multiple levels:
- Extension validation
- MIME type verification
- Content header validation (e.g., PDFs must start with %PDF)
File Size Limits
Response
Information about the uploaded attachment
Success message confirming the upload
File Storage and Security
Storage Location
Files are stored securely on the server with:- Organized structure:
galleries/expenses/{firm_id}/{year}/{month}/
- Unique filenames: Generated to prevent conflicts and enhance security
- Access control: Only accessible to authorized users of the owning firm
Security Measures
- File validation: Content type verification beyond extension checking
- Virus scanning: Files may be scanned for malware (implementation dependent)
- Access logging: Download access is logged for audit purposes
- Firm isolation: Attachments are strictly isolated per firm
Integration with Expense Workflow
Automatic Attachment Detection
When retrieving expenses, attachments are automatically detected:Document Management
Attachments become part of the expense’s permanent record:- Audit trail: Preserved for compliance and audit requirements
- Version control: Multiple attachments can be added to an expense
- Integration: Can be referenced in reports and exports
Common Use Cases
Invoice Documentation
Receipt Management
Supporting Documentation
Best Practices
File Organization
- Naming conventions: Use descriptive filenames that identify the expense
- File types: Prefer PDF for official documents, JPEG/PNG for photos
- File sizes: Optimize images to reduce file size while maintaining readability
- Descriptions: Always include meaningful descriptions for better organization
Upload Workflow
- Validation: Check file type and size before uploading
- Progress indicators: Show upload progress for large files
- Error handling: Implement proper error handling and user feedback
- Backup strategy: Consider keeping local copies of important documents
Security Considerations
- File scanning: Scan uploaded files for malware before processing
- Access control: Ensure only authorized users can upload attachments
- Data privacy: Be mindful of sensitive information in uploaded files
- Retention policies: Establish policies for how long attachments are kept
Integration Tips
- Bulk uploads: For multiple files, upload them sequentially to avoid overwhelming the server
- Mobile optimization: Optimize upload process for mobile devices with potentially slower connections
- Automated uploads: Consider automated workflows that upload documents from email or document management systems
- Thumbnail generation: For images, consider generating thumbnails for better UI experience
Authorizations
Use your API key (sk_live_xxx or sk_test_xxx)
Path Parameters
Expense CzUid
Body
multipart/form-data
PDF or image file (max 10MB)