Directus icon

Directus

Consume Directus API

Overview

The "Invite User" operation in the Directus node allows you to send an invitation email to a new user, enabling them to join your Directus project with a specified role. This is useful for managing user access and onboarding new team members or collaborators efficiently.

Typical use cases include:

  • Automating user invitations during onboarding workflows.
  • Integrating user management with other systems to trigger invites dynamically.
  • Customizing invite links for specific user groups or campaigns.

For example, you can invite a new user by providing their email and assigning them a role such as "Editor" or "Admin". Optionally, you can specify a custom invite URL that the user will be directed to when they accept the invitation.

Properties

Name Meaning
Email The email address of the user to invite. This is required and identifies the recipient of the invitation.
Role The role ID assigned to the new user. This determines the permissions and access level the invited user will have.
Additional Fields Optional additional parameters:
Invite URL: A custom URL for the invitation link sent via email. The invite token will be appended as a parameter. Requires configuring an environment variable whitelist to enable.

Output

The output JSON contains the response from the Directus API after sending the invitation. It typically includes details about the invited user or confirmation of the invite action.

Example output structure (simplified):

{
  "id": "user-id",
  "email": "invited-user@example.com",
  "role": "role-id",
  "status": "invited",
  ...
}

No binary data is produced by this operation.

Dependencies

  • Requires a valid API key credential configured in n8n to authenticate requests to the Directus API.
  • To use a custom invite URL, the USER_INVITE_URL_ALLOW_LIST environment variable must be set on the Directus server to allow the specified URLs.

Troubleshooting

  • Invalid Role ID: If the provided role ID does not exist or is invalid, the API will return an error. Verify the role ID by listing roles before inviting users.
  • Email Delivery Issues: Invitations rely on Directus's email configuration. Ensure the Directus instance is properly set up to send emails.
  • Custom Invite URL Not Working: If using a custom invite URL, ensure it is included in the USER_INVITE_URL_ALLOW_LIST environment variable on the Directus server; otherwise, the invite link will default to the standard URL.
  • API Authentication Errors: Check that the API key credential used has sufficient permissions to invite users.

Links and References

Discussion