Delete Project
curl --request DELETE \
--url https://api.pictory.ai/pictoryapis/v2/projects/{projectid} \
--header 'Authorization: <authorization>'import requests
url = "https://api.pictory.ai/pictoryapis/v2/projects/{projectid}"
headers = {"Authorization": "<authorization>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: '<authorization>'}};
fetch('https://api.pictory.ai/pictoryapis/v2/projects/{projectid}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pictory.ai/pictoryapis/v2/projects/{projectid}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pictory.ai/pictoryapis/v2/projects/{projectid}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.pictory.ai/pictoryapis/v2/projects/{projectid}")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pictory.ai/pictoryapis/v2/projects/{projectid}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Project deleted successfully"
}
{
"message": "Unauthorized"
}
{
"success": false,
"message": "Project not found"
}
{
"success": false,
"message": "You do not have permission to delete this project"
}
Pictory Projects
Delete Project
Delete a specific project using its unique project ID. This action is permanent and cannot be undone.
DELETE
/
pictoryapis
/
v2
/
projects
/
{projectid}
Delete Project
curl --request DELETE \
--url https://api.pictory.ai/pictoryapis/v2/projects/{projectid} \
--header 'Authorization: <authorization>'import requests
url = "https://api.pictory.ai/pictoryapis/v2/projects/{projectid}"
headers = {"Authorization": "<authorization>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: '<authorization>'}};
fetch('https://api.pictory.ai/pictoryapis/v2/projects/{projectid}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pictory.ai/pictoryapis/v2/projects/{projectid}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pictory.ai/pictoryapis/v2/projects/{projectid}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.pictory.ai/pictoryapis/v2/projects/{projectid}")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pictory.ai/pictoryapis/v2/projects/{projectid}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Project deleted successfully"
}
{
"message": "Unauthorized"
}
{
"success": false,
"message": "Project not found"
}
{
"success": false,
"message": "You do not have permission to delete this project"
}
Overview
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.
API Endpoint
DELETE https://api.pictory.ai/pictoryapis/v2/projects/{projectid}
Request Parameters
Path Parameters
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:
20251222191648030d7df02f5b4054d4ca8831f1369459e25Headers
API key for authentication (starts with
pictai_)Authorization: YOUR_API_KEY
Response
Indicates whether the deletion was successful
Confirmation message about the deletion
Response Examples
{
"success": true,
"message": "Project deleted successfully"
}
{
"message": "Unauthorized"
}
{
"success": false,
"message": "Project not found"
}
{
"success": false,
"message": "You do not have permission to delete this project"
}
Code Examples
Replace
YOUR_API_KEY with your actual API key that starts with pictai_curl --request DELETE \
--url 'https://api.pictory.ai/pictoryapis/v2/projects/YOUR_PROJECT_ID' \
--header 'Authorization: YOUR_API_KEY' \
--header 'accept: application/json' | python -m json.tool
import requests
project_id = "20251222191648030d7df02f5b4054d4ca8831f1369459e25"
url = f"https://api.pictory.ai/pictoryapis/v2/projects/{project_id}"
headers = {
"Authorization": "YOUR_API_KEY",
"accept": "application/json"
}
response = requests.delete(url, headers=headers)
result = response.json()
if result.get('success'):
print(f"Project {project_id} deleted successfully")
else:
print(f"Failed to delete project: {result.get('message')}")
const projectId = '20251222191648030d7df02f5b4054d4ca8831f1369459e25';
const response = await fetch(
`https://api.pictory.ai/pictoryapis/v2/projects/${projectId}`,
{
method: 'DELETE',
headers: {
'Authorization': 'YOUR_API_KEY',
'accept': 'application/json'
}
}
);
const result = await response.json();
if (result.success) {
console.log(`Project ${projectId} deleted successfully`);
} else {
console.log(`Failed to delete project: ${result.message}`);
}
Usage Notes
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.
Common Use Cases
1. Delete Single Project with Confirmation
Delete a project after user confirmation:import requests
def delete_project_with_confirmation(project_id, api_key):
"""
Delete a project after confirming with the user
"""
# First, get project details
get_url = f"https://api.pictory.ai/pictoryapis/v2/projects/{project_id}"
headers = {"Authorization": api_key}
project_response = requests.get(get_url, headers=headers)
if project_response.status_code != 200:
print("Project not found")
return False
project = project_response.json()
project_name = project.get('projectName', 'Unknown')
# Confirm deletion
print(f"Are you sure you want to delete '{project_name}'? (yes/no)")
confirmation = input().strip().lower()
if confirmation != 'yes':
print("Deletion cancelled")
return False
# Delete project
delete_url = f"https://api.pictory.ai/pictoryapis/v2/projects/{project_id}"
delete_response = requests.delete(delete_url, headers=headers)
result = delete_response.json()
if result.get('success'):
print(f"Project '{project_name}' deleted successfully")
return True
else:
print(f"Failed to delete project: {result.get('message')}")
return False
# Example usage
delete_project_with_confirmation("YOUR_PROJECT_ID", "YOUR_API_KEY")
2. Bulk Delete Old Projects
Delete multiple projects based on age criteria:from datetime import datetime, timedelta
import requests
def 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 first
delete_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)
3. Delete Projects by Source Type
Delete all projects created from a specific source:async function deleteProjectsBySource(sourceType, apiKey, confirmAll = false) {
const headers = { 'Authorization': `${apiKey}` };
// Get all projects
const listResponse = await fetch(
'https://api.pictory.ai/pictoryapis/v2/projects',
{ headers }
);
const data = await listResponse.json();
// Filter by source type
const matchingProjects = data.items.filter(p => p.source === sourceType);
console.log(`Found ${matchingProjects.length} projects with source: ${sourceType}`);
if (!confirmAll) {
console.log('Set confirmAll=true to delete these projects');
return matchingProjects;
}
// Delete matching projects
const results = {
deleted: [],
failed: []
};
for (const project of matchingProjects) {
const deleteResponse = await fetch(
`https://api.pictory.ai/pictoryapis/v2/projects/${project.id}`,
{ method: 'DELETE', headers }
);
const result = await deleteResponse.json();
if (result.success) {
results.deleted.push(project.name);
console.log(`✓ Deleted: ${project.name}`);
} else {
results.failed.push(project.name);
console.log(`✗ Failed: ${project.name}`);
}
}
console.log(`\nDeleted: ${results.deleted.length}, Failed: ${results.failed.length}`);
return results;
}
// Example usage
const results = await deleteProjectsBySource('url', 'YOUR_API_KEY', true);
4. Back Up Before Delete
Back up project assets before deletion:import requests
import os
def backup_and_delete_project(project_id, api_key, backup_dir="./backups"):
"""
Backup project assets before deleting
"""
headers = {"Authorization": api_key}
# Get project details
get_url = f"https://api.pictory.ai/pictoryapis/v2/projects/{project_id}"
response = requests.get(get_url, headers=headers)
if response.status_code != 200:
print("Project not found")
return False
project = response.json()
project_name = project.get('projectName', project_id)
# Create backup directory
project_backup_dir = os.path.join(backup_dir, project_name)
os.makedirs(project_backup_dir, exist_ok=True)
print(f"Backing up project: {project_name}")
# Backup assets
assets = {
'video': project.get('videoURL'),
'audio': project.get('audioURL'),
'srt': project.get('srtFile'),
'vtt': project.get('vttFile'),
'txt': project.get('txtFile'),
'thumbnail': project.get('thumbnail')
}
backed_up = []
for asset_type, url in assets.items():
if url:
try:
file_response = requests.get(url)
extension = asset_type if asset_type in ['srt', 'vtt', 'txt'] else url.split('.')[-1].split('?')[0]
filename = f"{project_name}_{asset_type}.{extension}"
filepath = os.path.join(project_backup_dir, filename)
with open(filepath, 'wb') as f:
f.write(file_response.content)
backed_up.append(asset_type)
print(f" ✓ Backed up {asset_type}")
except Exception as e:
print(f" ✗ Failed to backup {asset_type}: {e}")
# Save project metadata
import json
metadata_path = os.path.join(project_backup_dir, "metadata.json")
with open(metadata_path, 'w') as f:
json.dump(project, f, indent=2)
print(f"Backup complete: {len(backed_up)} assets saved to {project_backup_dir}")
# Delete project
print(f"Deleting project...")
delete_url = f"https://api.pictory.ai/pictoryapis/v2/projects/{project_id}"
delete_response = requests.delete(delete_url, headers=headers)
result = delete_response.json()
if result.get('success'):
print(f"Project '{project_name}' deleted successfully")
return True
else:
print(f"Failed to delete project: {result.get('message')}")
return False
# Example usage
backup_and_delete_project("YOUR_PROJECT_ID", "YOUR_API_KEY")
5. Safe Delete with Retry Logic
Delete project with error handling and retry:async function safeDeleteProject(projectId, apiKey, maxRetries = 3) {
const headers = { 'Authorization': `${apiKey}` };
for (let attempt = 1; attempt <= maxRetries; attempt++) {
try {
console.log(`Attempt ${attempt} to delete project ${projectId}...`);
const response = await fetch(
`https://api.pictory.ai/pictoryapis/v2/projects/${projectId}`,
{ method: 'DELETE', headers }
);
if (response.status === 401) {
throw new Error('Unauthorized - check your API key');
}
if (response.status === 404) {
console.log('Project already deleted or does not exist');
return { success: true, message: 'Project not found' };
}
const result = await response.json();
if (result.success) {
console.log('Project deleted successfully');
return result;
}
if (attempt < maxRetries) {
console.log(`Deletion failed, retrying in ${attempt * 2} seconds...`);
await new Promise(resolve => setTimeout(resolve, attempt * 2000));
}
} catch (error) {
console.error(`Error on attempt ${attempt}:`, error.message);
if (attempt === maxRetries) {
throw error;
}
await new Promise(resolve => setTimeout(resolve, attempt * 2000));
}
}
throw new Error(`Failed to delete project after ${maxRetries} attempts`);
}
// Example usage
try {
const result = await safeDeleteProject('YOUR_PROJECT_ID', 'YOUR_API_KEY');
console.log('Result:', result);
} catch (error) {
console.error('Final error:', error.message);
}
6. Delete Projects in Specific Folder
Delete all projects within a specific folder: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 usage
delete_folder_projects("your-folder-id", "YOUR_API_KEY", confirm=True)
Best Practices
Safety Measures
- Always back up before deletion: Use the Get Project By Id endpoint to retrieve all assets before deleting
- Implement confirmation: Require user confirmation before executing delete operations
- Use dry runs: Test deletion logic with dry run mode before executing
- Log deletions: Keep audit logs of deleted projects for accountability
- Handle errors gracefully: Implement proper error handling and retry logic
Bulk Operations
When deleting multiple projects:- Add delays between deletions to avoid rate limiting
- Process deletions in batches
- Implement comprehensive error handling
- Provide progress updates to users
- Log both successes and failures
Recovery Planning
Since deletion is permanent:- Maintain regular backups of important projects
- Export project metadata before deletion
- Download all media files (video, audio, subtitles) for archival
- Keep deletion logs for audit trails
Was this page helpful?
⌘I
