Directus icon

Directus

Consume Directus API

Overview

The Webhooks → Delete Multiple operation in this n8n node allows you to delete multiple webhook records from a Directus instance in a single API call. This is particularly useful for bulk management tasks, such as cleaning up obsolete webhooks or removing test hooks after development.

Practical scenarios:

  • Removing all webhooks associated with deprecated integrations.
  • Cleaning up test or temporary webhooks after QA cycles.
  • Bulk deleting webhooks that are no longer needed due to changes in business logic.

Properties

Name Type Meaning
Keys (JSON) JSON An array of webhook primary keys. These are the unique identifiers of the webhooks you want to delete. Example: [2, 15, 41]

Output

The output will be an object in the json field containing the response from the Directus API after attempting to delete the specified webhooks. The structure typically looks like:

{
  // Response data from Directus, often an empty object or a summary of deleted items
}

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

{
  "error": "Error message here"
}

Dependencies

  • Directus API: You must have access to a Directus instance.
  • API Credentials: The node requires valid Directus API credentials (directusApi) configured in n8n.

Troubleshooting

Common issues:

  • Invalid Keys Format: If the "Keys (JSON)" property is not a valid JSON array, the node will throw a parsing error. Ensure you input something like [1,2,3].
  • Non-existent Webhook IDs: If any provided key does not correspond to an existing webhook, Directus may return an error or ignore those IDs.
  • Insufficient Permissions: The API user must have permission to delete webhooks; otherwise, you'll receive an authorization error.
  • Malformed JSON: If the input is a string but not valid JSON, the node will fail to parse it.

Error messages and resolutions:

  • "Unexpected token ... in JSON": Check your "Keys (JSON)" input for correct JSON syntax.
  • "You do not have permission to perform this action": Verify your Directus API credentials and permissions.
  • "Not found": One or more webhook IDs do not exist; double-check the IDs.

Links and References

Discussion