> ## Documentation Index
> Fetch the complete documentation index at: https://enterprise-docs.dify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Upload File

> Returns the source file of a document created by file upload, with signed preview and download URLs. Only documents whose `data_source_type` is `upload_file` have a source file.



## OpenAPI

````yaml /en/2.5.x/develop/api/openapi_service.json get /datasets/{dataset_id}/documents/{document_id}/upload-file
openapi: 3.0.1
info:
  title: Dify Service API
  description: >-
    REST API for Dify applications and knowledge bases. Application endpoints
    authenticate with an app API key; knowledge endpoints authenticate with a
    dataset API key.
  version: 1.0.0
servers:
  - url: https://{api_base_url}
    description: >-
      Base URL of the Dify Service API. Replace it with your deployment's API
      endpoint.
    variables:
      api_base_url:
        default: api.example.com/v1
        description: Host and path of the API base URL, without the `https://` prefix.
security:
  - ApiKeyAuth: []
tags:
  - name: Chat Messages
    description: Operations related to chat messages and interactions.
  - name: Files
    description: File upload and preview operations.
  - name: Feedback
    description: User feedback operations.
  - name: Conversations
    description: Operations related to managing conversations.
  - name: Audio
    description: Text-to-Speech and Speech-to-Text operations.
  - name: Applications
    description: Operations to retrieve application settings and information.
  - name: Workflow Runs
    description: Operations for executing and managing workflows.
  - name: Completion Messages
    description: Operations related to text generation and completion.
  - name: Knowledge Bases
    description: >-
      Operations for managing knowledge bases, including creation,
      configuration, and retrieval.
  - name: Documents
    description: >-
      Operations for creating, updating, and managing documents within a
      knowledge base.
  - name: Chunks
    description: Operations for managing document chunks and child chunks.
paths:
  /datasets/{dataset_id}/documents/{document_id}/upload-file:
    get:
      tags:
        - Documents
      summary: Get Upload File
      description: >-
        Returns the source file of a document created by file upload, with
        signed preview and download URLs. Only documents whose
        `data_source_type` is `upload_file` have a source file.
      operationId: getUploadFile
      parameters:
        - name: dataset_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: >-
            Knowledge base ID. From [List Knowledge
            Bases](/en/2.5.x/develop/api/knowledge-bases/list-knowledge-bases).
        - name: document_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: >-
            Document ID. From [List
            Documents](/en/2.5.x/develop/api/documents/list-documents).
      responses:
        '200':
          description: Source file details with signed preview and download URLs.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    description: File identifier.
                  name:
                    type: string
                    description: Original file name.
                  size:
                    type: integer
                    description: File size in bytes.
                  extension:
                    type: string
                    description: File extension.
                  url:
                    type: string
                    description: Signed URL to preview the file.
                  download_url:
                    type: string
                    description: Signed URL to download the file as an attachment.
                  mime_type:
                    type: string
                    description: File MIME type.
                  created_by:
                    type: string
                    format: uuid
                    description: ID of the user who uploaded the file.
                  created_at:
                    type: integer
                    format: int64
                    description: Unix timestamp of file upload.
        '400':
          description: >-
            - `invalid_param` : The document was not created by file upload (its
            `data_source_type` is not `upload_file`).

            - `invalid_param` : The document has no upload file ID in its data
            source info.
          content:
            application/json:
              examples:
                invalid_param_1:
                  summary: invalid_param
                  value:
                    status: 400
                    code: invalid_param
                    message: >-
                      Document data source type (notion_import) is not
                      upload_file.
                invalid_param_2:
                  summary: invalid_param
                  value:
                    status: 400
                    code: invalid_param
                    message: Upload file id not found in document data source info.
        '403':
          description: '- `forbidden` : API access is not enabled for this knowledge base.'
          content:
            application/json:
              examples:
                forbidden:
                  summary: forbidden (api access)
                  value:
                    status: 403
                    code: forbidden
                    message: Dataset api access is not enabled.
        '404':
          description: |-
            - `not_found` : Dataset not found.
            - `not_found` : Document not found.
            - `not_found` : UploadFile not found.
          content:
            application/json:
              examples:
                not_found_1:
                  summary: not_found
                  value:
                    status: 404
                    code: not_found
                    message: Dataset not found.
                not_found_2:
                  summary: not_found
                  value:
                    status: 404
                    code: not_found
                    message: Document not found.
                not_found_3:
                  summary: not_found
                  value:
                    status: 404
                    code: not_found
                    message: UploadFile not found.
components:
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API_KEY
      description: >-
        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](/en/2.5.x/develop/api/guides/get-started)).


        Keep keys server-side; never embed them in client code. Requests with a
        missing or invalid key fail with HTTP `401` (`unauthorized`).

````