Delete Image
Deletes an uploaded image from Leonardo AI storage.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
Inputs
- Connection Id (String) - Connection ID from the Connect node (optional if API Key credentials are provided directly).
- Image ID (String) - ID of the uploaded image to delete.
Options
- API Key - Leonardo AI API key (optional if using Connection ID).
Outputs
This node does not have outputs.
How It Works
The Delete Image node permanently removes an uploaded image. When executed, the node:
- Validates the image ID is not empty
- Sends a delete request to Leonardo AI API
- Removes the image from storage
Requirements
- Valid Leonardo AI API key (via Connection ID or credentials)
- Valid image ID from an uploaded image
- Permission to delete the image (must be the owner)
Error Handling
The node will return specific errors in the following cases:
- Empty image ID - "Image ID cannot be empty. Please provide a valid image ID."
- API error - "Failed to delete image. API error:
{details}" - Image not found - API returns 404 if image doesn't exist
- Permission denied - Error if you don't own the image
Usage Examples
Clean Up After Generation
Delete uploaded images after use:
- Upload Image for init image generation
- Create Generation using the image ID
- Wait for generation to complete
- Delete Image to free up storage
Bulk Delete Uploaded Images
Remove multiple uploaded images:
const imageIds = [
'image-id-1',
'image-id-2',
'image-id-3'
];
// Loop through and delete each image
imageIds.forEach(imageId => {
// Use Delete Image node with imageId
});
Automated Storage Management
Clean up old uploaded images:
- Keep a record of uploaded image IDs with timestamps
- Periodically check for images older than 30 days
- Delete old images that are no longer needed
- Update your records
Delete Failed Uploads
Remove images that weren't used successfully:
- Try to upload an image
- If generation using the image fails
- Delete the unused uploaded image
- Clean up resources
Usage Notes
- Deletion is permanent and cannot be undone
- The image ID becomes invalid after deletion
- Deleting an image doesn't affect generations already created with it
- Useful for managing storage quota and keeping account organized
- Consider keeping a backup if the image might be needed later
- Failed deletions may indicate the image was already deleted
- You can only delete images you own
- Regular cleanup helps optimize storage usage
- Delete images after they're no longer needed for new generations