Directus icon

Directus

Consume Directus API

Overview

The Field → Delete operation in this n8n node allows you to delete a specific field from a collection in a Directus instance. This is useful for managing your data model dynamically, such as removing obsolete or incorrect fields from collections without manual intervention via the Directus admin interface.

Common scenarios:

  • Automating schema clean-up tasks.
  • Removing fields as part of a migration or refactoring process.
  • Integrating with CI/CD pipelines to keep Directus schemas in sync with code.

Example:
You have a collection called articles and want to remove the field old_summary. You can use this node to automate that deletion.


Properties

Name Type Meaning
Field options Unique name of the field to delete. Field name is unique within the collection.
Collection options The name of the collection from which the field will be deleted.

Output

  • The output is a JSON object containing the response from the Directus API after attempting to delete the specified field.
  • The structure of the output typically reflects the Directus API's response for a DELETE operation on a field, which may be an empty object {} or a status message, depending on the Directus version and configuration.

Example output:

{
  "json": {}
}

or

{
  "json": {
    "status": "success"
  }
}

Dependencies

  • Directus API: Requires access to a running Directus instance.
  • API Credentials: The node requires valid Directus API credentials (configured as directusApi in n8n).
  • n8n Configuration: Ensure the credentials are set up in n8n under the appropriate credential type.

Troubleshooting

Common issues:

  • Invalid Collection or Field Name: If the specified collection or field does not exist, the node will throw an error.
  • Insufficient Permissions: The API user must have permission to modify the collection schema.
  • Field in Use: Attempting to delete a field that is referenced elsewhere (e.g., in relationships) may result in an error from Directus.

Error messages and resolutions:

  • "Field not found": Double-check the field and collection names.
  • "Permission denied": Ensure the API credentials have sufficient rights.
  • "Cannot delete field in use": Remove dependencies before deleting the field.

Links and References

Discussion