Permanently delete a project from your Pictory account using its unique identifier. This action removes the project and all associated data, including video files, audio, subtitles, and configuration settings.
This action is permanent and cannot be undone. Once deleted, the project and all its associated files will be permanently removed from your account.
You need a valid API key to use this endpoint. Get your API key from the API Access page in your Pictory dashboard.
The unique identifier of the project to delete. Can be either a string (for v3 schema projects) or an integer (for v2 schema and earlier projects).Example: 20251222191648030d7df02f5b4054d4ca8831f1369459e25
Permanent Deletion: Deleted projects cannot be recovered. Ensure you have backups of any important project files (videos, audio, subtitles) before deleting.
Before deleting a project, consider using the Get Project By Id endpoint to retrieve and back up all project assets (video, audio, subtitle files) for archival purposes.
Permission Requirements: You can only delete projects that belong to your account or team. Attempting to delete projects from other accounts will result in a 403 Forbidden error.
from datetime import datetime, timedeltaimport requestsdef delete_old_projects(days_old, api_key, dry_run=True): """ Delete projects older than specified number of days """ headers = {"Authorization": api_key} # Get all projects list_url = "https://api.pictory.ai/pictoryapis/v2/projects" response = requests.get(list_url, headers=headers) projects = response.json().get('items', []) # Calculate cutoff date cutoff = datetime.now() - timedelta(days=days_old) # Find old projects old_projects = [] for project in projects: saved_date = datetime.fromisoformat(project['savedDate'].replace('Z', '+00:00')) if saved_date < cutoff: old_projects.append(project) print(f"Found {len(old_projects)} projects older than {days_old} days") if dry_run: print("DRY RUN - Projects that would be deleted:") for project in old_projects: print(f" - {project['name']} (saved: {project['savedDate']})") return # Delete old projects deleted_count = 0 for project in old_projects: delete_url = f"https://api.pictory.ai/pictoryapis/v2/projects/{project['id']}" delete_response = requests.delete(delete_url, headers=headers) if delete_response.json().get('success'): print(f"Deleted: {project['name']}") deleted_count += 1 else: print(f"Failed to delete: {project['name']}") print(f"Deleted {deleted_count} out of {len(old_projects)} old projects")# Example usage - dry run firstdelete_old_projects(days_old=90, api_key="YOUR_API_KEY", dry_run=True)# Then execute for real# delete_old_projects(days_old=90, api_key="YOUR_API_KEY", dry_run=False)
def delete_folder_projects(folder_id, api_key, confirm=False): """ Delete all projects within a specific folder """ headers = {"Authorization": api_key} # Get projects in folder list_url = f"https://api.pictory.ai/pictoryapis/v2/projects?folder={folder_id}" response = requests.get(list_url, headers=headers) projects = response.json().get('items', []) print(f"Found {len(projects)} projects in folder {folder_id}") if not projects: print("No projects to delete") return # List projects for i, project in enumerate(projects, 1): print(f"{i}. {project['name']} (ID: {project['id']})") if not confirm: print("\nSet confirm=True to delete these projects") return # Delete projects deleted_count = 0 for project in projects: delete_url = f"https://api.pictory.ai/pictoryapis/v2/projects/{project['id']}" delete_response = requests.delete(delete_url, headers=headers) if delete_response.json().get('success'): print(f"✓ Deleted: {project['name']}") deleted_count += 1 else: print(f"✗ Failed: {project['name']}") print(f"\nDeleted {deleted_count} out of {len(projects)} projects")# Example usagedelete_folder_projects("your-folder-id", "YOUR_API_KEY", confirm=True)