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 node for n8n, when configured with the Permission resource and the List operation, allows you to retrieve a list of permission objects from a Directus instance. This is useful for automating tasks such as auditing permissions, synchronizing access controls, or generating reports on user roles and their associated permissions.
Common scenarios:
- Fetching all permissions for review or export.
- Filtering permissions based on specific criteria (e.g., by role, collection, or action).
- Exporting permission data in various formats (CSV, JSON, XML) for compliance or backup purposes.
- Integrating permission data into other systems or workflows.
Practical example:
You might use this node to automatically export all permissions to a CSV file every week for audit purposes, or to display current permissions in a dashboard.
Properties
Name | Type | Meaning |
---|---|---|
Return All | boolean | If enabled, returns all permission records; if disabled, limits the number of results according to the "Limit" property. |
Limit | number | The maximum number of permission records to return (only used if "Return All" is false). Must be between 1 and 100. |
Split Into Items | boolean | If enabled, outputs each permission as a separate item in the workflow; otherwise, returns all permissions in a single item. |
JSON/RAW Parameters | boolean | If enabled, allows you to specify query parameters as raw JSON instead of using the UI fields. |
Query Parameters | json | Custom query parameters as a flat JSON object (used only if "JSON/RAW Parameters" is true). |
Additional Fields | collection | A set of optional fields to further customize the request, including: aggregation functions, export options, filtering, sorting, grouping, metadata, offset, search, and more. |
└ Aggregate | fixedCollection | Aggregation functions (e.g., count, sum, avg) to apply to the result set. |
└ Binary Property for Export Data | string | Name of the binary property to which exported data will be attached (when exporting as a file). |
└ Deep (JSON) | json | Allows setting nested query parameters for relational datasets. |
└ Export | options | Format to export the API response: csv, json, or xml. When set, the output will include a binary file. |
└ Fields | string | Specifies which fields to return in the response. |
└ File Name for Export Data | string | File name (without extension) for exported data files. |
└ Filter (JSON) | json | Conditions to filter the returned permissions. |
└ Group By | string | Field(s) to group results by, enabling grouped aggregations. |
└ Meta | string | Specifies what metadata to include in the response. |
└ Offset | number | Number of items to skip before starting to collect the result set. |
└ Search | string | Search term to filter permissions containing the given query in any field. |
└ Sort | string | Sorting order for the returned items. Accepts a comma-separated list of fields, with optional minus sign for descending order. |
Output
json:
- If "Split Into Items" is enabled, each output item contains a single permission object in the
json
field. - If not, the
json
field contains an array or object representing the list of permissions. - The structure of each permission object depends on your Directus instance but typically includes fields like
id
,role
,collection
,action
,permissions
, etc.
- If "Split Into Items" is enabled, each output item contains a single permission object in the
binary (optional):
- If the "Export" option is set (csv, json, or xml), the output will also include a
binary
field containing the exported file under the specified binary property name.
- If the "Export" option is set (csv, json, or xml), the output will also include a
Dependencies
- External Service: Requires access to a Directus API instance.
- Credentials: Needs a configured "directusApi" credential in n8n with appropriate permissions to read permissions.
- Environment: No special environment variables required beyond standard n8n setup.
Troubleshooting
Common issues:
- Authentication errors: Ensure that the provided credentials have sufficient permissions to access the permissions endpoint.
- Invalid query/filter syntax: When using JSON fields (like "Filter" or "Deep"), ensure valid JSON formatting.
- Export errors: If exporting, make sure the binary property name does not conflict with existing properties in your workflow.
- API limits: If "Limit" exceeds allowed values, the API may return an error.
Error messages:
"error": "Request failed with status code 401"
– Check your API credentials."error": "Unexpected token ... in JSON"
– Check that all JSON input fields are properly formatted."error": "Field 'xyz' does not exist"
– Verify that field names used in filters, sorts, or aggregations match your Directus schema.