Download Attachment
download_attachment · Nodes · Media
Downloads a file from a URL into a Library item.
Download Attachment#
Downloads a file from a URL straight into a Library item and outputs the item's object descriptor, the same descriptor an upload produces.
Inputs#
url- required. The file's URL, fetched with aGET.filename- optional. Names the item whennameis empty. Without either, the last path segment of the URL is used, unless that segment is empty or contains?or#; then the item is nameddownload.content_type- optional. Overrides the stored MIME type. Without it, the response'sContent-Typeis used without its parameters.
Configuration#
name- the Library item's name, with{{ }}interpolation over the inputs. Empty takes thefilenameinput, else the URL's last segment.place- defaults to Folder (folder). Choose Other (other) to file the item outside every folder.folder- folder slugs or ids from the Library root, separated by/, with interpolation. Every folder must already exist. Use the Library node's Create Folder first if you need a new folder.max_size_mb- largest file saved, in MB, from1to2048(2 GiB). Default50. A response whoseContent-Lengthis larger is refused before anything is read; a body without aContent-Lengthis stopped as soon as it passes the limit. A value outside the range is reported when the workflow is validated, and the step fails.retry- whether the download is sent again after a failure that passes: a rate limit, a busy server, a dropped connection. Off by default; see Retries. The fetch is aGET, a read, so it is sent again freely.
Outputs#
media- the saved item's object descriptor:
{
"object_id": "01J...",
"filename": "invoice.pdf",
"content_type": "application/pdf",
"size_bytes": 48213,
"metadata": {}
}
success-truewhen the file was saved,falsewhen a download error is returned onerror.error- the failure message when the download failed.
An error before saving the file, such as a non-success HTTP status or an oversized Content-Length, returns success: false and an error message, and skips media. A blank or missing folder, or a Library save error, fails the node and follows its failure mode. On success, error is skipped.
Route to error output#
With the failure mode set to Route to error output (base_config.failure_mode: "route_to_error"), a failed download fails the node instead of returning success: false. media and success are skipped, and error carries the node error value (node_id, node_type, message, causes) in place of the text. The run records the node as failed with its error routed and completes with warnings.
Behavior#
- The body streams into storage as it arrives; it is never held whole in memory, so a file up to the 2 GiB cap fits.
- There is no total time limit on the download. Each connection attempt has 30 seconds, and the download fails when nothing arrives for 60 seconds. The workflow's own timeout bounds the whole run.
- A failed save leaves nothing behind: no item, no partial object, and no storage quota used.
- The URL and any redirect from it go through the workspace's outbound address policy; a URL that resolves to a non-public address is refused without connecting when that policy allows public addresses only.
- A response that is not a success status fails the download with
HTTP error: <status>.
Runtime Errors#
| Error | Cause |
|---|---|
Missing required input: url |
Nothing reached the url input. This fails the step. |
Maximum file size must be between 1 and 2048 MB |
max_size_mb is out of range. This fails the step. |
Choose a folder, or choose Other to file the item outside every folder. |
Folder was selected but no path was given. This fails the step. |
Invalid attachment URL |
The URL could not be parsed. |
URL resolves to a non-public address |
The URL points at an internal address. |
HTTP error: <status> |
The server answered with a non-success status. |
File too large: ... |
The response's Content-Length is larger than max_size_mb. |
| Any other message | The Library could not save the file. The node fails if a folder is missing, the body grows past max_size_mb, the storage quota is full, the download stalls, or storage fails. |
Inputs
urlRequiredfilenameOptionalcontent_typeOptional
Outputs
mediasuccesserror
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
max_size_mb | integer | No | Largest file to save, in MB, from 1 to 2048 |
name | text_block | No | The Library item's name. Empty takes the filename input, else the URL's last segment. |
place | enum(folder, other) | No | |
folder | text_block | No | Folder slugs or ids from the Library root, separated by /. Every folder must already exist; nothing is created on the way. Create a folder first with the Library node's Create Folder. |
retry | tagged_union | No | Sends a request again after a failure that passes: a rate limit, a busy server, a dropped connection. Off sends once. |
base_config | record | No | Shared node configuration. failure_mode decides what a failure of this node does to the workflow; leave it at the default stop unless the workflow handles the failure itself on the node's error output (route_to_error) or the node is a rare emergency kill switch (stop_workflow). |