Directus (denkhaus) icon

Directus (denkhaus)

Consume Directus API

Overview

This node allows you to create multiple user accounts in Directus at once by providing an array of user objects. It is useful for bulk onboarding scenarios, such as importing users from another system, initializing a new project with several team members, or automating the creation of test accounts.

Practical examples:

  • Migrating users from an old platform into Directus.
  • Setting up initial admin and regular user accounts during project setup.
  • Automating the creation of demo users for testing environments.

Properties

Name Meaning
Data (JSON) An array of partial user objects. Each object should include fields like email, password, and role. Example:

```json
[
{
"email": "admin@example.com",
"password": "p455w0rd",
"role": "c86c2761-65d3-43c3-897f-6f74ad6a5bd7"
},
{
"email": "another@example.com",
"password": "d1r3ctu5",
"role": "c86c2761-65d3-43c3-897f-6f74ad6a5bd7"
}
]
Each object must contain at least the required fields for user creation in Directus.

Output

The output will be a JSON array containing the created user objects as returned by the Directus API. Each object typically includes details such as:

  • id
  • email
  • role
  • status
  • first_name
  • last_name
  • other standard Directus user fields

Example output:

[
  {
    "id": "123",
    "email": "admin@example.com",
    "role": "c86c2761-65d3-43c3-897f-6f74ad6a5bd7",
    "status": "active",
    "first_name": null,
    "last_name": null
  },
  {
    "id": "124",
    "email": "another@example.com",
    "role": "c86c2761-65d3-43c3-897f-6f74ad6a5bd7",
    "status": "active",
    "first_name": null,
    "last_name": null
  }
]

Dependencies

  • Requires access to a Directus instance with appropriate permissions to create users.
  • May require an API key or authentication credentials configured in n8n for the Directus node.

Troubleshooting

Common issues:

  • Invalid JSON: If the "Data (JSON)" property is not valid JSON, the node will fail. Ensure your input is properly formatted.
  • Missing required fields: Each user object must include all required fields (email, password, role). Omitting these may result in errors from the Directus API.
  • Permission errors: The connected Directus account must have permission to create users; otherwise, you may receive authorization errors.
  • Duplicate emails: Attempting to create users with emails that already exist in Directus will likely cause errors.

Common error messages:

  • "Invalid JSON": Check your input formatting.
  • "Missing required field": Ensure each user object contains all necessary properties.
  • "Permission denied": Verify your Directus credentials and permissions.

Links and References

Discussion