Skip to main content
DELETE
Clean Job

Overview

Remove all job data and associated resources for a specific completed job. This operation permanently deletes all files generated by the job including video outputs, audio files, thumbnails, subtitle files (SRT, VTT, TXT), share URLs, preview URLs, and any uploaded input files. Use this endpoint to free up storage space and remove sensitive data after you have downloaded or processed the job results. This operation is only available for jobs that have completed (successfully or failed) and is irreversible.
Irreversible Operation: Once a job is cleaned, all associated data is permanently deleted and cannot be recovered. Make sure you have downloaded any needed outputs before cleaning.
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


Request Parameters

Path Parameters

jobid
uuid
required
The unique identifier (UUID) of the job to clean up. This is returned when the job was initially created.Example: "17684c46-9d14-44ed-8830-ff839713ef8b"

Headers

Authorization
string
required
API key for authentication (starts with pictai_)

Response

Returns a simple success indicator confirming the job and all associated resources have been cleaned.
success
boolean
required
Indicates whether the cleanup operation was successful. True if the job was successfully cleaned up, false otherwise.

Response Examples


Code Examples

Replace YOUR_API_KEY with your actual API key and YOUR_JOB_ID with the job ID you want to clean

Usage Notes

Data Loss: This operation permanently deletes all job data and outputs. Ensure you have downloaded any needed files before cleaning the job.
Job State Requirement: Jobs can only be cleaned after they have completed (either successfully or failed). You cannot clean jobs that are still processing.
Storage Management: Regularly clean completed jobs to manage storage usage and costs, especially for high-volume applications.
Idempotent Operation: Calling this endpoint multiple times with the same job ID is safe. Subsequent calls will return success even if the job was already cleaned.

Common Use Cases

1. Clean Job After Downloading Results

Download results and then clean up:

2. Batch Clean Multiple Completed Jobs

Clean multiple jobs at once:

3. Clean Old Completed Jobs

Automatically clean jobs older than a certain age:

4. Clean with Confirmation

Require user confirmation before cleaning:

5. Conditional Cleanup Based on Job Type

Clean jobs based on type and retention policy:

What Gets Deleted

When you clean a job, the following data and resources are permanently removed:
Resource TypeDescription
Video OutputsAll rendered video files in various formats and resolutions
Audio FilesGenerated audio tracks, voiceovers, and audio exports
ThumbnailsPreview images and video thumbnails
Subtitle FilesSRT, VTT, and TXT subtitle/caption files
Transcript DataWord-level transcript with timing information
Highlight DataAI-generated highlight segments and summaries
Share URLsPublic sharing links and preview URLs
Preview URLsTemporary preview and playback URLs
Input FilesUploaded source files (videos, audio, images)
Project DataIntermediate processing files and temporary data

Best Practices

  1. Download Before Cleaning: Always download and backup any needed outputs before cleaning a job.
  2. Verify Job Completion: Ensure the job has completed (successfully or failed) before attempting to clean. Processing jobs cannot be cleaned.
  3. Archive Important Results: For jobs with important results, save the full job data (transcript, highlights, outputs) to your own storage before cleaning.
  4. Automate Cleanup: Implement automated cleanup policies to regularly clean old jobs and manage storage costs.
  5. Handle Errors Gracefully: Jobs may already be cleaned or deleted. Handle 404 errors appropriately.
  6. Use Batch Operations: When cleaning multiple jobs, use parallel requests with reasonable rate limiting.
  7. Implement Retention Policies: Define clear policies for how long different types of jobs should be retained.
  8. Log Cleanup Operations: Maintain logs of cleaned jobs for audit and recovery purposes.
  9. Confirm Critical Operations: For interactive applications, require user confirmation before cleaning jobs.
  10. Check Storage Limits: Monitor your account’s storage usage and clean jobs proactively to avoid reaching limits.

Error Handling

Common errors and how to handle them:
ErrorCauseSolution
INVALID_STATEJob is still processingWait for job to complete before cleaning
NOT_FOUNDJob does not exist or already cleanedThis is safe to ignore in cleanup scripts
UNAUTHORIZEDInvalid or expired API keyVerify your API key is valid
INTERNAL_ERRORServer-side errorRetry with exponential backoff