Actions100
- Activity Actions
- Asset Actions
- Authentication Actions
- Collection Actions
- Extension Actions
- Field Actions
- File Actions
- Folder Actions
- Item Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
Overview
The Directus - Relation: Delete operation in this n8n node allows you to delete a specific relation between collections in a Directus project. Relations in Directus define how different collections (tables) are linked together, such as one-to-many or many-to-many relationships. This operation is useful when you need to remove an existing relationship definition, for example, if your data model changes and certain links between collections are no longer needed.
Practical scenarios:
- Removing a foreign key relationship between two tables.
- Cleaning up unused or incorrect relations after schema refactoring.
- Automating the management of collection relationships as part of a deployment or migration workflow.
Properties
Name | Type | Meaning |
---|---|---|
Collection | options | Unique name of the parent collection. This is the collection where the relation is defined. |
Field | options | Name of the field that holds the related primary key. This matches the column name in the DB. |
Output
The output will be a JSON object representing the result of the delete operation. Typically, for a successful deletion, Directus returns an empty object ({}
), but the exact structure may depend on the API version and server configuration. If there is an error, the output will contain an error
field with the error message.
Example output:
{
"json": {}
}
or, in case of error (if "Continue On Fail" is enabled):
{
"json": {
"error": "Relation not found"
}
}
Dependencies
- Directus API: You must have 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: If the specified collection or field does not exist, the operation will fail with an error like
"Relation not found"
or"Field not found"
. - Insufficient Permissions: The API user must have permission to manage schema/relations in Directus. Otherwise, you may see errors such as
"Forbidden"
or"Unauthorized"
. - Relation In Use: Attempting to delete a relation that is required by other parts of the schema may result in errors from Directus.
How to resolve:
- Double-check the collection and field names using the Directus admin panel or API.
- Ensure your API credentials have sufficient privileges.
- Review any dependencies before deleting a relation.