Download File
Available for: Workflow, Chatflow
Serves a file’s raw bytes for preview or download. The file must belong to the calling app, the environment, and the user.
Standard API equivalent: Download File. Differences:
- A
kindparameter selects the file source. useris required.- Error codes differ.
Authorizations
Every request authenticates with an API key: Authorization: Bearer {API_KEY}. App endpoints take an app API key; knowledge endpoints take a knowledge base API key (Get Started).
Keep keys server-side; never embed them in client code. Requests with a missing or invalid key fail with HTTP 401 (unauthorized).
Path Parameters
ID of the file to download. Two sources: the id returned by Upload File, and the upload_file_id of an entry in a message's message_files from List Conversation Messages. Tool-produced files need kind=tool.
Query Parameters
End-user identifier, defined by your app and unique within it. Must match the user that owns the file. See End User Identity.
1 - 255When true, the file downloads as an attachment instead of rendering inline in the browser.
File source. URLs returned in message payloads already carry the right value; set it manually only when constructing URLs yourself.
upload, tool Response
The raw file content. Content-Type is the file's own MIME type. When as_attachment is true, the response is sent as application/octet-stream with Content-Disposition: attachment. HTML files always download, whatever as_attachment says.
The response is of type file.