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

# ドキュメント詳細を取得

> 特定のドキュメントの詳細情報（インデックスステータス、メタデータ、処理統計を含む）を取得します。



## OpenAPI

````yaml /ja/api-reference/openapi_knowledge.json get /datasets/{dataset_id}/documents/{document_id}
openapi: 3.0.1
info:
  title: ナレッジAPI
  description: >-
    ナレッジベース、ドキュメント、チャンク、メタデータ、タグの管理（作成、取得、設定を含む）のための API です。**注意：**単一のナレッジベース
    API キーは、同じアカウント配下のすべての可視ナレッジベースを操作する権限を持ちます。データセキュリティにご注意ください。
  version: 1.0.0
servers:
  - url: https://{api_base_url}
    description: Knowledge API のベース URL です。セルフホスト環境では、独自の API ベース URL に置き換えてください。
    variables:
      api_base_url:
        default: api.dify.ai/v1
        description: API ベース URL のホストとパス（`https://` を除く）。
security:
  - ApiKeyAuth: []
tags:
  - name: データセット
    description: ナレッジベースの作成、設定、取得を含むナレッジベース管理の操作です。
  - name: ドキュメント
    description: ナレッジベース内のドキュメントの作成、更新、管理のための操作です。
  - name: チャンク
    description: ドキュメントチャンクと子チャンクの管理のための操作です。
  - name: メタデータ
    description: ナレッジベースのメタデータフィールドとドキュメントメタデータ値の管理のための操作です。
  - name: タグ管理
    description: ナレッジベースタグとタグバインディングの管理のための操作です。
  - name: モデル
    description: 利用可能なモデルを取得するための操作です。
  - name: ナレッジパイプライン
    description: データソースプラグインとパイプライン実行を含むナレッジパイプラインの管理と実行のための操作です。
paths:
  /datasets/{dataset_id}/documents/{document_id}:
    get:
      tags:
        - ドキュメント
      summary: ドキュメント詳細を取得
      description: 特定のドキュメントの詳細情報（インデックスステータス、メタデータ、処理統計を含む）を取得します。
      operationId: getDocumentDetail
      parameters:
        - name: dataset_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: ナレッジベース ID です。
        - name: document_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Document ID.
        - name: metadata
          in: query
          schema:
            type: string
            enum:
              - all
              - only
              - without
            default: all
          description: >-
            `all` はメタデータを含むすべてのフィールドを返します。`only` は
            `id`、`doc_type`、`doc_metadata` のみを返します。`without` は `doc_metadata`
            を除くすべてのフィールドを返します。
      responses:
        '200':
          description: >-
            ドキュメントの詳細です。レスポンスの形式は `metadata` クエリパラメータによって異なります。`metadata` が
            `only` の場合、`id`、`doc_type`、`doc_metadata` のみが返されます。`metadata` が
            `without` の場合、`doc_type` と `doc_metadata` は省略されます。
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: ドキュメント識別子です。
                  position:
                    type: integer
                    description: ナレッジベース内の位置インデックスです。
                  data_source_type:
                    type: string
                    description: >-
                      ドキュメントのアップロード方法です。ファイルアップロードの場合は `upload_file`、Notion
                      インポートの場合は `notion_import` です。
                  data_source_info:
                    type: object
                    description: 生データソース情報です。
                  dataset_process_rule_id:
                    type: string
                    description: このドキュメントに適用された処理ルールの ID です。
                  dataset_process_rule:
                    type: object
                    description: ナレッジベースレベルの処理ルール設定です。
                  document_process_rule:
                    type: object
                    description: ドキュメントレベルの処理ルール設定です。
                  name:
                    type: string
                    description: ドキュメント名です。
                  created_from:
                    type: string
                    description: ドキュメントの作成元です。API で作成した場合は `api`、UI で作成した場合は `web` です。
                  created_by:
                    type: string
                    description: ドキュメントを作成したユーザーの ID です。
                  created_at:
                    type: number
                    description: ドキュメント作成の Unix タイムスタンプです。
                  tokens:
                    type: integer
                    description: ドキュメント内のトークン数です。
                  indexing_status:
                    type: string
                    description: >-
                      現在のインデックスステータスです（例：`waiting`、`parsing`、`cleaning`、`splitting`、`indexing`、`completed`、`error`、`paused`）。
                  error:
                    type: string
                    nullable: true
                    description: インデックス作成が失敗した場合のエラーメッセージです。それ以外は `null` です。
                  enabled:
                    type: boolean
                    description: このドキュメントが検索に対して有効かどうかです。
                  disabled_at:
                    type: number
                    nullable: true
                    description: ドキュメントが無効化された Unix タイムスタンプです。有効な場合は `null` です。
                  disabled_by:
                    type: string
                    nullable: true
                    description: ドキュメントを無効化したユーザーの ID です。有効な場合は `null` です。
                  archived:
                    type: boolean
                    description: ドキュメントがアーカイブ済みかどうかです。
                  display_status:
                    type: string
                    description: UI 向けの表示用インデックスステータスです。
                  word_count:
                    type: integer
                    description: ドキュメントの合計単語数です。
                  hit_count:
                    type: integer
                    description: このドキュメントが検索された回数です。
                  doc_form:
                    type: string
                    description: >-
                      ドキュメントのチャンキングモードです。`text_model`
                      は標準テキスト、`hierarchical_model` は親子構造、`qa_model` は QA
                      ペアを示します。
                  doc_language:
                    type: string
                    description: ドキュメント内容の言語です。
                  doc_type:
                    type: string
                    nullable: true
                    description: ドキュメントタイプの分類です。未設定の場合は `null` です。
                  doc_metadata:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: メタデータフィールドの識別子です。
                        name:
                          type: string
                          description: メタデータフィールド名です。
                        type:
                          type: string
                          description: メタデータフィールドの種類です。
                        value:
                          type: string
                          description: このドキュメントのメタデータフィールド値。
                    description: このドキュメントのカスタムメタデータキーバリューペア。
                  completed_at:
                    type: number
                    nullable: true
                    description: 処理が完了した Unix タイムスタンプです。まだ完了していない場合は `null` です。
                  updated_at:
                    type: number
                    nullable: true
                    description: 最終更新の Unix タイムスタンプです。更新されたことがない場合は `null` です。
                  indexing_latency:
                    type: number
                    nullable: true
                    description: インデックス作成にかかった時間（秒）です。未完了の場合は `null` です。
                  segment_count:
                    type: integer
                    description: ドキュメント内のチャンク数です。
                  average_segment_length:
                    type: number
                    description: チャンクの平均文字長です。
                  summary_index_status:
                    type: string
                    nullable: true
                    description: 要約インデックスのステータスです。要約インデックスが有効でない場合は `null` です。
                  need_summary:
                    type: boolean
                    description: このドキュメントが要約生成を必要とするかどうかです。
              examples:
                success:
                  summary: レスポンス例
                  value:
                    id: a8e0e5b5-78c6-4130-a5ce-25feb0e0b4ac
                    position: 1
                    data_source_type: upload_file
                    data_source_info:
                      upload_file_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                    dataset_process_rule_id: e1f2a3b4-c5d6-7890-ef12-345678901234
                    dataset_process_rule:
                      id: e1f2a3b4-c5d6-7890-ef12-345678901234
                      mode: custom
                    document_process_rule:
                      mode: custom
                      rules:
                        pre_processing_rules: []
                        segmentation:
                          separator: '###'
                          max_tokens: 500
                          chunk_overlap: 50
                    name: guide.txt
                    created_from: api
                    created_by: ad313dd6-ef04-4dd1-a5b0-c0f0b9e2e7e4
                    created_at: 1741267200
                    tokens: 512
                    indexing_status: completed
                    error: null
                    enabled: true
                    disabled_at: null
                    disabled_by: null
                    archived: false
                    display_status: available
                    word_count: 350
                    hit_count: 0
                    doc_form: text_model
                    doc_language: English
                    doc_type: null
                    doc_metadata: []
                    completed_at: 1741267260
                    updated_at: 1741267260
                    indexing_latency: 60
                    segment_count: 5
                    average_segment_length: 70
                    summary_index_status: null
                    need_summary: false
        '400':
          description: '`invalid_metadata` : 指定されたキーのメタデータ値が無効です。'
          content:
            application/json:
              examples:
                invalid_metadata:
                  summary: invalid_metadata
                  value:
                    status: 400
                    code: invalid_metadata
                    message: 'Invalid metadata value: {metadata_key}'
        '403':
          description: '`forbidden` : 権限がありません。'
          content:
            application/json:
              examples:
                forbidden:
                  summary: forbidden
                  value:
                    status: 403
                    code: forbidden
                    message: No permission.
        '404':
          description: '`not_found` : ドキュメントが見つかりません。'
          content:
            application/json:
              examples:
                not_found:
                  summary: not_found
                  value:
                    status: 404
                    code: not_found
                    message: Document not found.
components:
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API_KEY
      description: >-
        API Key 認証です。すべての API リクエストにおいて、`Authorization` HTTP ヘッダーに `Bearer `
        プレフィックスを付けた API Key を含めてください。例：`Authorization: Bearer {API_KEY}`。**API
        Key はサーバーサイドに保存し、クライアントサイドで共有・保存しないことを強く推奨します。API Key
        の漏洩は深刻な結果につながる可能性があります。**

````