Directus icon

Directus

Consume Directus API

Overview

The Permission → Delete Multiple operation in this n8n node allows you to delete multiple permission records at once from a Directus instance. This is useful for bulk management of permissions, such as cleaning up obsolete or incorrect permission entries in your Directus project.

Practical scenarios:

  • Removing several outdated or test permissions after a schema change.
  • Cleaning up permissions when offboarding users or roles.
  • Automating permission resets as part of a workflow.

Properties

Name Type Meaning
Keys (JSON) JSON An array of permission primary keys to be deleted. Example: [34, 64]. This field is required and should contain the IDs of the permissions you want to remove.

Output

  • The output will be a single object with a json property.
  • The structure of the json field typically contains the response from the Directus API after attempting to delete the specified permissions. If the deletion is successful, it may be an empty object {} or contain metadata about the operation.
  • If an error occurs and "Continue On Fail" is enabled, the output will include an error field with the error message.

Example output:

{
  "json": {}
}

or on error:

{
  "json": {
    "error": "Error message here"
  }
}

Dependencies

  • Directus API: Requires access to a Directus instance.
  • API Credentials: You must configure the directusApi credentials in n8n for authentication.

Troubleshooting

Common issues:

  • Invalid or missing keys: If the Keys (JSON) input is not a valid JSON array or contains invalid IDs, the node will throw an error.
  • Insufficient permissions: The API user must have permission to delete permissions in Directus; otherwise, an authorization error will occur.
  • Malformed JSON: If the input is not properly formatted JSON, you'll see parsing errors.

Error messages and resolutions:

  • "Unexpected token ... in JSON": Check that your Keys (JSON) input is valid JSON (e.g., [1,2,3]).
  • "You are not authorized to perform this action": Ensure your API credentials have sufficient rights.
  • "Not found": One or more provided keys do not correspond to existing permissions.

Links and References

Discussion