Files
ux_aura_assistant/References/api_storage.json
2026-03-25 01:21:37 +05:30

1 line
26 KiB
JSON

{"openapi":"3.0.0","info":{"title":"Auth SecureChat API","version":"1.0.0","description":"API for authentication with SecureChat using AnythingLLM"},"servers":[{"url":"/api/r2-explorer","description":"API Base Path"}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"API key for authorization (Priority 1)"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer token for authorization (Priority 2)"},"CookieAuth":{"type":"apiKey","in":"cookie","name":"auth","description":"Encrypted auth cookie for authorization (Priority 3). Provides user context for personalized operations."},"StudioCookieAuth":{"type":"apiKey","in":"header","name":"X-Studio-Cookie","description":"Encrypted auth cookie passed via X-Studio-Cookie header (Priority 3, alternative to Cookie). Provides user context for personalized operations."},"StudioCookieQueryAuth":{"type":"apiKey","in":"query","name":"X-Studio-Cookie","description":"Encrypted auth cookie passed via X-Studio-Cookie query parameter (Priority 3, alternative to Cookie/Header). Provides user context for personalized operations."}}},"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]},{"StudioCookieQueryAuth":[]}],"paths":{"/health":{"get":{"summary":"Health check endpoint","description":"Returns the status of the API","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"responses":{"200":{"description":"API is running","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"ok"},"message":{"type":"string","example":"Auth SecureChat API is running"},"version":{"type":"string","example":"1.0.0"}}}}}}}}},"/auth/validate":{"get":{"summary":"Validate authentication token (GET)","description":"Validates the auth token parameter via query parameter","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"auth","in":"query","description":"Authentication token","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Authentication successful","content":{"application/json":{"schema":{"type":"object","properties":{"firstname":{"type":"string","example":"John"},"lastname":{"type":"string","example":"Doe"},"email":{"type":"string","example":"john.doe@example.com"}}}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Authentication failed"}}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Authentication failed"}}}}}}}},"post":{"summary":"Validate authentication token (POST)","description":"Validates the auth token parameter via request body","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["auth"],"properties":{"auth":{"type":"string","description":"Authentication token"}}}}}},"responses":{"200":{"description":"Authentication successful","content":{"application/json":{"schema":{"type":"object","properties":{"firstname":{"type":"string","example":"John"},"lastname":{"type":"string","example":"Doe"},"email":{"type":"string","example":"john.doe@example.com"}}}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Authentication failed"}}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Authentication failed"}}}}}}}}},"/auth/decrypt-and-save":{"post":{"summary":"Decrypt auth token and save user data to database","description":"Decrypts the provided auth token and saves the user data to the D1 database","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["auth"],"properties":{"auth":{"type":"string","description":"Authentication token to decrypt"}}}}}},"responses":{"200":{"description":"User data successfully saved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string","example":"User data saved successfully"},"updated":{"type":"boolean","example":false},"uid":{"type":"string","example":"426bcea5-adb9-4580-a8ca-3a40fdb0ef85"},"userData":{"type":"object","properties":{"uid":{"type":"string","example":"426bcea5-adb9-4580-a8ca-3a40fdb0ef85"},"email":{"type":"string","example":"humanizeiq@eteaminc.com"},"firebase_uid":{"type":"string","example":"wFyjGE1j8wclXayUvPbkF4c15f92"},"firstname":{"type":"string","example":"Rajeev"},"lastname":{"type":"string","example":"Borborah"},"company_name":{"type":"string","nullable":true,"example":null}}}}}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Invalid auth parameter"}}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Failed to save user data"}}}}}}}}},"/upload":{"post":{"summary":"Upload file to R2 bucket","description":"Uploads a file to R2 bucket with path structure /data/<uid>/Documents/<Category>/<Date>/<filename>. Requires authentication (API key, Bearer token, or auth cookie). Note: An auth cookie is required to identify the user (uid) for path construction. If using API key/Bearer token, you must also provide an auth cookie (via Cookie header, X-Studio-Cookie header, or X-Studio-Cookie query parameter).","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]},{"StudioCookieQueryAuth":[]}],"parameters":[{"name":"X-Studio-Cookie","in":"query","required":false,"schema":{"type":"string"},"description":"Encrypted auth cookie for user identification (alternative to Cookie/Header)","example":"base64-encoded-cookie-value"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"File to upload"},"metadata":{"type":"string","description":"JSON string containing metadata key/value pairs. Can include \"category\" field to specify file category. If category is not provided, it will be derived from file extension.","example":"{\"category\": \"Reports\", \"project\": \"Q4-2024\", \"author\": \"John Doe\"}"}}}}}},"responses":{"200":{"description":"File uploaded successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string","example":"File uploaded successfully"},"path":{"type":"string","example":"data/426bcea5-adb9-4580-a8ca-3a40fdb0ef85/Documents/PDF/2025-10-14/document.pdf"},"category":{"type":"string","example":"PDF"},"metadata":{"type":"object","example":{"category":"PDF","uploadDate":"2025-10-14T20:30:00.000Z","uid":"426bcea5-adb9-4580-a8ca-3a40fdb0ef85","project":"Q4-2024","author":"John Doe"}}}}}}},"400":{"description":"Bad request - missing file or invalid metadata","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"No file provided or invalid file format"}}}}}},"401":{"description":"Unauthorized - missing or invalid auth cookie","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"No auth cookie found"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Failed to upload file"},"details":{"type":"string","example":"Error message details"}}}}}}}}},"/upload-generic":{"post":{"summary":"Generic system upload to R2 (no user auth cookie)","description":"Uploads a file to the R2 bucket using the same path logic as the regular /upload endpoint. Company, department, and user-specific behavior are derived from metadata instead of a user auth cookie. The request must be multipart/form-data with a file field and an optional metadata JSON string. Use the metadata fields \"company\"/\"company_name\"/\"companyName\" to control the company folder, \"department\"/\"Department\" for department, and \"user-specific\" (true/false) for user-specific vs shared paths.","tags":["Generic"],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"File to upload"},"metadata":{"type":"string","description":"JSON string containing metadata key/value pairs. Should include company/department/user-specific to control path, and may include call_id, candidate_id, candidate_email, job_id, job_ref, etc.","example":"{\"uid\": \"system-generic\", \"company\": \"eTeam Inc\", \"Department\": \"Recruiting\", \"user-specific\": false, \"category\": \"AIInterviewReports\", \"call_id\": \"call_19913980616786_1763719874597\", \"candidate_id\": \"12345\", \"candidate_email\": \"candidate@example.com\", \"job_id\": \"26045639\", \"job_ref\": \"23-01265\"}"}}}}}},"responses":{"200":{"description":"File uploaded successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string","example":"File uploaded successfully"},"path":{"type":"string","example":"eTeam Inc/departments/Recruiting/AIInterviewReports/2025-11-21/ai-summary-19745031817153-1761908089711.md"},"category":{"type":"string","example":"AIInterviewReports"},"metadata":{"type":"object","description":"Final metadata stored with the object in R2"},"user":{"type":"object","properties":{"uid":{"type":"string","example":"system-generic"},"email":{"type":"string","example":"candidate@example.com"}}},"savedIn":{"type":"string","example":"company"}}}}}},"400":{"description":"Bad request - missing file or invalid metadata JSON","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Invalid metadata format. Must be valid JSON."},"details":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Failed to upload file"},"details":{"type":"string","example":"Error message details"}}}}}}}}},"/files":{"get":{"summary":"List user files in tree format","description":"Retrieves all files for the authenticated user, optionally filtered by category. Returns files organized in a tree structure by category and date. Requires auth cookie (via Cookie header or X-Studio-Cookie header) for user identification.","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]},{"StudioCookieQueryAuth":[]}],"parameters":[{"name":"category","in":"query","required":false,"schema":{"type":"string"},"description":"Filter files by category (e.g., \"PDF\", \"Images\", \"Documents\"). If not provided, returns all files.","example":"PDF"},{"name":"X-Studio-Cookie","in":"query","required":false,"schema":{"type":"string"},"description":"Encrypted auth cookie for user identification (alternative to Cookie/Header)","example":"base64-encoded-cookie-value"}],"responses":{"200":{"description":"Files retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"uid":{"type":"string","example":"426bcea5-adb9-4580-a8ca-3a40fdb0ef85"},"category":{"type":"string","example":"PDF"},"totalFiles":{"type":"integer","example":5},"tree":{"type":"object","description":"Tree structure organized by category and date","example":{"PDF":{"2025-10-14":[{"fileId":"ZGF0YS80MjZiY2VhNS1hZGI5LTQ1ODAtYThjYS0zYTQwZmRiMGVmODUvRG9jdW1lbnRzL1BERi8yMDI1LTEwLTE0L2RvY3VtZW50LnBkZg==","name":"document.pdf","path":"data/426bcea5-adb9-4580-a8ca-3a40fdb0ef85/Documents/PDF/2025-10-14/document.pdf","size":1048576,"uploaded":"2025-10-14T20:30:00.000Z","etag":"abc123def456","httpMetadata":{"contentType":"application/pdf"},"customMetadata":{"category":"PDF","uploadDate":"2025-10-14T20:30:00.000Z","uid":"426bcea5-adb9-4580-a8ca-3a40fdb0ef85","fileName":"document.pdf","fileSize":"1048576","uploadTimestamp":"1729028400000"}}],"2025-10-13":[{"fileId":"ZGF0YS80MjZiY2VhNS1hZGI5LTQ1ODAtYThjYS0zYTQwZmRiMGVmODUvRG9jdW1lbnRzL1BERi8yMDI1LTEwLTEzL3JlcG9ydC5wZGY=","name":"report.pdf","path":"data/426bcea5-adb9-4580-a8ca-3a40fdb0ef85/Documents/PDF/2025-10-13/report.pdf","size":2097152,"uploaded":"2025-10-13T15:20:00.000Z","etag":"xyz789abc012","httpMetadata":{"contentType":"application/pdf"},"customMetadata":{"category":"PDF","uploadDate":"2025-10-13T15:20:00.000Z","uid":"426bcea5-adb9-4580-a8ca-3a40fdb0ef85","fileName":"report.pdf","fileSize":"2097152","uploadTimestamp":"1728842400000"}}]}}}}}}}},"400":{"description":"Bad request - missing auth cookie","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Auth cookie required"},"message":{"type":"string","example":"User identification required via auth cookie"}}}}}},"401":{"description":"Unauthorized - invalid or expired auth cookie","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Invalid or expired auth cookie"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Failed to list files"},"details":{"type":"string","example":"Error message details"}}}}}}}}},"/files-by-department":{"get":{"summary":"List files by department","description":"Retrieves all files for a specific department, organized by category. Supports optional category filtering.","tags":["Files"],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]},{"StudioCookieQueryAuth":[]}],"parameters":[{"name":"department","in":"query","required":true,"schema":{"type":"string"},"description":"Department name to retrieve files from"},{"name":"category","in":"query","required":false,"schema":{"type":"string"},"description":"Optional category filter (e.g., \"PDF\", \"Documents\", \"Images\")"},{"name":"X-Studio-Cookie","in":"query","required":false,"schema":{"type":"string"},"description":"Base64 encoded auth cookie (alternative to header or cookie)"}],"responses":{"200":{"description":"Successfully retrieved department files","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"company":{"type":"string","example":"acme-corp"},"department":{"type":"string","example":"engineering"},"category":{"type":"string","example":"all"},"totalFiles":{"type":"integer","example":15},"tree":{"type":"object","description":"Files organized by category","additionalProperties":{"type":"array","items":{"type":"object","properties":{"fileId":{"type":"string","description":"Base64 encoded file identifier"},"name":{"type":"string","example":"report.pdf"},"path":{"type":"string","example":"acme-corp/engineering/PDF/report.pdf"},"size":{"type":"integer","example":1024000},"uploaded":{"type":"string","format":"date-time"},"etag":{"type":"string"},"httpMetadata":{"type":"object"},"customMetadata":{"type":"object"}}}},"example":{"PDF":[{"fileId":"YWNtZS1jb3JwL2VuZ2luZWVyaW5nL1BERi9yZXBvcnQucGRm","name":"report.pdf","path":"acme-corp/engineering/PDF/report.pdf","size":1024000,"uploaded":"2024-01-15T10:30:00.000Z"}],"Documents":[{"fileId":"YWNtZS1jb3JwL2VuZ2luZWVyaW5nL0RvY3VtZW50cy9zcGVjLmRvY3g=","name":"spec.docx","path":"acme-corp/engineering/Documents/spec.docx","size":512000,"uploaded":"2024-01-16T14:20:00.000Z"}]}}}}}}},"400":{"description":"Bad request - missing department parameter or not a company user","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"department parameter is required"}}}}}},"401":{"description":"Unauthorized - invalid or missing auth cookie","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Invalid or expired auth cookie"}}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Failed to list department files"},"details":{"type":"string"}}}}}}}}},"/files-by-metadata":{"post":{"summary":"Get files by metadata","description":"Retrieves files based on metadata filters using the same folder structure logic as upload. Supports filtering by department, category, and user-specific flag. Requires auth cookie for user identification.","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]},{"StudioCookieQueryAuth":[]}],"parameters":[{"name":"X-Studio-Cookie","in":"query","required":false,"schema":{"type":"string"},"description":"Encrypted auth cookie for user identification (alternative to Cookie/Header)","example":"base64-encoded-cookie-value"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"metadata":{"type":"object","properties":{"department":{"type":"string","description":"Department name (defaults to \"Everyone\" if not provided)","example":"Recruiting"},"category":{"type":"string","description":"File category (e.g., \"Resumes\", \"PDF\", \"Images\")","example":"Resumes"},"user-specific":{"type":"boolean","description":"Whether to retrieve user-specific files (defaults to true). Files without department are always user-specific.","example":true}}}},"example":{"metadata":{"department":"Recruiting","category":"Resumes","user-specific":true}}}}}},"responses":{"200":{"description":"Files retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"totalFiles":{"type":"integer","example":3},"filters":{"type":"object","properties":{"company":{"type":"string","example":"HumanizeIQ"},"department":{"type":"string","example":"Recruiting"},"category":{"type":"string","example":"Resumes"},"userSpecific":{"type":"boolean","example":true},"uid":{"type":"string","example":"7939cfe1-c6b4-4cfa-8691-ada77f011553"}}},"files":{"type":"array","items":{"type":"object","properties":{"fileId":{"type":"string","description":"Base64 encoded file path","example":"SHVtYW5pemVJUS9kZXBhcnRtZW50cy9SZWNydWl0aW5nL1Jlc3VtZXMvNzkzOWNmZTEtYzZiNC00Y2ZhLTg2OTEtYWRhNzdmMDExNTUzLzIwMjUtMTAtMjMvcmVzdW1lLnBkZg=="},"name":{"type":"string","example":"resume.pdf"},"path":{"type":"string","example":"HumanizeIQ/departments/Recruiting/Resumes/7939cfe1-c6b4-4cfa-8691-ada77f011553/2025-10-23/resume.pdf"},"size":{"type":"integer","example":524288},"uploaded":{"type":"string","format":"date-time","example":"2025-10-23T15:30:00.000Z"},"etag":{"type":"string","example":"abc123def456"},"httpMetadata":{"type":"object","properties":{"contentType":{"type":"string","example":"application/pdf"}}},"customMetadata":{"type":"object","properties":{"category":{"type":"string","example":"Resumes"},"uploadDate":{"type":"string","example":"2025-10-23T15:30:00.000Z"},"uid":{"type":"string","example":"7939cfe1-c6b4-4cfa-8691-ada77f011553"},"fileName":{"type":"string","example":"resume.pdf"},"department":{"type":"string","example":"Recruiting"}}}}}}}}}}},"400":{"description":"Bad request - missing auth cookie","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Auth cookie required"},"message":{"type":"string","example":"User identification required via auth cookie"}}}}}},"401":{"description":"Unauthorized - invalid or expired auth cookie","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Invalid or expired auth cookie"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Failed to get files by metadata"},"details":{"type":"string","example":"Error message details"}}}}}}}}},"/download-file":{"get":{"summary":"Get file contents by fileId or path","description":"Retrieves a file from R2 storage by its encoded fileId (recommended) or full path. Returns the file contents with appropriate headers including metadata. The fileId is provided in the /files endpoint response.","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]}],"parameters":[{"name":"fileId","in":"query","required":false,"schema":{"type":"string"},"description":"Base64 encoded file ID (obtained from /files endpoint)","example":"ZGF0YS80MjZiY2VhNS1hZGI5LTQ1ODAtYThjYS0zYTQwZmRiMGVmODUvRG9jdW1lbnRzL1BERi8yMDI1LTEwLTE0L2RvY3VtZW50LnBkZg=="},{"name":"path","in":"query","required":false,"schema":{"type":"string"},"description":"Full path to the file in R2 storage (alternative to fileId)","example":"data/426bcea5-adb9-4580-a8ca-3a40fdb0ef85/Documents/PDF/2025-10-14/document.pdf"}],"responses":{"200":{"description":"File retrieved successfully","headers":{"Content-Type":{"schema":{"type":"string"},"description":"MIME type of the file","example":"application/pdf"},"Content-Length":{"schema":{"type":"string"},"description":"Size of the file in bytes","example":"1048576"},"ETag":{"schema":{"type":"string"},"description":"Entity tag for the file","example":"abc123def456"},"Last-Modified":{"schema":{"type":"string"},"description":"ISO 8601 timestamp of when the file was uploaded","example":"2025-10-14T20:30:00.000Z"},"X-File-Path":{"schema":{"type":"string"},"description":"Full path of the file in R2","example":"data/426bcea5-adb9-4580-a8ca-3a40fdb0ef85/Documents/PDF/2025-10-14/document.pdf"},"X-Custom-Metadata":{"schema":{"type":"string"},"description":"JSON string of custom metadata associated with the file","example":"{\"category\":\"PDF\",\"uploadDate\":\"2025-10-14T20:30:00.000Z\",\"uid\":\"426bcea5-adb9-4580-a8ca-3a40fdb0ef85\"}"}},"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Bad request - missing fileId/path parameter or invalid fileId","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Either fileId or path parameter is required"}}}}}},"404":{"description":"File not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"File not found"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Failed to get file"},"details":{"type":"string","example":"Error message details"}}}}}}}}},"/update-file":{"put":{"summary":"Update an existing file","description":"Updates an existing file in R2 storage by replacing its content. The file is identified by fileId (recommended) or path. Optionally updates metadata while preserving existing metadata.","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]}],"parameters":[{"name":"fileId","in":"query","required":false,"schema":{"type":"string"},"description":"Base64 encoded file ID (obtained from /files endpoint)","example":"ZGF0YS80MjZiY2VhNS1hZGI5LTQ1ODAtYThjYS0zYTQwZmRiMGVmODUvRG9jdW1lbnRzL1BERi8yMDI1LTEwLTE0L2RvY3VtZW50LnBkZg=="},{"name":"path","in":"query","required":false,"schema":{"type":"string"},"description":"Full path to the file in R2 storage (alternative to fileId)","example":"data/426bcea5-adb9-4580-a8ca-3a40fdb0ef85/Documents/PDF/2025-10-14/document.pdf"}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"The new file content to replace the existing file"},"metadata":{"type":"string","description":"Optional JSON string of metadata to update (merged with existing metadata)","example":"{\"version\":\"2.0\",\"updatedBy\":\"user@example.com\"}"}}}}}},"responses":{"200":{"description":"File updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"File updated successfully"},"path":{"type":"string","example":"data/426bcea5-adb9-4580-a8ca-3a40fdb0ef85/Documents/PDF/2025-10-14/document.pdf"},"size":{"type":"integer","example":2097152},"contentType":{"type":"string","example":"application/pdf"},"metadata":{"type":"object","example":{"category":"PDF","version":"2.0","updatedBy":"user@example.com","lastModified":"2025-10-15T20:30:00.000Z"}}}}}}},"400":{"description":"Bad request - missing parameters or invalid data","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"File is required"}}}}}},"404":{"description":"File not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"File not found"},"path":{"type":"string","example":"data/426bcea5-adb9-4580-a8ca-3a40fdb0ef85/Documents/PDF/2025-10-14/document.pdf"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Failed to update file"},"details":{"type":"string","example":"Error message details"}}}}}}}}},"/delete-file":{"delete":{"tags":["Files"],"summary":"Delete a file","description":"Delete a file from R2 storage by fileId or path. Requires authentication.","parameters":[{"name":"fileId","in":"query","schema":{"type":"string"},"description":"The encoded file ID (base64 of the R2 key)"},{"name":"path","in":"query","schema":{"type":"string"},"description":"The direct path to the file in R2 (alternative to fileId)"}],"responses":{"200":{"description":"File deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string","example":"File deleted successfully"},"path":{"type":"string","example":"consumer/data/uid/Documents/test.txt"}}}}}},"400":{"description":"Bad Request - Missing or invalid parameters","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"fileId parameter is required"}}}}}},"401":{"description":"Unauthorized - Invalid or missing auth cookie"},"404":{"description":"Not Found - File does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"File not found"},"path":{"type":"string"}}}}}},"500":{"description":"Internal Server Error"}}}}}}