Overview
The File Management APIs provide comprehensive functionality for handling file uploads, storage management, avatar processing, and document operations across the TalentG platform using Supabase Storage.Base URL
Authentication
File operations require authentication. Some endpoints have additional permission checks.File Upload
Upload Avatar
Upload General File
Avatar Management
Get User Avatar
Update Avatar URL
Reset Avatar Cache
Invalidate Avatar Cache
File Storage Management
Sync Avatar URLs
Clear Google Avatar Cache
Ensure Storage Bucket
Apply Storage Policies
Document Processing
Generate PDF (Already documented in Assessments API)
The PDF generation endpoint is documented in the Assessments API section.Test PDF Generation (Already documented in Assessments API)
The PDF test endpoint is documented in the Assessments API section.File Type Support
Supported Image Formats
- PNG: Portable Network Graphics
- JPG/JPEG: Joint Photographic Experts Group
- WebP: Web Picture format
- GIF: Graphics Interchange Format (for avatars)
File Size Limits
- Avatars: 5MB maximum
- General uploads: 10MB maximum
- PDF documents: 25MB maximum
Image Processing
- Automatic resizing for avatars (200x200px)
- Format optimization
- Quality compression
- EXIF data stripping for privacy
Storage Organization
Bucket Structure
File Naming Convention
- Avatars:
avatar.{timestamp}.{ext}oravatar.{ext} - PDFs:
assessment_{id}_{timestamp}.pdf - General files:
{original_name}_{timestamp}.{ext}
Error Handling
Common Error Codes
| Code | HTTP Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | User not authenticated |
FILE_TOO_LARGE | 413 | File exceeds size limit |
INVALID_FILE_TYPE | 400 | Unsupported file format |
STORAGE_ERROR | 500 | Storage service error |
UPLOAD_FAILED | 500 | File upload failed |
Error Response Format
Rate Limiting
- Avatar uploads: 10 uploads per hour per user
- File uploads: 50 uploads per hour per user
- Metadata requests: 200 requests per hour per user
- Admin operations: 100 requests per hour per user
SDK Examples
Security Considerations
File Validation
- Server-side file type validation
- Content analysis for malicious files
- Size limits enforcement
- Path traversal protection
Access Control
- User-scoped file access
- Signed URLs for temporary access
- CORS policy enforcement
- Rate limiting by user and IP
Privacy Protection
- EXIF data removal from images
- Secure file URLs with expiration
- Access logging for audit trails
- GDPR compliance for user data
Storage Security
- Encrypted storage at rest
- Secure bucket policies
- Regular security audits
- Backup and recovery procedures
Never expose direct storage URLs in client-side code. Always use API endpoints to generate signed or temporary access URLs.
All uploaded files are automatically processed for optimization, security scanning, and format conversion to ensure consistent quality and safety.