Import File (v2)
The Import File node in Automations v2 downloads a file from a URL and saves it on your site. Use it to download a partner's daily price list from their API, a report from a vendor portal, or a file whose URL an external system sends to a Webhook trigger, without a script or a Remote Server connection to that system.
Import File accepts file items or data items. For each incoming item it makes a request and saves a file at each configured target. A Webhook trigger delivering 20 orders can therefore import 20 files with one target per order, or 40 files with two targets per order.
Settings
The URL is the address to download from, and it accepts a TransformScript template, so https://api.example.com/orders/{{ payload.order_id }}.pdf imports a different file for each item. The request method is GET by default, and POST is available when the endpoint needs a request body. Request headers take static names with templated values, which is how an API token or a date is sent, and the request content for a POST is a template as well.
The import URL must be reachable over the public internet. Files.com checks the destination when it makes each request, after the URL's template is evaluated and the hostname is resolved. Requests to private, loopback, or link-local addresses are refused, including redirects to those addresses. These checks apply to every import URL in every Workspace, regardless of how the Automation is configured.
Saving the Automation does not check the URL's destination. The template can produce a different URL for each item, and its destination address is determined at runtime, so a successful save does not confirm that the import can run.
Files.com follows redirects from the import URL. The configured headers are sent only to that URL's origin: its scheme (http or https), host, and port. When a redirect leads to another origin, Files.com follows it without the configured headers. This lets an API check your credentials and redirect to a file on a separate storage service without sending your API token to that service.
Each destination is the full path of a file to save, including its filename, for example /imports/{{ payload.order_id }}.pdf. A node can have several targets, and every target accepts TransformScript path templates. With no targets specified, Import File uses the last filename segment of the URL and saves it at the Automation's Workspace root, or the site root in the default Workspace.
Several Requests or One Download
Each target causes a separate request and upload for each incoming item. Two targets mean two requests, even when the URL, headers, and content are the same. An endpoint can return different contents or perform an action on each request, so several targets do not guarantee several copies of one response.
To distribute the same downloaded file, configure one Import target and follow it with Copy File using several destinations. Use several Import targets when separate requests are intended. For example, one incoming order with /imports/{{ payload.order_id }}.pdf and /archive/{{ payload.order_id }}.pdf makes two requests and supplies two successful file results for later processing.
All target templates are evaluated before importing for that item begins. An empty resolved filename path fails the item without starting any of its requests. The final paths are still checked against the Automation's permissions and Workspace boundary.
What the Next Node Receives
Import File passes on one file item for each file it successfully saved, so the imported files can be converted, decrypted, or moved by the nodes that follow. Each result is now the current file: its attributes describe the saved file, and its payload is the imported contents rather than the data that requested the import.
Errors
A request that fails, returns an error status, or is refused because of its destination fails that item. The error is recorded in run detail. Error Handling rules on the node determine what happens to a failed item.