Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Overview

The Items → Delete operation in this custom n8n node for Directus allows you to delete a specific item (record) from a specified collection within your Directus instance. This is useful when you need to automate the removal of outdated, incorrect, or unnecessary data from your collections as part of a workflow.

Common scenarios:

  • Automatically cleaning up records after processing.
  • Removing test or temporary data.
  • Deleting user-submitted content that has been flagged or expired.

Example:
If you have a collection called articles and want to delete an article with ID 15, you would use this operation to remove it from the database.


Properties

Name Type Meaning
ID String Unique ID of the item (record) to be deleted from the collection.
Collection Options The unique name of the parent collection containing the item to delete.

Output

  • The output will be a single object in the json field, typically representing the response from the Directus API after attempting to delete the item.
  • The structure of the output depends on the Directus API's response, but commonly it may be an empty object {} or contain metadata about the deletion.
  • If an error occurs and "Continue On Fail" is enabled, the output will include an error property with the error message.

Example output:

{
  "json": {}
}

or, on error:

{
  "json": {
    "error": "Item not found"
  }
}

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.

Troubleshooting

Common issues:

  • Invalid ID or Collection: If the provided ID does not exist in the specified collection, the API will return an error.
  • Insufficient Permissions: The API credentials used must have permission to delete items in the target collection.
  • Incorrect Collection Name: Ensure the collection name matches exactly (case-sensitive).

Error messages and resolutions:

  • "Item not found": Check that both the collection and ID are correct and exist.
  • "Unauthorized" or "Forbidden": Verify that your API credentials have the necessary permissions.
  • "Collection not found": Double-check the collection name.

Links and References

Discussion