DatoCMS icon

DatoCMS

Interact with DatoCMS API

Overview

This node operation allows uploading files to DatoCMS, either from binary data available in the workflow or by providing a remote file URL. It supports organizing uploads into optional collections and can avoid duplicate uploads by skipping creation if a file with the same content already exists.

Common scenarios include:

  • Uploading images or documents generated or processed within an n8n workflow directly to DatoCMS.
  • Importing external files hosted on other servers by specifying their URLs.
  • Organizing uploaded assets into collections for better management inside DatoCMS.
  • Avoiding redundant uploads by checking for existing identical files.

Practical example:

  • A marketing automation workflow generates images dynamically and uploads them as assets to DatoCMS for use in a website.
  • A data import workflow fetches product images from supplier URLs and uploads them to DatoCMS, optionally grouping them into a specific collection.

Properties

Name Meaning
Upload Source Choose the source of the file to upload: Binary Data (upload from binary data in the workflow) or URL (upload from a remote URL).
Binary Property (Shown if Upload Source is Binary Data) The name of the binary property in the input data that contains the file to upload. Default is "data".
File URL (Shown if Upload Source is URL) The URL of the file to upload. Must be a valid HTTP/HTTPS URL.
Skip Creation If Already Exists Whether to skip creating a new upload if a file with the same content already exists in DatoCMS. Defaults to true.
Upload Collection Optional: Select or specify an upload collection to organize the uploaded file within DatoCMS. Can be selected from a list or specified by ID.
Include Other Input Fields Whether to include all other input fields from the workflow's input data in the output along with the upload result. Defaults to false.

Output

The node outputs JSON data representing the uploaded file's metadata as returned by the DatoCMS API. This typically includes details such as the upload ID, filename, URL, size, and any associated collection information.

If "Include Other Input Fields" is enabled, the output JSON will also contain all original input fields merged with the upload metadata.

The node does not output binary data directly; it only handles uploading binary data or URLs and returns metadata about the created upload.

Dependencies

  • Requires an API authentication token credential for DatoCMS with permissions to create uploads.
  • Uses the official DatoCMS Node.js client library internally.
  • Temporary local file storage is used when uploading from binary data (the binary content is written to a temporary file before upload).
  • No additional environment variables are required beyond the configured API credentials.

Troubleshooting

  • Missing or invalid binary property: If the specified binary property does not exist or is empty, the node will throw an error. Ensure the binary data is correctly passed into the node and the property name matches.
  • Invalid or missing file URL: When using URL upload source, the file URL must be a valid HTTP or HTTPS URL. An empty or malformed URL will cause an error.
  • Insufficient permissions: If the API token lacks permissions to create uploads or access upload collections, errors related to authorization will occur.
  • Temporary file write/delete errors: On some systems, writing or deleting the temporary file may fail due to permission issues. Ensure the n8n process has appropriate filesystem access.
  • Duplicate uploads skipped: If "Skip Creation If Already Exists" is enabled, the node will not create a new upload if the file content already exists in DatoCMS. This is expected behavior but may confuse users expecting a new upload every time.

Links and References

Discussion