Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Roles → Delete

AI-generated

Overview

The Directus (DrWade) node for n8n allows you to interact with the Directus API, specifically managing resources such as roles.
For the Roles → Delete operation, this node enables you to delete a specific role from your Directus instance by providing its unique identifier.

Common scenarios:

  • Automating user and permission management workflows.
  • Cleaning up unused or obsolete roles in your Directus project.
  • Integrating role deletion into larger data lifecycle automations.

Example use case:
You have an onboarding/offboarding workflow where certain roles need to be removed automatically when no longer needed.


Properties

Name Type Meaning
ID String Primary key of the role to be deleted. This is required and uniquely identifies the role in Directus.

Output

  • The output will be a single object in the json field.
  • If the deletion is successful, the response is typically an empty object {} or may contain confirmation details depending on the Directus API version/configuration.
  • If there is an error (e.g., invalid ID), the output will include an error property with the error message if "Continue On Fail" is enabled.

Example output:

{
  "json": {}
}

or, on error:

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

Dependencies

  • Directus API: You must have access to a running Directus instance.
  • API Credentials: The node requires valid Directus API credentials configured in n8n under the name directusApi.

Troubleshooting

Common issues:

  • Invalid Role ID: If the provided ID does not exist, the API will return an error such as "Role not found".
  • Insufficient Permissions: The API credentials used must have permission to delete roles; otherwise, you may receive a "Forbidden" or "Unauthorized" error.
  • Role in Use: Attempting to delete a role that is still assigned to users or referenced elsewhere may result in a conflict or error, depending on Directus configuration.

Error messages and resolutions:

  • "Role not found": Double-check the ID value; ensure it matches an existing role.
  • "Forbidden" or "Unauthorized": Verify that your API credentials have sufficient permissions.
  • "Cannot delete role in use": Remove all associations before deleting the role.

Links and References


Discussion