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 Activity resource and the List operation, retrieves a list of activity records from a Directus instance. This is useful for monitoring or auditing changes, actions, or events that have occurred within your Directus-managed data.
Common scenarios:
- Fetching all activities for reporting or dashboarding.
- Filtering activities by specific criteria (e.g., user, date, type).
- Exporting activity logs in various formats (CSV, JSON, XML) for compliance or backup.
- Integrating activity streams into other workflows for notifications or further processing.
Practical example:
You might use this node to automatically export daily activity logs as CSV files and send them via email, or to trigger alerts when certain types of activities are detected.
Properties
| Name | Type | Meaning |
|---|---|---|
| Return All | boolean | If enabled, returns all available activity records; if disabled, limits the number of returned records according to the "Limit" property. |
| Limit | number | Maximum number of activity records to return (only used if "Return All" is false). Must be between 1 and 100. |
| Split Into Items | boolean | If enabled, outputs each activity record as a separate item in the workflow; otherwise, outputs all records as 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 enabled). |
| Additional Fields | collection | Extra options to refine the query, such as aggregation, export format, filtering, sorting, grouping, etc. See below for details on sub-fields. |
Additional Fields sub-options:
- Aggregate: Specify aggregation functions (count, sum, avg, min, max, etc.) and the field to apply them to.
- Binary Property for Export Data: Name of the binary property to store exported file data.
- Deep (JSON): Set nested query parameters for related datasets.
- Export: Choose export format (csv, json, xml) to save API response as a file.
- Fields: Specify which fields to include in the response.
- File Name for Export Data: File name (without extension) for exported data.
- Filter (JSON): Filter conditions as JSON.
- Group By: Group results by specified fields.
- Meta: Specify metadata to include in the response.
- Offset: Number of items to skip (for pagination).
- Search: Search string to filter activities.
- Sort: Sorting instructions (CSV of fields, with optional minus sign for descending order).
Output
- json: The main output contains the activity records retrieved from Directus. The structure depends on the Directus API but typically includes fields like
id,action,user,timestamp, etc.- If "Split Into Items" is enabled, each output item will contain a single activity record.
- If exporting, the output may also include:
- binary: Contains the exported file (CSV, JSON, or XML), stored under the property name specified in "Binary Property for Export Data".
Example output (simplified):
[
{
"json": {
"id": 123,
"action": "create",
"user": "john.doe",
"timestamp": "2024-06-01T12:34:56Z",
...
}
},
{
"json": {
"id": 124,
"action": "update",
"user": "jane.smith",
"timestamp": "2024-06-01T13:00:00Z",
...
}
}
]
If exporting:
[
{
"json": { ... },
"binary": {
"data": {
"data": "<Buffer ...>",
"fileName": "export.csv",
"mimeType": "text/csv"
}
}
}
]
Dependencies
- Directus API: Requires access to a running Directus instance.
- API Credentials: You must configure the
directusApicredentials in n8n with appropriate permissions to read activity data. - n8n Environment: No special environment variables required beyond standard n8n and credential setup.
Troubleshooting
Common issues:
- Authentication errors: Ensure your Directus API credentials are correct and have permission to access activity data.
- Invalid query/filter JSON: If you provide malformed JSON in "Query Parameters" or "Filter", the node will throw a parsing error. Double-check your JSON syntax.
- Export issues: If you select an export format but do not set up the binary property correctly, the exported file may not appear as expected.
- Limit exceeded: If you request more records than allowed (over 100 when "Return All" is false), the node will restrict the output.
Error messages:
"error": "Unexpected token ... in JSON at position ...": Indicates invalid JSON input in one of the fields."error": "Request failed with status code 401": Authentication failure—check your credentials."error": "Field ... does not exist": You may have specified a non-existent field in filters, sorting, or aggregation.