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 node for n8n, when configured with the File resource and the Delete operation, allows you to delete a file from your Directus instance by specifying its unique ID. This is useful in scenarios where you need to automate the removal of files (such as images, documents, or other assets) stored in Directus, for example:
- Automatically cleaning up files after processing.
- Removing outdated or unwanted files as part of a workflow.
- Managing digital assets programmatically.
Practical Example:
You might use this node in a workflow that processes uploaded files, and once they are no longer needed, deletes them from Directus to save storage space.
Properties
Name | Type | Meaning |
---|---|---|
ID | String | Unique ID of the file object to delete. |
Output
- The output will be an object in the
json
field. - If the deletion is successful, the response typically contains confirmation data from the Directus API, which may include details about the deleted file or a success status.
- If there is an error and "Continue On Fail" is enabled, the output will contain an
error
property with the error message.
Example output:
{
"json": {
// Response from Directus API after deleting the file,
// or { "error": "Error message" } if failed and continueOnFail is set.
}
}
Dependencies
- Directus API: You must have access to a running Directus instance.
- API Credentials: The node requires valid Directus API credentials (
directusApi
) to authenticate requests. - n8n Configuration: Ensure the Directus node is properly configured with the correct API URL and credentials in n8n.
Troubleshooting
Common Issues:
- Invalid File ID: If the provided ID does not correspond to an existing file, the API will return an error such as "Not Found".
- Insufficient Permissions: The API credentials used must have permission to delete files; otherwise, you may receive a "Forbidden" or "Unauthorized" error.
- Network/Connection Errors: If n8n cannot reach the Directus API, you'll see connection-related errors.
Error Handling:
- If "Continue On Fail" is enabled, errors will be returned in the output under an
error
key, allowing workflows to proceed. - Otherwise, the workflow will stop on error.