# Upload Profile Image Upload a profile image directly from a file. Supports multiple formats with automatic WebP conversion and multi-size generation. ## Request Body **`file`** file required Image file to upload (multipart/form-data). ## Supported Formats - JPEG/JPG - PNG (including transparency) - WebP - GIF ## Automatic Processing - **Validation**: File type, size (10MB max), corruption check - **Conversion**: All images converted to WebP format - **Multi-size**: Generates 3 versions: - Thumbnail: 150x150px - Medium: 500x500px - Full: 1200x1200px - **Storage**: GCS bucket `freddy-profile-images` (Europe region) - **Update**: Auto-updates user's `profile_image` field ## Returns URLs for all generated image sizes (thumbnail, medium, full) in WebP format. All images are publicly accessible via GCS. Direct Upload ```bash curl -X POST \ "https://api.aitronos.com/v1/user/profile/image" \ -H "X-API-Key: $FREDDY_API_KEY" \ -F "file=@profile.jpg" ``` ```python import requests with open("profile.jpg", "rb") as f: response = requests.post( "https://api.aitronos.com/v1/user/profile/image", headers={"Authorization": f"Bearer {FREDDY_API_KEY}"}, files={"file": f} ) urls = response.json()["urls"] print(f"Thumbnail: {urls['thumbnail']}") ``` ```javascript const formData = new FormData(); formData.append('file', fileInput.files[0]); const response = await fetch('https://api.aitronos.com/v1/user/profile/image', { method: 'POST', headers: { 'Authorization': `Bearer ${FREDDY_API_KEY}` }, body: formData }); const data = await response.json(); console.log('Thumbnail:', data.urls.thumbnail); ``` **Response:** 200 OK ```json { "success": true, "message": "Profile image uploaded successfully", "urls": { "thumbnail": "https://storage.googleapis.com/freddy-profile-images/profile-images/usr_123e4567e89b12d3a456426614174000/abc123_thumbnail.webp", "medium": "https://storage.googleapis.com/freddy-profile-images/profile-images/usr_123e4567e89b12d3a456426614174000/abc123_medium.webp", "full": "https://storage.googleapis.com/freddy-profile-images/profile-images/usr_123e4567e89b12d3a456426614174000/abc123_full.webp" } } ``` 401 Unauthorized ```json { "success": false, "error": { "code": "AUTHENTICATION_REQUIRED", "message": "Authentication required to access this resource", "system_message": "Authentication required", "type": "client_error", "status": 401, "trace_id": "trace_abc123", "timestamp": "2025-11-13T10:30:00Z" } } ``` 422 Validation Error ```json { "success": false, "error": { "code": "INVALID_FILE_TYPE", "message": "Invalid file type. Supported formats: JPEG, PNG, WebP, GIF", "system_message": "File validation failed", "type": "client_error", "status": 422, "trace_id": "trace_abc123", "timestamp": "2025-11-13T10:30:00Z", "details": { "max_size": "10MB", "supported_formats": ["jpeg", "jpg", "png", "webp", "gif"] } } } ```