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:
- Validates the dataset ID is not empty
- Sends a delete request to Leonardo AI API
- Removes the dataset and all associated images
- 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:
- Create Dataset
- Upload images to the dataset
- Create Model from the dataset
- Verify model was created successfully
- 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:
- Create Dataset
- Try to upload images
- If upload fails or dataset is incorrect
- Delete Dataset to start over
Automated Cleanup
Set up periodic dataset cleanup:
- Get list of all datasets (via your tracking system)
- Filter for datasets older than a certain date
- Check if they have associated models
- 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