Directus icon

Directus

Consume Directus API

Overview

The Users: List operation in this n8n node allows you to retrieve a list of users from a Directus instance. This is useful for automating user management tasks, synchronizing user data with other systems, or generating reports on user activity. For example, you might use this node to fetch all users and send them a notification, export user lists for analysis, or integrate user data into another application.

Properties

Name Type Meaning
Return All boolean If enabled, returns all user records. If disabled, only up to the specified limit will be returned.
Limit number The maximum number of user records to return (only shown if "Return All" is false). Must be between 1 and 100.
Split Into Items boolean If enabled, outputs each user as a separate item; otherwise, all users are returned in a single array.
JSON/RAW Parameters boolean If enabled, allows setting query/body parameters via raw JSON instead of the UI fields.
Body Parameters json Raw JSON body parameters for advanced queries (shown if "JSON/RAW Parameters" is true).
Additional Fields collection Extra options for filtering, sorting, aggregating, exporting, and customizing the response. Includes: Aggregate, Binary Property for Export Data, Deep (JSON), Export, Fields, File Name for Export Data, Filter (JSON), Group By, Meta, Offset, Search, Sort.
Aggregate fixedCollection Aggregation functions (e.g., count, sum, avg) to perform calculations on user data.
Binary Property for Export Data string Name of the binary property to store exported file data.
Deep (JSON) json Allows setting nested relational query parameters.
Export options Format to export the API response (json, csv, xml).
Fields string Specifies which fields to include in the response.
File Name for Export Data string File name (without extension) for exported data.
Filter (JSON) json Conditions to filter users by.
Group By string Field(s) to group results by for aggregation.
Meta string Metadata to include in the response.
Offset number Number of items to skip (for pagination).
Search string Search term to filter users by matching fields.
Sort string Sorting order for the returned users.

Output

  • json:
    • If "Split Into Items" is enabled, each output item contains a single user's data as an object.
    • If not, the output is a single item with a json field containing an array of user objects.
    • If "Export" is used, the output may also contain a binary property with the exported file (CSV, JSON, or XML format).

Example Output (Split Into Items = true)

[
  {
    "json": {
      "id": 1,
      "email": "[email protected]",
      "first_name": "User",
      "last_name": "One"
      // ...other user fields
    }
  },
  {
    "json": {
      "id": 2,
      "email": "[email protected]",
      "first_name": "User",
      "last_name": "Two"
      // ...other user fields
    }
  }
]

Example Output (Split Into Items = false)

[
  {
    "json": [
      {
        "id": 1,
        "email": "[email protected]"
        // ...
      },
      {
        "id": 2,
        "email": "[email protected]"
        // ...
      }
    ]
  }
]
  • binary (optional):
    If "Export" is selected, the output includes a binary property containing the exported file data.

Dependencies

  • Directus API: Requires access to a running Directus instance.
  • API Credentials: You must configure the directusApi credentials in n8n with appropriate permissions to read user data.

Troubleshooting

  • Authentication Errors:

    • Error: "Invalid credentials" or similar.
      Resolution: Check your Directus API credentials in n8n.
  • Permission Denied:

    • Error: "You do not have permission to access this resource."
      Resolution: Ensure the API user has permission to list users in Directus.
  • Malformed JSON:

    • Error: "Unexpected token ..." when using JSON/RAW Parameters.
      Resolution: Double-check that your JSON input is valid.
  • Empty Results:

    • Possible Cause: Filters or search terms are too restrictive.
      Resolution: Adjust filters or remove them to broaden the search.
  • Export Issues:

    • Error: No binary output or file is empty.
      Resolution: Ensure "Export" option is set correctly and there is data to export.

Links and References

Discussion