Documents Overview
The Documents API enables uploading, storing, and retrieving documents attached to various banking entities such as clients, loans, deposits, and insurance policies. Files are stored in MinIO object storage with metadata tracked in the database.
Base Endpoint
POST /api/core/cmd
Available Commands
Commands
- Create Document (Upload) - Upload and attach documents to entities
Queries
- Retrieve Documents List - Get paginated list of all documents
- Retrieve Client Documents - Get all documents for a client
- Retrieve Loan Documents - Get all documents for a loan
- Retrieve Deposit Documents - Get all documents for a deposit
- Retrieve Policy Documents - Get all documents for an insurance policy
Key Features
- Multi-Entity Support: Attach documents to clients, loans, deposits, and policies
- MinIO Storage: Scalable, secure object storage backend
- Metadata Tracking: Track document types, expiry dates, and upload history
- File Organization: Automatic organization by entity type and ID
- Base64 Encoding: Simple file upload via base64-encoded content
- Search & Filter: Find documents by entity, date, type, or content
Document Types (Examples)
| Value | Description |
|---|---|
| 1 | National ID |
| 2 | Passport |
| 3 | Driver's License |
| 4 | Utility Bill |
| 5 | Bank Statement |
| 6 | Contract |
| 7 | Other |
Storage Architecture
File Organization
documents/
├── clients/{clientId}/
├── loans/{loanId}/
├── deposits/{depositId}/
└── policies/{policyId}/
Supported File Types
| Category | Extensions | Max Size |
|---|---|---|
| Documents | PDF, DOC, DOCX | 10 MB |
| Images | PNG, JPG, JPEG, GIF | 5 MB |
| Spreadsheets | XLS, XLSX, CSV | 10 MB |
| Archives | ZIP, RAR | 20 MB |
Best Practices
- Standardize File Names: Use clear, consistent naming conventions
- Add Descriptions: Include meaningful descriptions for easy identification
- Set Expiry Dates: Always set expiry dates for time-sensitive documents
- Document Type Consistency: Use standardized document types
- Regular Audits: Periodically review and purge obsolete documents
- Optimize File Sizes: Compress large files before upload
- Batch Operations: Use export functionality for bulk retrieval