Directus icon

Directus

Consume Directus API

Overview

The Directus Webhooks - List operation in this n8n node allows you to retrieve a list of webhooks from a Directus instance. This is useful for automating the management, monitoring, or auditing of webhook configurations within your Directus project. Common scenarios include:

  • Fetching all configured webhooks for documentation or review.
  • Filtering and exporting webhook data for backup or migration.
  • Integrating with other systems that need to be aware of available webhooks.

Practical examples:

  • Automatically export all webhooks as a CSV file for compliance purposes.
  • Retrieve only a subset of webhooks matching certain criteria (e.g., by name or event).
  • Split the result so each webhook is processed individually in subsequent workflow steps.

Properties

Name Type Meaning
Return All boolean If enabled, returns all webhooks; if disabled, limits the number of results according to the "Limit" property.
Limit number The maximum number of webhooks to return when "Return All" is disabled. Must be between 1 and 100.
Split Into Items boolean If enabled, outputs each webhook as a separate item, allowing downstream nodes to process them individually.
JSON/RAW Parameters boolean If enabled, query/body parameters are set via a JSON object instead of individual UI fields.
Body Parameters json When using JSON/RAW Parameters, this field allows specifying body parameters as a JSON object.
Additional Fields collection Extra options for filtering, sorting, grouping, aggregating, exporting, and more. Includes sub-properties such as Aggregate, Export, Filter, Group By, Meta, Offset, Search, Sort, etc.
Aggregate fixedCollection Allows performing aggregation functions (count, sum, avg, min, max, etc.) on specified fields.
Binary Property for Export Data string Name of the binary property to which exported data will be attached (when exporting as file).
Deep (JSON) json Allows setting nested query parameters for relational datasets.
Export options If set, saves the API response to a file in one of the supported formats: csv, json, or xml.
Fields string Specifies which fields should be returned in the webhook objects.
File Name for Export Data string Sets the filename (without extension) for exported data files.
Filter (JSON) json Filters webhooks based on provided conditions.
Group By string Groups results by specified fields, useful for aggregation.
Meta string Specifies what metadata to include in the response.
Offset number Skips the given number of items before returning results (for pagination).
Search string Returns only webhooks containing the search query in any of their fields.
Sort string Specifies sorting order for the returned webhooks. Accepts CSV of fields, minus sign for descending, question mark for random.

Output

  • json:
    • If "Split Into Items" is enabled, each output item contains a single webhook object in its json property.
    • If not split, the json property contains an array or object representing the list of webhooks.
    • If "Export" is used, the output may also include a binary property containing the exported file (CSV, JSON, or XML), with the file named according to the "File Name for Export Data" and stored under the specified "Binary Property for Export Data".

Example output (not split):

{
  "json": {
    "id": "webhook_id",
    "name": "Webhook Name",
    "url": "https://example.com/webhook",
    ...
  }
}

or (split into items):

{
  "json": {
    "id": "webhook_id_1",
    "name": "Webhook 1",
    ...
  }
}
{
  "json": {
    "id": "webhook_id_2",
    "name": "Webhook 2",
    ...
  }
}

If exporting:

{
  "json": { ... },
  "binary": {
    "data": {
      "data": "<Buffer ...>",
      "fileName": "export.csv",
      "mimeType": "text/csv"
    }
  }
}

Dependencies

  • Directus API: Requires access to a Directus instance with appropriate credentials (API key or user authentication).
  • n8n Credentials: You must configure the "directusApi" credential in n8n for the node to authenticate requests.

Troubleshooting

  • Authentication errors: Ensure your Directus credentials are correct and have permission to list webhooks.
  • Invalid JSON: If using JSON/RAW Parameters, ensure your JSON syntax is valid; otherwise, parsing errors will occur.
  • Empty results: Check your filter, search, or limit settings if no webhooks are returned.
  • Export issues: If exporting, verify that the "Binary Property for Export Data" and "File Name for Export Data" are set correctly and that the workflow has permissions to handle binary data.
  • Common error messages:
    • "error": "Request failed with status code 401": Authentication issue.
    • "error": "Unexpected token ... in JSON": Malformed JSON input.
    • "error": "limit must be between 1 and 100": Provided limit is out of range.

Links and References

Discussion