The Files API allows you to upload, manage, and retrieve files/assets in your Mavera workspaces. Files can include images, videos, documents, and other media that you want to use with other API features like responses, video analysis, or brand voice creation.
Direct Uploads
Upload files directly to storage using presigned URLs - no file data passes through the API server
Folder Organization
Create folders to organize files, with full CRUD operations via API
Favorites
Mark files and folders as favorites for quick access
Search
Search files and folders by name with case-insensitive matching
Toggle favorite status on files to mark them for quick access:
# Toggle favorite on a fileresult = requests.post( "https://app.mavera.io/api/v1/files/file_abc123/favorite", headers=headers).json()print(f"File is now favorite: {result['is_favorite']}")# List only favoritesfavorites = requests.get( "https://app.mavera.io/api/v1/files", headers=headers, params={"is_favorite": "true"}).json()
File uploads count against your subscription’s storage quota. You can check your current usage via the dashboard or subscription API.When you delete a file, the storage is reclaimed and your quota is updated accordingly.
The presigned URL expires after 1 hour. If upload fails, request a new URL:
def upload_with_retry(file_path, workspace_id, max_retries=3): for attempt in range(max_retries): try: # Get fresh upload URL upload_response = get_upload_url(file_path, workspace_id) # Upload to presigned URL upload_to_storage(upload_response["upload_url"], file_path) # Create record return create_file_record(upload_response, file_path) except Exception as e: if attempt == max_retries - 1: raise time.sleep(2 ** attempt) # Exponential backoff
Organize files with folders
Use folder_id to organize files logically:
# Upload to a specific folderupload_response = requests.post( "https://app.mavera.io/api/v1/files/upload-url", json={ "file_name": "report.pdf", "file_type": "application/pdf", "file_size": file_size, "workspace_id": workspace_id, "folder_id": "folder_xyz" # Optional folder })
Check storage quota before uploading
For large files, verify you have sufficient storage quota before uploading:
# The upload-url endpoint will return an error if quota would be exceededresponse = requests.post( "https://app.mavera.io/api/v1/files/upload-url", json={...})if "error" in response.json(): error = response.json()["error"] if "storage" in error["message"].lower(): print("Storage quota exceeded!")
Files API Reference
See the full API specification for Files endpoints
Folders API Reference
See the full API specification for Folders endpoints