---
title: "Download File"
method: GET
path: "/files/{file_id}/preview"
tags: ["Files"]
---

# Download File

`GET /files/{file_id}/preview`

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

Returns the raw bytes of a file previously returned by [Upload File](/en/api-reference/files/upload-file). A file is reachable only through the app whose messages reference it.

## Path parameters

- `file_id` string, uuid, required

## Query parameters

- `as_attachment` boolean
- `user` string

## Response `200`

Returns 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`.

## Other responses

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

---

[API](https://skmtc.net/langgenius/apis/dify-service-api.md) · [All operations](https://skmtc.net/langgenius/apis/dify-service-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/langgenius/dify-service-api/revisions/e49b3db72bad/schema)
