Actions109
- Activity Actions
- Assets Actions
- Authentication Actions
- Collections Actions
- Extensions Actions
- Fields Actions
- Files Actions
- Folders Actions
- Items Actions
- Permissions Actions
- Presets Actions
- Relations Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
- Webhooks Actions
Overview
This node integrates with the Directus API to manage files within a Directus project. Specifically, for the Files resource and the Create / Upload operation, it allows users to upload new files to the Directus system. The node supports uploading files either by sending binary data directly from the workflow or by creating file entries with metadata.
Common scenarios where this node is beneficial include:
- Automating file uploads to a Directus-managed media library.
- Integrating external file sources into Directus by uploading files programmatically.
- Creating file records with additional metadata in Directus for use in content management workflows.
Practical example:
- A user has a workflow that processes images and wants to upload the processed images automatically to Directus. By enabling "Send Binary Data" and specifying the binary property containing the image data, the node uploads these images as new files in Directus.
Properties
| Name | Meaning |
|---|---|
| Send Binary Data | Boolean option to choose whether to upload a file using binary data from the workflow (true) or create/upload a file entry without binary data (false). |
| Binary Property | (Required if "Send Binary Data" is true) The name(s) of the binary property(ies) in the input data that contain the file data to be uploaded. Multiple properties can be specified separated by commas. |
| Additional Fields | Optional collection of additional fields to set on the file object during creation. This includes a JSON field named "File Object (JSON)" where users can specify other properties of the file object according to Directus API. |
Output
The node outputs the response from the Directus API after the file creation/upload request. The output JSON contains the details of the created file object as returned by Directus, including metadata such as file ID, filename, URL, size, type, and any other properties set.
If binary data was sent, the node handles the upload accordingly but the output remains the JSON representation of the created file record.
Dependencies
- Requires an active connection to a Directus instance via an API key or token credential configured in n8n.
- The node uses Directus REST API endpoints for file management.
- No additional external dependencies beyond the Directus API and n8n's built-in HTTP request capabilities.
Troubleshooting
- Missing or incorrect binary property: If "Send Binary Data" is enabled but the specified binary property does not exist or is empty in the input data, the upload will fail. Ensure the binary property name matches exactly and contains valid file data.
- Invalid JSON in Additional Fields: When providing JSON in the "File Object (JSON)" field, invalid JSON syntax will cause errors. Validate JSON before input.
- API authentication errors: Ensure the Directus API credentials are correctly configured and have permissions to upload files.
- File size limits: Large files may exceed Directus or network limits; check Directus server settings and n8n timeout configurations.
- Error messages from Directus API: These will typically be passed through in the node output under an error message. Review the message for clues (e.g., permission denied, invalid file format).
Links and References
- Directus Files API documentation:
https://docs.directus.io/reference/api/system/files/#the-file-object - Directus official website:
https://directus.io/ - n8n Documentation on working with binary data:
https://docs.n8n.io/nodes/working-with-binary-data/