Directus icon

Directus

Consume Directus API

Overview

The Directus Users - Create operation in this n8n node allows you to create a new user in a Directus instance. This is useful for automating user onboarding, integrating external registration forms, or batch-creating users from other systems into your Directus project.

Practical examples:

  • Automatically add new users when someone signs up on your website.
  • Migrate users from another system into Directus.
  • Batch-create admin or editor accounts as part of a setup workflow.

Properties

Name Type Meaning
Email string The email address for the new user. Required.
Password string The password for the new user. Required.
JSON/RAW Parameters boolean If enabled, allows you to provide all body parameters as raw JSON instead of using individual fields.
Body Parameters json (Shown if JSON/RAW Parameters is true) The full user object as JSON. Allows advanced or bulk property setting.
Additional Fields collection (Shown if JSON/RAW Parameters is false) Optional extra properties for the user, such as avatar, description, first/last name, language, location, role, tags, TFA secret, theme, and title. See below for details.

Additional Fields options include:

  • Avatar: Avatar file ID (string)
  • Description: User description (string)
  • First Name: User's first name (string)
  • Language: UI language code (string)
  • Last Name: User's last name (string)
  • Location: User's location (string)
  • Role: Role ID (options, loaded dynamically)
  • Tags: Tags for the user (string)
  • TFA Secret: Two-factor authentication secret (string)
  • Theme: UI theme ("auto", "light", "dark")
  • Title: User's title (string)

Output

  • The output will be a single json object representing the created user, as returned by the Directus API.
  • The structure typically includes fields like id, email, first_name, last_name, role, etc., depending on what was provided and what Directus returns.
  • Example output:
    {
      "id": "123",
      "email": "[email protected]",
      "first_name": "John",
      "last_name": "Doe",
      "role": "editor",
      ...
    }
    

Dependencies

  • Directus API: You must have access to a running Directus instance.
  • API Credentials: The node requires valid Directus API credentials (directusApi) configured in n8n.
  • User Permissions: The API user must have permission to create users in Directus.

Troubleshooting

  • Missing required fields: If "Email" or "Password" are not provided (when not using JSON/RAW), the request will fail.
  • Invalid JSON: If using "JSON/RAW Parameters" and the JSON is malformed, an error will occur.
  • Permission errors: If the API credentials lack sufficient permissions, you may receive a "Forbidden" or "Unauthorized" error from Directus.
  • Duplicate email: Attempting to create a user with an existing email may result in a conflict error.

Common error messages:

  • 400 Bad Request: Usually due to missing or invalid input fields.
  • 401 Unauthorized / 403 Forbidden: Check your API credentials and permissions.
  • 409 Conflict: Email already exists.

Links and References

Discussion