Directus (DrWade) icon

Directus (DrWade)

Consume Directus API

Users → Delete

AI-generated

Overview

The Directus (DrWade) n8n node for the resource Users with the operation Delete allows you to delete a user from your Directus instance by specifying their unique ID. This is useful in automation scenarios where you need to programmatically remove users, such as cleaning up test accounts, managing access, or synchronizing user data between systems.

Practical examples:

  • Automatically removing users who have been deactivated in another system.
  • Cleaning up users after a project ends.
  • Enforcing compliance by deleting users upon request.

Properties

Name Type Meaning
ID String Primary key of the user to be deleted. This should be the unique identifier (UUID) of the user in Directus.

Output

  • The output will be a single object with a json field.
  • The structure of the json field typically contains the response from the Directus API after attempting to delete the user. If the deletion is successful, it may be an empty object {} or contain metadata about the operation.
  • If an error occurs and "Continue On Fail" is enabled, the output will include an error property with the error message.

Example output on success:

{
  "json": {}
}

Example output on failure (with Continue On Fail):

{
  "json": {
    "error": "User not found"
  }
}

Dependencies

  • Directus API: You must have a running Directus instance accessible via HTTP(S).
  • API Credentials: The node requires valid Directus API credentials (directusApi) configured in n8n.
  • n8n Configuration: Ensure the credentials are set up in the n8n credential store.

Troubleshooting

Common issues:

  • Invalid or missing ID: If the provided ID does not correspond to an existing user, the API will return an error (e.g., "User not found").
  • Insufficient permissions: The API credentials used must have permission to delete users; otherwise, you may receive a "Forbidden" or "Unauthorized" error.
  • Network/API errors: Connectivity issues or incorrect API URLs can result in connection errors.

Error messages and resolutions:

  • "User not found": Check that the ID is correct and the user exists.
  • "Forbidden" or "Unauthorized": Verify that the API credentials have sufficient permissions.
  • "Request failed with status code 404": The user ID does not exist in the Directus instance.

Links and References

Discussion