Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Collections → Delete

AI-generated

Overview

The Collections → Delete operation in this n8n node allows you to delete a specific collection from your Directus instance. This is useful when you need to programmatically remove an entire collection (table) and its associated metadata from Directus, for example as part of automated cleanup tasks, migration scripts, or administrative workflows.

Practical Example:
Suppose you have a workflow that creates temporary collections for data processing. After the process is complete, you can use this operation to automatically delete those collections, keeping your Directus instance clean and organized.


Properties

Name Type Meaning
Collection options Unique name of the collection to be deleted. This is required.

Output

  • The output will be a single object with a json field.
  • The structure of the json field depends on the response from the Directus API after attempting to delete the collection. Typically, it may be an empty object {} or contain confirmation details 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": "Collection not found"
  }
}

Dependencies

  • Directus API: You must have access to a Directus instance.
  • API Credentials: The node requires valid Directus API credentials (directusApi) configured in n8n.

Troubleshooting

Common Issues:

  • Invalid Collection Name: If the specified collection does not exist, the API will return an error.
  • Insufficient Permissions: The API credentials used must have permission to delete collections; otherwise, the operation will fail.
  • Locked/System Collections: Some system collections may not be deletable via the API.

Error Messages & Resolutions:

  • "Collection not found": Check that the collection name is correct and exists in Directus.
  • "Forbidden" or "Unauthorized": Ensure your API credentials have sufficient permissions.
  • "Cannot delete system collection": System collections are protected; only user-created collections can be deleted.

Links and References

Discussion