Skip to main content

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:

  1. Validates the image ID is not empty
  2. Sends a delete request to Leonardo AI API
  3. 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:

  1. Upload Image for init image generation
  2. Create Generation using the image ID
  3. Wait for generation to complete
  4. 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:

  1. Keep a record of uploaded image IDs with timestamps
  2. Periodically check for images older than 30 days
  3. Delete old images that are no longer needed
  4. Update your records

Delete Failed Uploads

Remove images that weren't used successfully:

  1. Try to upload an image
  2. If generation using the image fails
  3. Delete the unused uploaded image
  4. 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