Directus (denkhaus) icon

Directus (denkhaus)

Consume Directus API

Overview

This n8n node is designed to create or upload files to a Directus instance. It allows users to send binary data (such as images, documents, etc.) from their workflow and store it as a file in Directus. This is particularly useful for automating content management workflows, such as uploading user-submitted files, synchronizing assets between systems, or archiving documents.

Example scenarios:

  • Uploading user profile pictures from a form submission.
  • Syncing files from another service (e.g., Dropbox, Google Drive) into Directus.
  • Automating the archival of generated reports or logs.

Properties

Name Type Meaning
Send Binary Data boolean Whether to upload/create a new file. Must be set to true to perform a file upload.
Binary Property string Name of the binary property which contains the data for the file to be uploaded. For multiple files, values can be provided as a comma-separated list (e.g., "binaryProperty1,binaryProperty2").
Additional Fields collection Allows specifying extra properties for the file object in JSON format. This can include metadata or other attributes as defined by the Directus file object.

Output

The node outputs a json field containing information about the uploaded file(s). The structure typically includes details such as:

{
  "id": "unique_file_id",
  "filename_download": "original_filename.ext",
  "type": "mime/type",
  "title": "File Title",
  "description": "Optional description",
  "filesize": 12345,
  "storage": "local",
  "location": "/uploads/...",
  // ...other Directus file object fields
}

If multiple files are uploaded, the output will be an array of such objects.

Note: If binary data is handled, it is used for upload only; the output is always JSON metadata about the uploaded file(s).

Dependencies

  • Directus API: Requires access to a Directus instance with appropriate permissions to create/upload files.
  • API Key / Authentication: The node must be configured with valid credentials for the Directus API.
  • n8n Binary Data: The workflow must provide binary data under the specified property name.

Troubleshooting

  • Missing Binary Data:
    Error: "No binary data property '...' exists on item!"
    Resolution: Ensure that the input item contains the correct binary property as specified in "Binary Property".

  • Authentication Errors:
    Error: "401 Unauthorized" or similar
    Resolution: Check your Directus credentials and ensure the account has permission to upload files.

  • Invalid File Object JSON:
    Error: "Invalid JSON in 'File Object (JSON)'"
    Resolution: Make sure any additional fields provided are valid JSON.

  • Large Files:
    Issue: Uploads may fail or timeout for very large files.
    Resolution: Check Directus and n8n server limits for file uploads.

Links and References

Discussion