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 - Roles: Delete operation in this n8n node allows you to delete a specific role from your Directus instance by providing its unique ID. This is useful for administrators who need to manage user roles and permissions, ensuring that obsolete or unnecessary roles are removed from the system.
Common scenarios:
- Cleaning up unused or deprecated roles after organizational changes.
- Automating role management as part of a larger workflow (e.g., when offboarding users or restructuring access controls).
Practical example:
You might use this node in an automation that reviews all roles and deletes those that are no longer assigned to any users.
Properties
Name | Type | Meaning |
---|---|---|
ID | String | Primary key of the role to be deleted. |
Output
- The output will be a JSON object under the
json
field. - On success, the structure typically reflects the response from the Directus API after deleting a role. This may be an empty object
{}
or contain metadata about the deletion, depending on the Directus version and configuration. - On error (if "Continue On Fail" is enabled), the output will include an
error
property with the error message.
Example output:
{
"json": {}
}
or, in case of error:
{
"json": {
"error": "Role not found"
}
}
Dependencies
- Directus API: You must have a valid Directus instance accessible via API.
- API Credentials: The node requires Directus API credentials (
directusApi
) configured in n8n. - Permissions: The authenticated user must have permission to delete roles in Directus.
Troubleshooting
Common issues:
- Invalid Role ID: If the provided ID does not correspond to an existing role, the API will return an error such as "Role not found".
- Insufficient Permissions: If the API credentials do not have sufficient rights, you may receive a "Forbidden" or "Unauthorized" error.
- Role in Use: Some Directus configurations may prevent deletion of roles that are still assigned to users, resulting in an error.
How to resolve:
- Double-check the role ID for typos.
- Ensure the API credentials have admin or appropriate permissions.
- Remove or reassign users from the role before attempting deletion if required by your Directus setup.