Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Users → Invite User

AI-generated

Overview

The Invite User operation for the Users resource in this custom n8n Directus node allows you to invite a new user to your Directus instance by specifying their email and role. This triggers Directus to send an invitation email to the specified address, optionally using a custom invite URL if configured. This is useful for automating onboarding workflows, such as inviting new team members or external collaborators to your Directus-managed projects.

Practical examples:

  • Automatically invite new employees to your Directus system when they are added to your HR database.
  • Onboard clients or partners by sending them invitations with specific roles via automated workflows.
  • Integrate with signup forms to trigger user invites based on form submissions.

Properties

Name Type Meaning
Email string The email address of the user to invite. This is where the invitation will be sent.
Role string The role ID to assign to the invited user. Determines the user's permissions upon accepting the invite.
Additional Fields collection Optional fields for further customization. Includes:
- Invite URL (string): A custom URL for the invite link in the email. Requires configuration of the USER_INVITE_URL_ALLOW_LIST environment variable.

Output

The output is a JSON object containing the result of the invite operation. Typically, it includes details about the invitation or the invited user as returned by the Directus API. The exact structure depends on the Directus version and configuration, but generally you can expect fields such as:

{
  "id": "unique-invite-id",
  "email": "invited.user@example.com",
  "role": "role-id",
  // ...other metadata from Directus response
}

If an error occurs and "Continue On Fail" is enabled, the output will include an error message:

{
  "error": "Error message text"
}

Dependencies

  • Directus API: You must have access to a running Directus instance.
  • API Credentials: The node requires valid Directus API credentials (directusApi).
  • Environment Variable (optional): To use a custom invite URL, configure the USER_INVITE_URL_ALLOW_LIST environment variable in your Directus instance as described in the Directus documentation.

Troubleshooting

Common issues:

  • Invalid Email or Role: If the provided email or role ID is invalid, the Directus API will return an error.
  • Missing Permissions: The API credentials used must have permission to invite users; otherwise, you'll receive a permission error.
  • Custom Invite URL Not Working: If you specify a custom invite URL without configuring USER_INVITE_URL_ALLOW_LIST, the request may fail or the invite link may not work as expected.
  • Email Delivery Issues: If Directus is not configured correctly for email delivery, the invite email may not be sent.

Common error messages:

  • "error": "Request failed with status code 400" – Check that all required fields are filled and valid.
  • "error": "Permission denied" – Ensure your API credentials have sufficient rights.
  • "error": "Custom invite URL not allowed" – Make sure USER_INVITE_URL_ALLOW_LIST is set up properly.

Links and References

Discussion