Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Collections → List

AI-generated

Overview

The Directus (DrWade) n8n node for the resource Collections with the operation List allows you to retrieve a list of all collections from your Directus instance. This is useful for automation scenarios where you need to dynamically access, enumerate, or process metadata about available collections in your Directus project.

Common use cases:

  • Generating documentation or reports about your data model.
  • Building dynamic workflows that adapt to changes in your Directus schema.
  • Integrating with other systems that require knowledge of available collections.

Practical example:
You might use this node at the start of a workflow to fetch all collections, then loop through them to perform further actions such as exporting their structure or contents.


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 output will be a single item with a json field containing an array of collection objects, each representing a collection's metadata as returned by the Directus API.

  • If Split Into Items is true:
    Each collection will be output as a separate item, with its metadata in the json field.

Example output when Split Into Items is false:

{
  "json": [
    {
      "collection": "articles",
      "meta": { /* ... */ },
      "schema": { /* ... */ }
      // ...other fields
    },
    {
      "collection": "users",
      "meta": { /* ... */ },
      "schema": { /* ... */ }
      // ...other fields
    }
    // ...
  ]
}

Example output when Split Into Items is true:

{
  "json": {
    "collection": "articles",
    "meta": { /* ... */ },
    "schema": { /* ... */ }
    // ...other fields
  }
}
// Next item:
{
  "json": {
    "collection": "users",
    "meta": { /* ... */ },
    "schema": { /* ... */ }
    // ...other fields
  }
}

Dependencies

  • Directus API: Requires a valid Directus instance and API credentials configured in n8n under the name directusApi.
  • n8n Configuration: You must set up the Directus credentials in your n8n instance before using this node.

Troubleshooting

Common issues:

  • Invalid Credentials: If your Directus API credentials are incorrect or missing, the node will fail with an authentication error.
  • Network Issues: If n8n cannot reach your Directus instance (wrong URL, firewall, etc.), you'll receive connection errors.
  • API Permissions: The user associated with your API key must have permission to read collections; otherwise, you may get authorization errors.

Error messages and resolutions:

  • "401 Unauthorized": Check your Directus API credentials in n8n.
  • "404 Not Found": Ensure the Directus API URL is correct and accessible.
  • "Cannot read properties of undefined": This may occur if the API response format changes or is empty—verify your Directus instance is running and has collections.

Links and References

Discussion