Skip to main content

Delete Dataset

Deletes a dataset and all its associated images from Leonardo AI.

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).
  • Dataset ID (String) - ID of the dataset to delete.

Options

  • API Key - Leonardo AI API key (optional if using Connection ID).

Outputs

  • Response (Object) - Deleted dataset details including:
    • Dataset ID of the deleted dataset

How It Works

The Delete Dataset node permanently removes a dataset. When executed, the node:

  1. Validates the dataset ID is not empty
  2. Sends a delete request to Leonardo AI API
  3. Removes the dataset and all associated images
  4. Returns the ID of the deleted dataset

Requirements

  • Valid Leonardo AI API key (via Connection ID or credentials)
  • Valid dataset ID
  • Permission to delete the dataset (must be the owner)

Error Handling

The node will return specific errors in the following cases:

  • Empty dataset ID - "Dataset ID cannot be empty. Please provide a valid dataset ID."
  • API error - "Failed to delete dataset. API response: {details}"
  • Dataset not found - "Dataset not found. Please verify the dataset ID is correct and the dataset exists."

Usage Examples

Clean Up After Model Training

Delete a dataset after creating a model from it:

  1. Create Dataset
  2. Upload images to the dataset
  3. Create Model from the dataset
  4. Verify model was created successfully
  5. Delete Dataset to free up storage

Delete Unused Datasets

Remove datasets that are no longer needed:

// List of dataset IDs to delete
const unusedDatasets = [
'dataset-id-1',
'dataset-id-2',
'dataset-id-3'
];

// Loop through and delete each
unusedDatasets.forEach(datasetId => {
// Use Delete Dataset with datasetId
});

Delete Failed Dataset

Remove a dataset if image upload or model training failed:

  1. Create Dataset
  2. Try to upload images
  3. If upload fails or dataset is incorrect
  4. Delete Dataset to start over

Automated Cleanup

Set up periodic dataset cleanup:

  1. Get list of all datasets (via your tracking system)
  2. Filter for datasets older than a certain date
  3. Check if they have associated models
  4. Delete datasets without models that are old

Usage Notes

  • Deletion is permanent and cannot be undone
  • All images in the dataset are also deleted
  • Models created from the dataset are NOT deleted
  • The dataset ID becomes invalid after deletion
  • Use caution when deleting - ensure you have backups if needed
  • Useful for managing storage quota
  • Deleting the dataset doesn't affect models already trained from it
  • You can only delete datasets you own
  • Consider downloading dataset images before deletion if they might be needed
  • Failed deletions indicate the dataset may not exist or you lack permission
  • Regular cleanup helps keep your account organized