GET/files/{file_id}/preview

Download File

Available for: Chatflow, Chatbot, Legacy Agent, Text Generator apps.

Returns the raw bytes of a file previously returned by Upload File. A file is reachable only through the app whose messages reference it.

3 parameters
file_idstringrequired
ID of the file to download, from the Upload File response.
as_attachmentbooleanoptional
When `true`, the file downloads as an attachment instead of rendering inline in the browser.
Default:false
userstringoptional
End-user identifier, defined by your app and unique within it. It has no effect on file access here, which is scoped by app and message rather than by `user`. See [End User Identity](/en/api-reference/guides/end-user-identity).

3 status codes
200Returns the raw file content. The `Content-Type` header is set to the file's MIME type. If `as_attachment` is `true`, the file is returned as a download with `Content-Disposition: attachment`.
403`file_access_denied` : The file exists but belongs to a different app or workspace.

One documented failure

  • file_access_denied

    Access to the requested file is denied.

    file_access_denied

404`file_not_found` : No file with this ID is reachable through this app's messages.

One documented failure

  • file_not_found

    The requested file was not found.

    file_not_found

Error handling

A 403 is returned: file_access_denied : The file exists but belongs to a different app or workspace. A 404 is returned: file_not_found : No file with this ID is reachable through this app's messages.