Actions109
- Activity Actions
- Assets Actions
- Authentication Actions
- Collections Actions
- Extensions Actions
- Fields Actions
- Files Actions
- Folders Actions
- Items Actions
- Permissions Actions
- Presets Actions
- Relations Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
- Webhooks Actions
Files → Delete
AI-generatedOverview
The Directus (DrWade) - Files: Delete operation node allows you to delete a file from your Directus instance by specifying its unique file ID. This is useful in scenarios where you need to programmatically remove files that are no longer needed, such as outdated documents, images, or other assets managed within Directus.
Practical examples:
- Automatically deleting temporary files after processing.
- Removing user-uploaded files when a user account is deleted.
- Cleaning up old media assets as part of a scheduled maintenance workflow.
Properties
| Name | Type | Meaning |
|---|---|---|
| ID | String | Unique ID of the file object to be deleted. |
Output
The output will be a single item with a json field containing the response from the Directus API. The structure of this response depends on the Directus backend, but typically it may look like:
{
"json": {
// Response data from Directus, often an empty object or confirmation message
}
}
If the deletion is successful, the response is usually an empty object {} or a status message. If there is an error and "Continue On Fail" is enabled, the output will contain an error property with the error message.
Dependencies
- Directus API: You must have access to a running Directus instance.
- API Credentials: The node requires valid Directus API credentials (
directusApi) configured in n8n. - n8n Configuration: No special environment variables are required beyond standard credential setup.
Troubleshooting
Common issues:
- Invalid or missing ID: If the provided file ID does not exist, the API will return an error indicating that the file was not found.
- Insufficient permissions: The API credentials used must have permission to delete files in Directus; otherwise, a permission error will occur.
- Network/API errors: Connectivity issues or misconfigured endpoints can result in request failures.
Error messages and resolutions:
"File not found": Ensure the ID is correct and the file exists in Directus."Forbidden"or"Unauthorized": Check that your API credentials have the necessary permissions."Invalid credentials": Reconfigure your Directus API credentials in n8n.