Actions109
- Collections Actions
- Activity Actions
- Assets Actions
- Authentication Actions
- Extensions Actions
- Fields Actions
- Files Actions
- Folders Actions
- Items Actions
- Permissions Actions
- Presets Actions
- Relations Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
- Webhooks Actions
Overview
The Roles → Delete Multiple operation in this custom n8n node allows you to delete multiple roles from a Directus instance in a single API call. This is particularly useful for administrators or automation workflows that need to clean up or manage user roles in bulk, such as removing deprecated roles, cleaning up after migrations, or enforcing new permission structures.
Practical examples:
- Deleting several obsolete roles after an organizational restructure.
- Automating the removal of test roles created during development.
- Cleaning up roles as part of a scheduled maintenance workflow.
Properties
| Name | Type | Meaning |
|---|---|---|
| Keys (JSON) | json | An array of role primary keys (IDs) to be deleted. Example: ["id1", "id2"] |
Output
- The output will be a JSON object reflecting the result of the deletion operation.
- Typical structure:
{ // Response data from the Directus API after attempting to delete the specified roles. // The exact structure depends on the Directus API response, but usually includes success status and possibly details about deleted items. } - If an error occurs and "Continue On Fail" is enabled, the output will include an
errorfield with the error message:{ "error": "Error message here" }
Dependencies
- Directus API: Requires access to a running Directus instance.
- API Credentials: You must configure the
directusApicredentials in n8n for authentication.
Troubleshooting
Common issues:
- Invalid Role IDs: If any provided ID does not correspond to an existing role, the API may return an error.
- Insufficient Permissions: The API credentials used must have permission to delete roles; otherwise, you'll receive an authorization error.
- Malformed JSON: The "Keys (JSON)" property must be a valid JSON array of strings. Invalid JSON will cause parsing errors.
Common error messages:
"Invalid JSON": Ensure the input is a properly formatted JSON array."Permission denied": Check your Directus API credentials and permissions."Role not found": One or more IDs do not match existing roles.