Permanently delete a video template from your Pictory account using its unique identifier. This action removes the template and all its configuration data, including scene structures, variables, and settings.
This action is permanent and cannot be undone. Once deleted, the template and all its configuration will be permanently removed from your account. Videos already created from this template will not be affected.
You need a valid API key to use this endpoint. Get your API key from the API Access page in your Pictory dashboard.
Permanent Deletion: Deleted templates cannot be recovered. Ensure you have backups of template configurations before deleting.
Before deleting a template, consider using the Get Template By Id endpoint to retrieve and back up the complete template configuration for archival purposes.
Existing Videos: Videos that were already created from this template will continue to exist and function normally. Only the template itself is deleted.
Permission Requirements: You can only delete templates that belong to your account or team. Attempting to delete templates from other accounts will result in a 403 Forbidden error.
import requestsdef delete_deprecated_templates(api_key, dry_run=True): """ Delete all deprecated templates """ headers = {"Authorization": api_key} # Get all templates list_url = "https://api.pictory.ai/pictoryapis/v1/templates" response = requests.get(list_url, headers=headers) templates = response.json().get('items', []) # Find deprecated templates deprecated_templates = [ t for t in templates if t.get('depricated') or t.get('deprecated') ] print(f"Found {len(deprecated_templates)} deprecated templates") if dry_run: print("DRY RUN - Templates that would be deleted:") for template in deprecated_templates: print(f" - {template.get('name', 'Unknown')} (ID: {template['templateId']})") return # Delete deprecated templates deleted_count = 0 for template in deprecated_templates: delete_url = f"https://api.pictory.ai/pictoryapis/v1/templates/{template['templateId']}" delete_response = requests.delete(delete_url, headers=headers) if delete_response.status_code in [200, 204]: print(f"✓ Deleted: {template.get('name', 'Unknown')}") deleted_count += 1 else: print(f"✗ Failed: {template.get('name', 'Unknown')}") print(f"\nDeleted {deleted_count} out of {len(deprecated_templates)} deprecated templates")# Example usage - dry run firstdelete_deprecated_templates("YOUR_API_KEY", dry_run=True)# Then execute for real# delete_deprecated_templates("YOUR_API_KEY", dry_run=False)
import requestsdef delete_unpublished_templates(api_key, confirm=False): """ Delete all unpublished (draft) templates """ headers = {"Authorization": api_key} # Get all templates list_url = "https://api.pictory.ai/pictoryapis/v1/templates" response = requests.get(list_url, headers=headers) templates = response.json().get('items', []) # Find unpublished templates unpublished = [t for t in templates if not t.get('published')] print(f"Found {len(unpublished)} unpublished templates") if not unpublished: print("No unpublished templates to delete") return # List templates for i, template in enumerate(unpublished, 1): print(f"{i}. {template.get('name', 'Unknown')} (ID: {template['templateId']})") if not confirm: print("\nSet confirm=True to delete these templates") return # Delete templates deleted_count = 0 for template in unpublished: delete_url = f"https://api.pictory.ai/pictoryapis/v1/templates/{template['templateId']}" delete_response = requests.delete(delete_url, headers=headers) if delete_response.status_code in [200, 204]: print(f"✓ Deleted: {template.get('name', 'Unknown')}") deleted_count += 1 else: print(f"✗ Failed: {template.get('name', 'Unknown')}") print(f"\nDeleted {deleted_count} out of {len(unpublished)} unpublished templates")# Example usagedelete_unpublished_templates("YOUR_API_KEY", confirm=False)