Actions100
- Activity Actions
- Asset Actions
- Authentication Actions
- Collection Actions
- Extension Actions
- Field Actions
- File Actions
- Folder Actions
- Item Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
Overview
The Directus - Collection: Delete operation node in n8n allows you to delete a specific collection from your Directus instance. This is useful for automating the management of your Directus data model, such as cleaning up unused collections or programmatically removing collections as part of a workflow.
Common scenarios:
- Automated cleanup of test or temporary collections.
- Removing deprecated collections as part of a migration process.
- Integrating with other systems that require dynamic schema changes.
Example:
You have a workflow that creates and deletes collections based on user input or external triggers. This node can be used to remove a collection named "articles" when it is no longer needed.
Properties
Name | Type | Meaning |
---|---|---|
Collection | options | Unique name of the collection to be deleted. |
Output
- The output will be a single object in the
json
field, typically containing the response from the Directus API after attempting to delete the specified collection. - The structure of the output depends on the Directus API's response, but commonly it may be an empty object
{}
or a status/result message. - If an error occurs and "Continue On Fail" is enabled, the output will contain an
error
property with the error message.
Example output:
{
"json": {}
}
or, on error (with "Continue On Fail"):
{
"json": {
"error": "Collection not found"
}
}
Dependencies
- Directus API: Requires access to a running Directus instance.
- API Credentials: You must configure Directus API credentials (
directusApi
) in n8n for authentication.
Troubleshooting
Common issues:
- Invalid Collection Name: If the collection does not exist, the API will return an error.
- Insufficient Permissions: The API credentials used must have permission to delete collections.
- Locked/System Collections: Attempting to delete system or locked collections may result in an error.
Error messages and resolutions:
"Collection not found"
: Ensure the collection name is correct and exists in Directus."Unauthorized"
or"Forbidden"
: Check that your API credentials have sufficient permissions."Cannot delete system collection"
: System collections cannot be deleted; only custom collections are allowed.