Skip to main content

📁 Files API (NEW)

The new Files API provides comprehensive file management capabilities with better organization and additional features.

Upload Files

POST /api/v1/files/upload
  • Upload files for processing with automatic document type detection
  • Supports PDF, JPG, JPEG, PNG formats
  • Maximum 50 files per request, 10MB per file
  • Maintains backward compatibility with existing upload endpoint
Request:
Response:

List Files

GET /api/v1/files
  • Retrieve paginated list of uploaded files
  • Support filtering by type and status
  • Exclude deleted files by default
Parameters:
  • page: Page number (default: 1)
  • page_size: Items per page (default: 20, max: 100)
  • type: Filter by document type (invoice, bank_statement, etc.)
  • status: Filter by status (pending, processing, completed, failed, deleted)
Request:
Response:

Get File Information

GET /api/v1/files/{file_id}
  • Retrieve detailed information about a specific file
  • Includes metadata, processing status, and validation results
Request:
Response:

Download File

GET /api/v1/files/{file_id}/download
  • Download the original file content
  • Preserves original filename and content type
  • Streams file efficiently without loading into memory
Request:
Response Headers:

Delete File

DELETE /api/v1/files/{file_id}
  • Permanently delete a file from the system
  • File is completely removed from the system
  • Cannot be undone - use with caution
Request:
Response:

Files API Features

  • 🔐 Security: All endpoints validate user ownership - users can only access their own files
  • 📄 Pagination: Efficient pagination with configurable page sizes
  • 🔍 Filtering: Filter by document type, status, or other criteria
  • 📱 Original Filenames: Preserves and extracts original filenames from storage
  • 🗑️ Delete: Files are permanently deleted from the system
  • ⬇️ Direct Download: Stream file content with proper headers and content disposition
  • 🔄 Backward Compatible: Legacy upload endpoint remains functional