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 Resource: Collection and Operation: List, retrieves a list of all collections from a connected Directus instance. This operation is useful for automation scenarios where you need to dynamically access metadata about available collections (tables) in your Directus project, such as generating documentation, building dynamic forms, or orchestrating data flows that depend on collection structure.
Practical examples:
- Fetching all collections to display them in a dashboard.
- Using the output to drive further automation, such as iterating over each collection to perform additional operations.
- Integrating with other systems that require knowledge of available data structures in Directus.
Properties
Name | Type | Meaning |
---|---|---|
Split Into Items | Boolean | If enabled, outputs each collection as a separate item; otherwise, returns all collections in a single item. |
Output
- If Split Into Items is
false
(default):- The node outputs a single item whose
json
field contains an array of collection objects, each representing a collection's metadata as returned by the Directus API.
- The node outputs a single item whose
- If Split Into Items is
true
:- The node outputs one item per collection, each with its
json
field containing a single collection object.
- The node outputs one item per collection, each with its
Example output (Split Into Items = false):
{
"json": [
{
"collection": "articles",
"meta": { /* ... */ },
"schema": { /* ... */ }
// ...other fields
},
{
"collection": "users",
"meta": { /* ... */ },
"schema": { /* ... */ }
// ...other fields
}
// ...
]
}
Example output (Split Into Items = true):
{
"json": {
"collection": "articles",
"meta": { /* ... */ },
"schema": { /* ... */ }
// ...other fields
}
}
(One item like this per collection)
Dependencies
- Directus API: Requires a valid connection to a Directus instance.
- Credentials: You must configure the
directusApi
credentials in n8n with appropriate API URL and authentication details.
Troubleshooting
Common issues:
- Invalid Credentials: If the Directus API credentials are incorrect or missing, the node will fail to connect.
- Insufficient Permissions: The API user must have permission to read collections; otherwise, the request may fail with an authorization error.
- API Unreachable: Network issues or incorrect API URLs can cause connection failures.
Error messages and resolutions:
"401 Unauthorized"
: Check your Directus API credentials and permissions."404 Not Found"
: Verify the API URL and ensure the Directus instance is running."ECONNREFUSED"
or network errors: Ensure the Directus server is accessible from the n8n environment.