Directus icon

Directus

Consume Directus API

Overview

This node interacts with the Directus API to manage data items within specified collections. Specifically, for the Items resource and the Delete operation, it deletes a single item identified by its unique ID from a given collection.

This functionality is useful in scenarios where you need to programmatically remove records from your Directus-managed database collections. For example, you might want to delete outdated articles, remove user-submitted entries that no longer apply, or clean up test data automatically as part of a workflow.

Practical example:

  • Automatically deleting an item from the "articles" collection when it is marked as obsolete in another system.
  • Removing a specific user record from a "users" collection based on an external trigger.

Properties

Name Meaning
ID The unique identifier of the item (record) to be deleted from the specified collection.
Collection The name of the parent collection from which the item will be deleted.

Output

The output of this operation is a JSON object representing the response from the Directus API after attempting to delete the item. Typically, this includes confirmation of deletion or details about the deleted item. The exact structure depends on the Directus API's response but generally contains metadata about the operation's success.

No binary data output is produced by this operation.

Dependencies

  • Requires a valid connection to a Directus instance via an API key credential configured in n8n.
  • The node uses the Directus REST API endpoints to perform operations.
  • Proper permissions must be granted to the API key to allow deletion of items in the specified collection.

Troubleshooting

  • Common issues:

    • Attempting to delete an item with an invalid or non-existent ID will result in an error.
    • Insufficient permissions for the API key can cause authorization errors.
    • Specifying a collection name that does not exist or is misspelled will lead to request failures.
  • Error messages and resolutions:

    • "Item not found" — Verify the ID exists in the specified collection.
    • "Unauthorized" or "Forbidden" — Check that the API key has delete permissions for the collection.
    • "Collection not found" — Confirm the collection name is correct and accessible.

Links and References

Discussion