Actions109
- Activity Actions
- Assets Actions
- Authentication Actions
- Collections 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
Permissions → Create
AI-generatedOverview
The Directus (DrWade) n8n node for the resource Permissions with the operation Create allows you to create new permission rules in a Directus instance. This is useful for programmatically managing access control, such as granting or restricting CRUD (Create, Read, Update, Delete) operations on specific collections for different roles or users.
Common scenarios:
- Automating the setup of permissions when deploying new collections.
- Granting temporary or dynamic access rights based on workflow logic.
- Integrating permission management into CI/CD pipelines for Directus projects.
Practical example:
You could use this node in an onboarding workflow to automatically grant a new user group "read" access to the "customers" collection upon creation.
Properties
| Name | Type | Meaning |
|---|---|---|
| Collection | options | The collection in Directus to which this permission rule will apply. |
| Action | options | The CRUD operation this permission grants (create, read, update, delete). |
| JSON/RAW Parameters | boolean | If enabled, allows specifying body parameters as raw JSON instead of using individual fields. |
| Body Parameters | json | (Shown if JSON/RAW Parameters is true) The full set of body parameters as JSON or RAW input. |
Output
- The output is a
jsonobject representing the created permission rule as returned by the Directus API. - The structure typically includes fields such as:
id: Unique identifier for the permission rule.collection: The collection the permission applies to.action: The CRUD action (e.g., "create").- Other metadata and configuration as defined by Directus.
Example output:
{
"id": 1,
"collection": "customers",
"action": "create",
"role": "12345678-abcd-efgh-ijkl-1234567890ab",
"permissions": { /* ... */ },
"fields": "*",
"validation": null,
"presets": {},
"limit": null
}
Note: The actual fields depend on your Directus instance and the data provided.
Dependencies
- External Service: Requires access to a Directus instance (API endpoint).
- Authentication: Needs valid Directus API credentials configured in n8n under the name
directusApi. - n8n Configuration: No special environment variables required beyond standard credential setup.
Troubleshooting
Common issues:
- Missing or invalid credentials: Ensure the Directus API credentials are correctly set up in n8n.
- Invalid collection or action: Double-check that the specified collection exists and the action is one of the allowed values.
- Malformed JSON: If using JSON/RAW Parameters, ensure the JSON is properly formatted.
Error messages:
"Cannot read property 'collection' of undefined": Likely due to missing or incorrect input for the Collection field."Request failed with status code 401": Authentication issue; check your API credentials."400 Bad Request": Usually indicates malformed input or missing required fields.
How to resolve:
- Verify all required properties are filled.
- Use the "JSON/RAW Parameters" option only if you are comfortable providing raw JSON.
- Check the Directus API documentation for required fields and formats.