{ "success": false, "message": "Project not found"}
Overview
Update an existing project by sending the complete updated project object. This endpoint allows you to modify scene visuals, subtitle text content, scene settings, and other project attributes. The entire project object must be included in the request; partial updates are not supported.
Complete Object Required: You must send the entire project object in the request body, even if you are only changing a few fields. Omitting fields may result in data loss or project corruption.
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
PUT https://api.pictory.ai/pictoryapis/v2/projects/{projectid}
Request Parameters
Path Parameters
string
required
The unique identifier of the project to update. Can be either a string (for v3 schema projects) or an integer (for v2 schema and earlier projects).Example: 20251222191648030d7df02f5b4054d4ca8831f1369459e25
Headers
string
required
API key for authentication (starts with pictai_)
Authorization: YOUR_API_KEY
string
required
Must be set to application/json
Content-Type: application/json
Request Body
The request body must contain the complete project object retrieved from the Get Project by ID endpoint. Modify only the fields you need to change while preserving all other fields.
Do not modify project fields if their usage is unclear. Incorrect modifications can cause unexpected behavior or corrupt your project. If you have questions about specific fields or their intended use, please contact our support team at support@pictory.ai before making changes.
Updatable Video Elements
The following sections describe the video element fields that can be safely modified. These structures match the response from the Get Project by ID endpoint.
Project-Level Fields
These top-level fields can be safely updated:
{ "projectName": "My Updated Video", "audioSpeed": 100, "videoVolume": 50}
Field
Type
Description
projectName
string
Name of the project
audioSpeed
number
Audio playback speed percentage (100 = normal)
videoVolume
number
Background video volume level (0-100)
Scene Text (scenes[].text and scenes[].sentence)
Update the display text and narration for each scene:
{ "scenes": [ { "text": "Your new scene text here", "sentence": [ { "text": "Your new ", "decoration": ["decor-bold"] }, { "text": "scene text", "highlight": true, "decoration": ["decor-underline"] }, { "text": " here" } ], "keywords": ["scene text"] } ]}
word_markers, time_markers, subScenes - Audio timing data
Modifying these fields without proper understanding can cause project corruption or rendering failures. Contact support@pictory.ai if you need guidance.
Response
The API returns a JSON response indicating the success or failure of the update operation.Success Response Fields:
Field
Type
Description
success
boolean
true if the update was successful
message
string
Confirmation message
project
object
The updated project object with all current values
Always Retrieve Before Update: Always fetch the current project state using the GET endpoint before making modifications. This ensures you have the complete object with all required fields.
Complete Object Required: Even if you only want to change one field, you must send the entire project object. Omitting fields will cause them to be removed from the project.
Render After Update: Updating a project only saves the changes to the project data. To generate a new video with your updates, you must call the Render Project endpoint after the update is complete.
Test Changes First: When making significant updates, consider testing on a copy of the project first to ensure your modifications do not cause rendering issues.
Common Use Cases
1. Update Scene Background Visual
Replace the background media for a specific scene:
import requestsdef update_scene_background(project_id, scene_index, new_media_url, media_type, api_key): """ Update the background visual for a specific scene media_type: "image" or "video" """ headers = {"Authorization": api_key, "Content-Type": "application/json"} # Get current project get_url = f"https://api.pictory.ai/pictoryapis/v2/projects/{project_id}" response = requests.get(get_url, headers=headers) project = response.json() # Update the scene background if scene_index < len(project.get('scenes', [])): background = project['scenes'][scene_index].get('background', {}) background['type'] = media_type background['elementData'] = background.get('elementData', {}) background['elementData']['url'] = new_media_url background['elementData']['preview_jpg'] = new_media_url background['elementData']['library'] = 'uploads' if media_type == 'video': background['settings'] = {'loopVideo': True} project['scenes'][scene_index]['background'] = background print(f"Updated scene {scene_index} background to: {new_media_url}") # Send update put_url = f"https://api.pictory.ai/pictoryapis/v2/projects/{project_id}" update_response = requests.put(put_url, json=project, headers=headers) result = update_response.json() if result.get('success'): print("Project updated successfully") return result else: print(f"Update failed: {result.get('message')}") return None else: print(f"Scene index {scene_index} out of range") return None# Example usageupdate_scene_background( "YOUR_PROJECT_ID", 0, # First scene "https://your-media-url.com/new-image.jpg", "image", "YOUR_API_KEY")
2. Update Scene Text
Modify the text and sentence for one or more scenes:
async function updateSceneText(projectId, sceneUpdates, apiKey) { const headers = { 'Authorization': `${apiKey}`, 'Content-Type': 'application/json' }; // Get current project const getResponse = await fetch( `https://api.pictory.ai/pictoryapis/v2/projects/${projectId}`, { headers } ); const project = await getResponse.json(); // Update scene text sceneUpdates.forEach(({ sceneIndex, newText, keywords }) => { if (sceneIndex < project.scenes.length) { // Update the text field project.scenes[sceneIndex].text = newText; // Update sentence array with formatting project.scenes[sceneIndex].sentence = [ { text: newText, highlight: false, decoration: ['decor-bold'] } ]; // Update keywords if provided if (keywords) { project.scenes[sceneIndex].keywords = keywords; } console.log(`Updated scene ${sceneIndex} text`); } }); // Send update const updateResponse = await fetch( `https://api.pictory.ai/pictoryapis/v2/projects/${projectId}`, { method: 'PUT', headers, body: JSON.stringify(project) } ); const result = await updateResponse.json(); return result;}// Example usageconst updates = [ { sceneIndex: 0, newText: 'A Stunning Masterpiece', keywords: ['Stunning Masterpiece'] }, { sceneIndex: 1, newText: 'Sweeping views with year-round sunsets', keywords: ['Sweeping views', 'sunsets'] }];const result = await updateSceneText('YOUR_PROJECT_ID', updates, 'YOUR_API_KEY');console.log('Update result:', result);
3. Update Scene Settings and Element Settings
Apply settings changes to scenes and their elements:
def update_scene_settings(project_id, settings_updates, api_key): """ Apply settings to multiple scenes settings_updates: dict with scene indices as keys and settings as values Note: - scenes[].settings only supports: hideText - scenes[].elements[].settings supports: loopVideo, muteClipAudio - scenes[].background.settings supports: loopVideo (for video backgrounds) - scenes[].background.styleData supports: imageZoomPan Example: { 0: {"hideText": True}, 2: {"hideText": False} } """ headers = {"Authorization": api_key, "Content-Type": "application/json"} # Get current project get_url = f"https://api.pictory.ai/pictoryapis/v2/projects/{project_id}" response = requests.get(get_url, headers=headers) project = response.json() # Update scene settings (only hideText is supported at scene level) for scene_index, new_settings in settings_updates.items(): if scene_index < len(project.get('scenes', [])): current_settings = project['scenes'][scene_index].get('settings', {}) # Only update hideText at scene level if 'hideText' in new_settings: current_settings['hideText'] = new_settings['hideText'] project['scenes'][scene_index]['settings'] = current_settings print(f"Updated settings for scene {scene_index}") # Send update put_url = f"https://api.pictory.ai/pictoryapis/v2/projects/{project_id}" update_response = requests.put(put_url, json=project, headers=headers) return update_response.json()def update_element_settings(project_id, scene_index, element_index, element_settings, api_key): """ Update settings for a specific video element overlay element_settings supports: loopVideo, muteClipAudio """ headers = {"Authorization": api_key, "Content-Type": "application/json"} # Get current project get_url = f"https://api.pictory.ai/pictoryapis/v2/projects/{project_id}" response = requests.get(get_url, headers=headers) project = response.json() scenes = project.get('scenes', []) if scene_index < len(scenes): elements = scenes[scene_index].get('elements', []) if element_index < len(elements): current_settings = elements[element_index].get('settings', {}) current_settings.update(element_settings) project['scenes'][scene_index]['elements'][element_index]['settings'] = current_settings print(f"Updated element {element_index} settings in scene {scene_index}") # Send update put_url = f"https://api.pictory.ai/pictoryapis/v2/projects/{project_id}" update_response = requests.put(put_url, json=project, headers=headers) return update_response.json()# Example usage - Update scene settings (hideText only)scene_settings = { 0: {"hideText": True}, 2: {"hideText": False}}result = update_scene_settings("YOUR_PROJECT_ID", scene_settings, "YOUR_API_KEY")print(f"Scene settings update successful: {result.get('success')}")# Example usage - Update video element settings (loopVideo, muteClipAudio)result = update_element_settings( "YOUR_PROJECT_ID", scene_index=0, element_index=0, element_settings={"loopVideo": True, "muteClipAudio": True}, api_key="YOUR_API_KEY")print(f"Element settings update successful: {result.get('success')}")
def replace_all_backgrounds(project_id, media_items, api_key): """ Replace background media for all scenes media_items: list of dicts with 'url' and 'type' keys Example: [ {"url": "https://example.com/image1.jpg", "type": "image"}, {"url": "https://example.com/video1.mp4", "type": "video"}, ] """ headers = {"Authorization": api_key, "Content-Type": "application/json"} # Get current project get_url = f"https://api.pictory.ai/pictoryapis/v2/projects/{project_id}" response = requests.get(get_url, headers=headers) project = response.json() scenes = project.get('scenes', []) if len(media_items) != len(scenes): print(f"Warning: {len(media_items)} items provided for {len(scenes)} scenes") return None # Update all scene backgrounds for i, media in enumerate(media_items): background = scenes[i].get('background', {}) background['type'] = media['type'] background['elementData'] = background.get('elementData', {}) background['elementData']['url'] = media['url'] background['elementData']['preview_jpg'] = media['url'] background['elementData']['library'] = 'uploads' if media['type'] == 'video': background['settings'] = {'loopVideo': True} background['elementData']['duration'] = media.get('duration', 10) scenes[i]['background'] = background print(f"Scene {i}: {media['url']} ({media['type']})") project['scenes'] = scenes # Send update put_url = f"https://api.pictory.ai/pictoryapis/v2/projects/{project_id}" update_response = requests.put(put_url, json=project, headers=headers) return update_response.json()# Example usagenew_backgrounds = [ {"url": "https://media-url.com/scene1.jpg", "type": "image"}, {"url": "https://media-url.com/scene2.mp4", "type": "video", "duration": 15}, {"url": "https://media-url.com/scene3.jpg", "type": "image"}]result = replace_all_backgrounds("YOUR_PROJECT_ID", new_backgrounds, "YOUR_API_KEY")if result and result.get('success'): print("All backgrounds updated successfully")
6. Safe Update with Validation
Implement validation before updating:
import copydef safe_update_project(project_id, update_function, api_key): """ Safely update project with validation update_function: function that takes project dict and modifies it """ headers = {"Authorization": api_key, "Content-Type": "application/json"} # Get current project 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("Failed to fetch project") return None original_project = response.json() updated_project = copy.deepcopy(original_project) # Apply updates try: update_function(updated_project) except Exception as e: print(f"Error applying updates: {e}") return None # Validate critical fields are present required_fields = ['projectName', 'scenes', 'schemaVersion'] for field in required_fields: if field not in updated_project: print(f"Critical field '{field}' missing after update") return None # Send update put_url = f"https://api.pictory.ai/pictoryapis/v2/projects/{project_id}" update_response = requests.put(put_url, json=updated_project, headers=headers) result = update_response.json() if result.get('success'): print("Project updated successfully") else: print(f"Update failed: {result.get('message')}") return result# Example usagedef my_updates(project): """Define your updates here""" project['projectName'] = 'New Name' project['audioSpeed'] = 95 # Hide text for first scene (scenes[].settings.hideText) if project['scenes']: if 'settings' not in project['scenes'][0]: project['scenes'][0]['settings'] = {} project['scenes'][0]['settings']['hideText'] = True # Mute audio for first video element (elements[].settings.muteClipAudio) if project['scenes'] and project['scenes'][0].get('elements'): element = project['scenes'][0]['elements'][0] if element.get('type') == 'video': if 'settings' not in element: element['settings'] = {} element['settings']['muteClipAudio'] = Trueresult = safe_update_project("YOUR_PROJECT_ID", my_updates, "YOUR_API_KEY")
Best Practices
Safety Guidelines
Always Fetch First: Get the current project state before making any modifications
Preserve All Fields: Include all fields in the update request, even if unchanged
Test on Copies: Test significant changes on duplicate projects first
Validate Before Sending: Ensure all required fields are present before updating
Keep Backups: Save the original project state before applying updates
Common Pitfalls to Avoid
❌ Partial Updates: Sending only modified fields will delete other fields