> ## 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.

# アップロードファイルを取得

> ファイルアップロードで作成されたドキュメントの元ファイルを返します。署名付きのプレビュー URL とダウンロード URL を含みます。元ファイルがあるのは `data_source_type` が `upload_file` のドキュメントのみです。



## OpenAPI

````yaml /ja/2.5.x/develop/api/openapi_service.json get /datasets/{dataset_id}/documents/{document_id}/upload-file
openapi: 3.0.1
info:
  title: Dify サービス API
  description: >-
    Dify アプリケーションとナレッジベースのための REST API です。アプリケーション系エンドポイントはアプリの API
    キーで、ナレッジ系エンドポイントはナレッジベースの API キーで認証します。
  version: 1.0.0
servers:
  - url: https://{api_base_url}
    description: Dify サービス API のベース URL です。ご利用のデプロイ環境の API ベース URL に置き換えてください。
    variables:
      api_base_url:
        default: api.example.com/v1
        description: API ベース URL のホストとパス（`https://` を除く）。
security:
  - ApiKeyAuth: []
tags:
  - name: チャットメッセージ
    description: チャットメッセージとインタラクションに関連する操作です。
  - name: ファイル操作
    description: ファイルのアップロードとプレビューの操作です。
  - name: メッセージフィードバック
    description: ユーザーフィードバックの操作です。
  - name: 会話管理
    description: 会話管理に関連する操作です。
  - name: 音声・テキスト変換
    description: テキスト読み上げと音声認識の操作です。
  - name: アプリケーション設定
    description: アプリケーション設定と情報を取得する操作です。
  - name: ワークフロー実行
    description: ワークフローの実行と管理のための操作です。
  - name: 完了メッセージ
    description: テキスト生成に関連する操作です。
  - name: ナレッジベース
    description: ナレッジベースの作成、設定、取得を含むナレッジベース管理の操作です。
  - name: ドキュメント
    description: ナレッジベース内のドキュメントの作成、更新、管理のための操作です。
  - name: チャンク
    description: ドキュメントチャンクと子チャンクの管理のための操作です。
paths:
  /datasets/{dataset_id}/documents/{document_id}/upload-file:
    get:
      tags:
        - Documents
      summary: アップロードファイルを取得
      description: >-
        ファイルアップロードで作成されたドキュメントの元ファイルを返します。署名付きのプレビュー URL とダウンロード URL
        を含みます。元ファイルがあるのは `data_source_type` が `upload_file` のドキュメントのみです。
      operationId: getUploadFile
      parameters:
        - name: dataset_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: >-
            ナレッジベース ID
            です。[ナレッジベースリストを取得](/ja/2.5.x/develop/api/knowledge-bases/list-knowledge-bases)
            から取得します。
        - name: document_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: >-
            ドキュメント ID
            です。[ナレッジベースのドキュメントリストを取得](/ja/2.5.x/develop/api/documents/list-documents)
            から取得します。
      responses:
        '200':
          description: 元ファイルの詳細です。署名付きのプレビュー URL とダウンロード URL を含みます。
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    description: ファイル識別子です。
                  name:
                    type: string
                    description: 元のファイル名です。
                  size:
                    type: integer
                    description: ファイルサイズ（バイト単位）です。
                  extension:
                    type: string
                    description: ファイル拡張子です。
                  url:
                    type: string
                    description: 署名付きのファイルプレビュー URL です。
                  download_url:
                    type: string
                    description: 署名付きのファイルダウンロード URL です（添付ファイルとしてダウンロード）。
                  mime_type:
                    type: string
                    description: ファイルの MIME タイプです。
                  created_by:
                    type: string
                    format: uuid
                    description: ファイルをアップロードしたユーザーの ID です。
                  created_at:
                    type: integer
                    format: int64
                    description: ファイルアップロードの Unix タイムスタンプです。
        '400':
          description: >-
            - `invalid_param` : ドキュメントがファイルアップロードで作成されていません（`data_source_type` が
            `upload_file` ではありません）。

            - `invalid_param` : ドキュメントのデータソース情報にアップロードファイル ID がありません。
          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 アクセスが有効になっていません。'
          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` : ナレッジベースが見つかりません。
            - `not_found` : ドキュメントが見つかりません。
            - `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: >-
        すべてのリクエストは API キーで認証します：`Authorization: Bearer
        {API_KEY}`。アプリのエンドポイントにはアプリの API キーを、ナレッジのエンドポイントにはナレッジベースの API
        キーを使用します（[Dify API クイックスタート](/ja/2.5.x/develop/api/guides/get-started)）。


        キーはサーバーサイドで保管し、クライアントコードには決して埋め込まないでください。キーが欠落または無効なリクエストは HTTP
        `401`（`unauthorized`）で失敗します。

````