Skip to main content

Overview

The AttachmentsAPI provides methods to upload files and attach them to transactions. This is useful for adding receipts, invoices, and other supporting documents. All attachment operations are accessed through the client.attachments property.

Methods

upload()

Upload a file and attach it to a transaction.
Parameters:
  • transaction_id: The unique transaction identifier
  • file_name: Name of the file (e.g., “receipt.jpg”)
  • file_type: MIME type (e.g., “image/jpeg”, “application/pdf”)
  • file_data: The file content as bytes
Returns: Attachment - The uploaded attachment object Example:

deregister()

Remove an attachment from a transaction.
Parameters:
  • attachment_id: The unique attachment identifier
Returns: dict - Removal confirmation Example:

File Upload Examples

Receipt Management System

Create a comprehensive receipt management system:

Document Classification

Automatically classify and organize uploaded documents:

Attachment Analytics

Analyze attachment usage patterns:

Best Practices

  1. File size limits: Keep files under 10MB for optimal upload performance
  2. Supported formats: Use common formats (JPEG, PNG, PDF) for best compatibility
  3. Meaningful names: Use descriptive file names that help identify the content
  4. Error handling: Always wrap upload operations in try/catch blocks
  5. Privacy: Avoid uploading sensitive personal information unnecessarily
  6. Organization: Develop a consistent naming convention for uploaded files
The Attachments API enables comprehensive document management for transactions, supporting receipt organization, expense reporting, and financial record keeping.