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

# ドキュメントファイルを一括削除

> 1 回の呼び出しで最大 100 件のドキュメントファイルの削除をリクエストし、ファイルごとの結果を返します。[ドキュメントファイルを削除](/ja/api-reference/documents-and-chunks/delete-document-file) と同様に、アクティブなリビジョンのファイルは削除しないでください。

この `DELETE` には JSON ボディを付けて送信します。クライアントが DELETE リクエストのボディを省略する場合は、ボディを明示的に送信するよう設定してください。

ファイルは `documentId`、次に `expectedRevision` の順に並べ替えられ、1 件ずつ個別に処理されます。存在しないファイル、`expectedRevision` が古いファイル、すでに削除中のファイル、この API キーでは削除できないファイルは `results` に `rejected` として返り、他のファイルの処理は続行されます。インフラ障害が起きると実行が止まり、残りのファイルは `pending` のままになります。

インフラ障害の後や、呼び出し全体が失敗した後に続行するには、同じ `Idempotency-Key` で同じリクエストを再送信してください。受け付け済みのジョブを含む元のバッチが返され、`pending` のファイルだけが再試行されます。

この呼び出しでは一括タスクは作成されません。

削除の流れについては、[ドキュメントとソースの削除](/ja/api-reference/guides/knowledge-base#delete-documents-and-sources) を参照してください。



## OpenAPI

````yaml /ja/api-reference/openapi_service.json delete /knowledge-fs/spaces/{knowledge_base_id}/documents/bulk
openapi: 3.0.1
info:
  description: >-
    Dify アプリケーションとナレッジベースのための REST API です。アプリケーション系エンドポイントはアプリの API
    キーで、ナレッジ系エンドポイントはナレッジベースの API キーで認証します。
  title: Dify サービス API
  version: 1.0.0
servers:
  - description: Dify サービス API のベース URL です。セルフホスト環境では、独自の API ベース URL に置き換えてください。
    url: https://{api_base_url}
    variables:
      api_base_url:
        default: api.dify.ai/v1
        description: API ベース URL のホストとパス（`https://` を除く）。
security:
  - ApiKeyAuth: []
tags:
  - description: チャットメッセージとインタラクションに関連する操作です。
    name: チャットメッセージ
  - description: ファイルのアップロードとプレビューの操作です。
    name: ファイル操作
  - description: エンドユーザー情報に関連する操作です。
    name: エンドユーザー
  - description: ユーザーフィードバックの操作です。
    name: メッセージフィードバック
  - description: 会話管理に関連する操作です。
    name: 会話管理
  - description: テキスト読み上げと音声認識の操作です。
    name: 音声・テキスト変換
  - description: アプリケーション設定と情報を取得する操作です。
    name: アプリケーション設定
  - description: ダイレクト返信用のアノテーション管理に関連する操作です。
    name: アノテーション管理
  - description: 人間の入力を要する一時停止中のワークフローの再開操作です。
    name: 人間の入力
  - description: ワークフローの実行と管理のための操作です。
    name: ワークフロー実行
  - description: テキスト生成に関連する操作です。
    name: 完了メッセージ
  - description: ナレッジベースの作成、設定、取得を含むナレッジベース管理の操作です。
    name: ナレッジベース
  - description: ナレッジベース内のドキュメントの作成、更新、管理のための操作です。
    name: ドキュメント
  - description: ドキュメントチャンクと子チャンクの管理のための操作です。
    name: チャンク
  - description: ナレッジベースのメタデータフィールドとドキュメントメタデータ値の管理のための操作です。
    name: メタデータ
  - description: ナレッジベースタグとタグバインディングの管理のための操作です。
    name: タグ管理
  - description: 利用可能なモデルを取得するための操作です。
    name: モデル
  - description: データソースプラグインとパイプライン実行を含むナレッジパイプラインの管理と実行のための操作です。
    name: ナレッジパイプライン
  - description: ナレッジベースに質問し、回答をストリーミングで受け取ります。
    name: クエリ
  - description: クエリが何を検索したか、またその理由を確認します。
    name: クエリ記録
  - description: リサーチの質問をバックグラウンドで実行し、その結果を取得します。
    name: リサーチタスク
  - description: ナレッジベースのドキュメントと、そのファイル、リビジョン、チャンクを読み取り、ドキュメントにメタデータのラベルを付けます。
    name: ドキュメントとチャンク
  - description: インデックス処理の追跡、キャンセル、再試行と、ナレッジベースのバックグラウンドタスクの一覧表示を行います。
    name: インデックスタスク
  - description: ドキュメントファイル、ファイルのバッチ、またはソースの削除を、完了するまで追跡します。
    name: 削除ジョブ
  - description: ナレッジベースにデータを供給するソース、その同期スケジュール、接続を管理します。
    name: ソース
  - description: ソースの即時同期、ウェブサイトのページまたはプロバイダーのアイテムのインポート、実行の追跡、キャンセル、再試行を行います。
    name: ソースの同期とインポート
  - description: ナレッジベースのモデルと検索設定の読み取りと変更、および変更によって始まる移行の追跡を行います。
    name: 設定
paths:
  /knowledge-fs/spaces/{knowledge_base_id}/documents/bulk:
    delete:
      tags:
        - Documents and Chunks
      summary: ドキュメントファイルを一括削除
      description: >-
        1 回の呼び出しで最大 100
        件のドキュメントファイルの削除をリクエストし、ファイルごとの結果を返します。[ドキュメントファイルを削除](/ja/api-reference/documents-and-chunks/delete-document-file)
        と同様に、アクティブなリビジョンのファイルは削除しないでください。


        この `DELETE` には JSON ボディを付けて送信します。クライアントが DELETE
        リクエストのボディを省略する場合は、ボディを明示的に送信するよう設定してください。


        ファイルは `documentId`、次に `expectedRevision` の順に並べ替えられ、1
        件ずつ個別に処理されます。存在しないファイル、`expectedRevision` が古いファイル、すでに削除中のファイル、この API
        キーでは削除できないファイルは `results` に `rejected`
        として返り、他のファイルの処理は続行されます。インフラ障害が起きると実行が止まり、残りのファイルは `pending` のままになります。


        インフラ障害の後や、呼び出し全体が失敗した後に続行するには、同じ `Idempotency-Key`
        で同じリクエストを再送信してください。受け付け済みのジョブを含む元のバッチが返され、`pending` のファイルだけが再試行されます。


        この呼び出しでは一括タスクは作成されません。


        削除の流れについては、[ドキュメントとソースの削除](/ja/api-reference/guides/knowledge-base#delete-documents-and-sources)
        を参照してください。
      operationId: deleteDocumentFilesInBatch
      parameters:
        - description: >-
            ナレッジベース ID です。ナレッジベースの **API アクセス** ダイアログに表示されるサービス API
            エンドポイントの最後のセグメント（`…/knowledge-fs/spaces/<knowledge base
            ID>`）です。アドレスバーでは `/datasets/new/` の後のセグメントです。
          in: path
          name: knowledge_base_id
          required: true
          schema:
            format: uuid
            type: string
        - description: >-
            この削除リクエストを識別する必須の値です。同じ API キーで同じ冪等キーと同じリクエストを再送信すると、元のバッチが返され、その
            `pending` のファイルが再試行されます。別のリクエストや別の API キーで同じキーを再利用すると `409`
            が返ります。前後に空白を含まない、印字可能な ASCII 文字を使用してください。
          in: header
          name: Idempotency-Key
          required: true
          schema:
            maxLength: 255
            minLength: 8
            type: string
      requestBody:
        content:
          application/json:
            examples:
              request:
                summary: リクエスト例
                value:
                  documents:
                    - documentId: 6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b
                      expectedRevision: 1
                    - documentId: 2c1e7a44-5b6d-4e8f-9a0b-1c2d3e4f5a6b
                      expectedRevision: 1
                    - documentId: 9d8c7b6a-5f4e-4d3c-8b2a-1f0e9d8c7b6a
                      expectedRevision: 1
            schema:
              additionalProperties: false
              properties:
                documents:
                  description: >-
                    削除するファイルです。各 `documentId` は 1 回だけ指定します。上限より大きいバッチには `400`
                    が返ります。デプロイ環境によっては、より低い上限が設定されている場合があります。
                  items:
                    additionalProperties: false
                    properties:
                      documentId:
                        description: >-
                          ドキュメントファイル ID
                          です。[ドキュメントファイル一覧を取得](/ja/api-reference/documents-and-chunks/list-document-files)
                          から取得します。
                        minLength: 1
                        type: string
                      expectedRevision:
                        description: >-
                          ドキュメントファイルの現在の `version`
                          です。[ドキュメントファイル一覧を取得](/ja/api-reference/documents-and-chunks/list-document-files)
                          または
                          [ドキュメントファイルを取得](/ja/api-reference/documents-and-chunks/get-document-file)
                          から取得します。ドキュメントファイルの `version` は常に `1`
                          です。[ドキュメントリビジョン一覧を取得](/ja/api-reference/documents-and-chunks/list-document-revisions)
                          のリビジョン番号ではありません。
                        minimum: 1
                        type: integer
                    required:
                      - documentId
                      - expectedRevision
                    type: object
                  maxItems: 100
                  minItems: 1
                  type: array
              required:
                - documents
              type: object
        description: >-
          正規化後のリクエストは、UTF-8 で 1,048,576
          バイト以内に収める必要があります。[リクエストサイズの制限](/ja/api-reference/guides/knowledge-base#request-size-limits)
          を参照してください。
        required: true
      responses:
        '202':
          content:
            application/json:
              examples:
                success:
                  summary: レスポンス例
                  value:
                    batch_id: 3e5a7c9b-1d2f-4a6b-8c0d-2e4f6a8b0c1d
                    items:
                      - document_id: 2c1e7a44-5b6d-4e8f-9a0b-1c2d3e4f5a6b
                        document_title: null
                        job:
                          checkpoint: requested
                          completed_at: null
                          created_at: '2026-09-06T02:15:30Z'
                          error: null
                          id: b7e1c2d3-4f5a-4b6c-8d9e-0f1a2b3c4d5e
                          knowledge_space_id: 9b2e5b7a-3c1d-4e2f-8a9b-1c2d3e4f5a6b
                          mode: cascade
                          progress: null
                          retry_at: null
                          run_state: dispatch_pending
                          target_id: 2c1e7a44-5b6d-4e8f-9a0b-1c2d3e4f5a6b
                          target_type: document
                          updated_at: '2026-09-06T02:15:30Z'
                        status_url: >-
                          https://api.example.com/v1/knowledge-fs/spaces/8d2c6a1e-5b3f-4c7d-9e01-2a3b4c5d6e7f/deletion-jobs/b7e1c2d3-4f5a-4b6c-8d9e-0f1a2b3c4d5e
                      - document_id: 6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b
                        document_title: null
                        job:
                          checkpoint: requested
                          completed_at: null
                          created_at: '2026-09-06T02:15:30Z'
                          error: null
                          id: 0c9d8e7f-6a5b-4c3d-9e2f-1a0b9c8d7e6f
                          knowledge_space_id: 9b2e5b7a-3c1d-4e2f-8a9b-1c2d3e4f5a6b
                          mode: cascade
                          progress: null
                          retry_at: null
                          run_state: dispatch_pending
                          target_id: 6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b
                          target_type: document
                          updated_at: '2026-09-06T02:15:30Z'
                        status_url: >-
                          https://api.example.com/v1/knowledge-fs/spaces/8d2c6a1e-5b3f-4c7d-9e01-2a3b4c5d6e7f/deletion-jobs/0c9d8e7f-6a5b-4c3d-9e2f-1a0b9c8d7e6f
                    results:
                      - document_id: 2c1e7a44-5b6d-4e8f-9a0b-1c2d3e4f5a6b
                        error: null
                        job:
                          checkpoint: requested
                          completed_at: null
                          created_at: '2026-09-06T02:15:30Z'
                          error: null
                          id: b7e1c2d3-4f5a-4b6c-8d9e-0f1a2b3c4d5e
                          knowledge_space_id: 9b2e5b7a-3c1d-4e2f-8a9b-1c2d3e4f5a6b
                          mode: cascade
                          progress: null
                          retry_at: null
                          run_state: dispatch_pending
                          target_id: 2c1e7a44-5b6d-4e8f-9a0b-1c2d3e4f5a6b
                          target_type: document
                          updated_at: '2026-09-06T02:15:30Z'
                        status: accepted
                        status_url: >-
                          https://api.example.com/v1/knowledge-fs/spaces/8d2c6a1e-5b3f-4c7d-9e01-2a3b4c5d6e7f/deletion-jobs/b7e1c2d3-4f5a-4b6c-8d9e-0f1a2b3c4d5e
                      - document_id: 6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b
                        error: null
                        job:
                          checkpoint: requested
                          completed_at: null
                          created_at: '2026-09-06T02:15:30Z'
                          error: null
                          id: 0c9d8e7f-6a5b-4c3d-9e2f-1a0b9c8d7e6f
                          knowledge_space_id: 9b2e5b7a-3c1d-4e2f-8a9b-1c2d3e4f5a6b
                          mode: cascade
                          progress: null
                          retry_at: null
                          run_state: dispatch_pending
                          target_id: 6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b
                          target_type: document
                          updated_at: '2026-09-06T02:15:30Z'
                        status: accepted
                        status_url: >-
                          https://api.example.com/v1/knowledge-fs/spaces/8d2c6a1e-5b3f-4c7d-9e01-2a3b4c5d6e7f/deletion-jobs/0c9d8e7f-6a5b-4c3d-9e2f-1a0b9c8d7e6f
                      - document_id: 9d8c7b6a-5f4e-4d3c-8b2a-1f0e9d8c7b6a
                        error:
                          code: DURABLE_DELETION_NOT_FOUND
                          message: Deletion request was rejected
                          retryable: false
                        job: null
                        status: rejected
                        status_url: null
                    status_url: >-
                      https://api.example.com/v1/knowledge-fs/spaces/8d2c6a1e-5b3f-4c7d-9e01-2a3b4c5d6e7f/deletion-batches/3e5a7c9b-1d2f-4a6b-8c0d-2e4f6a8b0c1d
                    total: 3
              schema:
                $ref: '#/components/schemas/KnowledgeBaseDeletionBatch'
          description: >-
            バッチが記録されました。`results` に各ファイルの結果が、`items`
            に受け付けられたファイルが入ります。削除はバックグラウンドで実行されます。ファイルの削除が受け付けられた時点から、[ドキュメントファイルを取得](/ja/api-reference/documents-and-chunks/get-document-file)
            は `404`
            を返します。すべてのファイルを最後まで追跡するには、[削除バッチを取得](/ja/api-reference/deletion-jobs/get-deletion-batch)（バッチの
            `status_url`）をポーリングしてください。


            返されたジョブ ID をポーリングしてください。`pending` のまま残ったファイルを再試行するには、同じ
            `Idempotency-Key` で同じリクエストを再送信してください。
          headers:
            Location:
              description: バッチの `status_url` と同じ URL です。
              schema:
                type: string
        '400':
          content:
            application/json:
              examples:
                knowledge_fs_invalid_request_local:
                  summary: knowledge_fs_invalid_request (request validation)
                  value:
                    code: knowledge_fs_invalid_request
                    message: Agent Knowledge Base request is invalid.
                    status: 400
                    violations:
                      - field:
                          - documents
                        type: too_long
                knowledge_fs_invalid_request_upstream:
                  summary: knowledge_fs_invalid_request (rejected)
                  value:
                    code: knowledge_fs_invalid_request
                    failure:
                      category: validation
                      code: KNOWLEDGE_FS_INVALID_REQUEST
                      message: The Agent Knowledge Base request is invalid.
                      retryPolicy: never
                      traceId: 7f3c1a90-2e64-4b7d-8a51-6c0d9e2f4b83
                    message: The Agent Knowledge Base request is invalid.
                    status: 400
          description: >-
            - `knowledge_fs_invalid_request`：リクエストが検証に失敗しました。`violations`
            には、問題のあるフィールドがそれぞれ示されます。

            - `knowledge_fs_invalid_request`：2 つのエントリで `documentId`
            が重複しているか、バッチがデプロイ環境の 1 回あたりの上限を超えているか、`documentId` が UUID ではありません。
        '401':
          content:
            application/json:
              examples:
                knowledge_fs_invalid_credential:
                  summary: knowledge_fs_invalid_credential
                  value:
                    code: knowledge_fs_invalid_credential
                    message: Invalid Agent Knowledge Base service credential.
                    status: 401
                unauthorized:
                  summary: unauthorized
                  value:
                    code: unauthorized
                    message: Access token is invalid
                    status: 401
          description: >-
            - `unauthorized`：`Authorization` ヘッダーがないか、キーが不明であるか、ナレッジベースの API
            キーではありません。

            - `knowledge_fs_invalid_credential`：キーは有効ですが、キーのワークスペースにこの ID
            のナレッジベースが存在しないか、キーがワークスペースに紐付いていません。
        '403':
          content:
            application/json:
              examples:
                forbidden:
                  summary: forbidden (rate limit)
                  value:
                    code: forbidden
                    message: >-
                      Sorry, you have reached the knowledge base request rate
                      limit of your subscription.
                    status: 403
                knowledge_fs_access_denied_scope:
                  summary: knowledge_fs_access_denied (key scope)
                  value:
                    code: knowledge_fs_access_denied
                    message: Agent Knowledge Base operation is not allowed.
                    status: 403
                knowledge_fs_access_denied_upstream:
                  summary: knowledge_fs_access_denied (rejected)
                  value:
                    code: knowledge_fs_access_denied
                    failure:
                      action: contact_admin
                      category: authorization
                      code: KNOWLEDGE_FS_ACCESS_DENIED
                      message: >-
                        You do not have permission to perform this Agent
                        Knowledge Base operation.
                      retryPolicy: never
                      traceId: 7f3c1a90-2e64-4b7d-8a51-6c0d9e2f4b83
                    message: >-
                      You do not have permission to perform this Agent Knowledge
                      Base operation.
                    status: 403
          description: >-
            -
            `knowledge_fs_access_denied`：キーのアクセス範囲がほかのナレッジベースに限定されているか、このナレッジベースで
            **API アクセス** がオフになっています。または、ナレッジベースがアクティブではありません。

            - `knowledge_fs_access_denied`：バッチの受け付け処理中に、API キーの書き込み権限が取り消されました。

            - `forbidden`：Dify Cloud
            で、ワークスペースがサブスクリプションで定められたナレッジベースのリクエストレート制限に達しました。読み取りを含め、すべての呼び出しがカウントされます。
        '404':
          content:
            application/json:
              examples:
                knowledge_fs_resource_not_found:
                  summary: knowledge_fs_resource_not_found
                  value:
                    code: knowledge_fs_resource_not_found
                    failure:
                      category: not_found
                      code: KNOWLEDGE_FS_NOT_FOUND
                      message: >-
                        The requested Agent Knowledge Base resource was not
                        found.
                      retryPolicy: never
                      traceId: 7f3c1a90-2e64-4b7d-8a51-6c0d9e2f4b83
                    message: The requested Agent Knowledge Base resource was not found.
                    status: 404
                not_found:
                  summary: not_found (feature off)
                  value:
                    code: not_found
                    message: >-
                      The requested URL was not found on the server. If you
                      entered the URL manually please check your spelling and
                      try again.
                    status: 404
          description: >-
            - `knowledge_fs_resource_not_found`：ナレッジベース ID が認識されません。存在しないファイルや
            API キーで読み取れないファイルがあっても、呼び出し全体が失敗することはなくなりました。そのファイルは `results` に
            `rejected` として返ります。

            - `not_found`：このデプロイ環境では Agent ナレッジベース機能が無効になっています。
        '409':
          content:
            application/json:
              examples:
                durable_deletion_idempotency_conflict:
                  summary: knowledge_fs_conflict (key reused)
                  value:
                    code: knowledge_fs_conflict
                    failure:
                      category: conflict
                      code: DURABLE_DELETION_IDEMPOTENCY_CONFLICT
                      message: >-
                        The Agent Knowledge Base operation conflicts with the
                        current resource state.
                      retryPolicy: never
                      traceId: 5e2a9c17-3b4d-4f60-8a1b-2c3d4e5f6a7b
                    message: >-
                      The Agent Knowledge Base operation conflicts with the
                      current resource state.
                    status: 409
          description: >-
            - `knowledge_fs_conflict`：`Idempotency-Key` が、別のリクエストまたは別の API
            キーですでに使用されています。`failure.code` は
            `DURABLE_DELETION_IDEMPOTENCY_CONFLICT`、`retryPolicy` は `never` です。


            `expectedRevision`
            が古いファイル、すでに削除中または削除済みのファイル、ソースが削除中のファイルがあっても、呼び出し全体が失敗することはなくなりました。そのファイルは
            `results` に `rejected` として返ります。
        '413':
          content:
            application/json:
              examples:
                knowledge_fs_request_too_large:
                  summary: knowledge_fs_request_too_large (request budget)
                  value:
                    code: knowledge_fs_request_too_large
                    message: Agent Knowledge Base request is too large.
                    status: 413
          description: >-
            - `knowledge_fs_request_too_large`：Dify がデフォルト値を追加した後のリクエストが、UTF-8 で
            1,048,576
            バイトを超えています。[リクエストサイズの制限](/ja/api-reference/guides/knowledge-base#request-size-limits)
            を参照してください。
        '502':
          content:
            application/json:
              examples:
                knowledge_fs_upstream_unavailable:
                  summary: knowledge_fs_upstream_unavailable (service error)
                  value:
                    code: knowledge_fs_upstream_unavailable
                    failure:
                      action: contact_admin
                      category: internal
                      code: KNOWLEDGE_FS_INTERNAL_ERROR
                      message: >-
                        Agent Knowledge Base could not complete the operation.
                        Try again, or contact an administrator with the error
                        reference.
                      retryPolicy: manual
                      traceId: 5e2a9c17-3b4d-4f60-8a1b-2c3d4e5f6a7b
                    message: >-
                      Agent Knowledge Base could not complete the operation. Try
                      again, or contact an administrator with the error
                      reference.
                    status: 502
                knowledge_fs_upstream_unavailable_transport:
                  summary: knowledge_fs_upstream_unavailable (no response)
                  value:
                    code: knowledge_fs_upstream_unavailable
                    message: Agent Knowledge Base is unavailable.
                    status: 502
          description: >-
            - `knowledge_fs_upstream_unavailable`：時間内に応答が返らなかったか、応答を読み取れませんでした。


            一部のファイルは受け付けられている可能性があります。同じ `Idempotency-Key`
            で同じリクエストを再送信してください。元のバッチが返され、まだ `pending` のファイルが再試行されます。
        '503':
          content:
            application/json:
              examples:
                knowledge_fs_operation_unavailable:
                  summary: knowledge_fs_operation_unavailable
                  value:
                    code: knowledge_fs_operation_unavailable
                    message: Agent Knowledge Base operation is not available.
                    status: 503
                knowledge_fs_operation_unavailable_upstream:
                  summary: knowledge_fs_operation_unavailable (temporary)
                  value:
                    code: knowledge_fs_operation_unavailable
                    failure:
                      action: retry
                      category: dependency
                      code: KNOWLEDGE_FS_UNAVAILABLE
                      message: >-
                        A service required by Agent Knowledge Base is
                        temporarily unavailable.
                      retryPolicy: manual
                      traceId: 5e2a9c17-3b4d-4f60-8a1b-2c3d4e5f6a7b
                    message: >-
                      A service required by Agent Knowledge Base is temporarily
                      unavailable.
                    status: 503
          description: >-
            - `knowledge_fs_operation_unavailable`：このワークスペースで Agent
            ナレッジベース機能が設定されていないか、このデプロイ環境ではこの操作を利用できません。または、リクエストの認可中に、このナレッジベースに対するキーのアクセス権が変更されました。

            -
            `knowledge_fs_operation_unavailable`：現在このリクエストを処理できません。`failure.retryPolicy`
            に従ってください。
components:
  schemas:
    KnowledgeBaseDeletionBatch:
      properties:
        batch_id:
          description: このリクエストを記録するバッチの ID です。
          nullable: true
          type: string
        items:
          description: 受け付けられたファイルごとに 1 つのエントリが入ります。
          items:
            properties:
              document_id:
                description: ドキュメントファイル ID です。
                type: string
              document_title:
                description: ドキュメントファイルの削除では常に `null` です。
                nullable: true
                type: string
              job:
                $ref: '#/components/schemas/KnowledgeBaseDeletionJob'
              status_url:
                description: >-
                  このファイルのジョブを
                  [削除ジョブを取得](/ja/api-reference/deletion-jobs/get-deletion-job)
                  で取得するための URL です。
                type: string
            type: object
          type: array
        results:
          description: リクエストされたファイルごとに 1 つのエントリが入り、その結果を示します。
          items:
            properties:
              document_id:
                description: ドキュメントファイル ID です。
                type: string
              error:
                description: ファイルが拒否された理由です。それ以外の場合は `null` です。
                nullable: true
                properties:
                  code:
                    description: >-
                      エラーコードです。`DURABLE_DELETION_NOT_FOUND`、`DURABLE_DELETION_REVISION_CONFLICT`、`DURABLE_DELETION_STATE_CONFLICT`、`DURABLE_DELETION_FORBIDDEN`
                      のいずれかです。
                    type: string
                  message:
                    description: 常に `Deletion request was rejected` です。
                    type: string
                  retryable:
                    description: 常に `false` です。
                    type: boolean
                type: object
              job:
                allOf:
                  - $ref: '#/components/schemas/KnowledgeBaseDeletionJob'
                description: '`status` が `accepted` の場合の削除ジョブです。それ以外の場合は `null` です。'
                nullable: true
              status:
                description: >-
                  - `accepted`：削除が受け付けられました。`job` と `status_url` が設定されます。

                  - `rejected`：ファイルは削除されていません。理由は `error` に示されます。

                  - `pending`：ファイルはまだ受け付けられていません。再試行するには、同じ `Idempotency-Key`
                  で元のリクエストを再送信してください。
                type: string
              status_url:
                description: >-
                  このファイルのジョブの
                  [削除ジョブを取得](/ja/api-reference/deletion-jobs/get-deletion-job) の
                  URL です。`status` が `accepted` でない場合は `null` です。
                nullable: true
                type: string
            type: object
          type: array
        status_url:
          description: >-
            このバッチの
            [削除バッチを取得](/ja/api-reference/deletion-jobs/get-deletion-batch) の URL
            です。デプロイ環境で `SERVICE_API_URL` が設定されている場合は絶対 URL、それ以外の場合は `/v1/`
            で始まるパスです。[ドキュメントファイルを一括削除](/ja/api-reference/documents-and-chunks/delete-document-files-in-batch)
            は、この値を `Location` レスポンスヘッダーでも返します。
          nullable: true
          type: string
        total:
          description: 元のリクエストに含まれるファイル数です。
          type: integer
      type: object
    KnowledgeBaseDeletionJob:
      properties:
        checkpoint:
          description: >-
            削除の進み具合です。`requested`（受け付け直後）から始まり、`quiescing`、`deleting_objects`、`deleting_derived_data`、`deleting_primary_data`、`completed`
            の順に進みます。
          type: string
        completed_at:
          description: ジョブの完了日時（ISO 8601）です。完了するまでの間と、`failed` のジョブでは `null` です。
          nullable: true
          type: string
        created_at:
          description: ジョブが受け付けられた日時（ISO 8601）です。
          type: string
        error:
          description: >-
            直近のエラーです。エラーがない場合は `null` です。`run_state` が `retry_wait`
            の間も設定されるため、ジョブが失敗したかどうかは `error` ではなく `run_state` で判断してください。
          nullable: true
          properties:
            code:
              description: 直近のエラーのコードです。
              type: string
            message:
              description: 直近のエラーの公開用メッセージです。内部のエラー詳細は含まれません。
              type: string
            retryable:
              description: '`run_state` が `failed` の場合は `true` です。この API では、失敗した削除を再試行できません。'
              type: boolean
          type: object
        id:
          description: 削除ジョブ ID です。
          type: string
        knowledge_space_id:
          description: ナレッジベースの内部 ID です。パスのナレッジベース ID とは異なります。
          type: string
        mode:
          description: >-
            ソースの削除時に、そのソースのドキュメントをどう扱うかを示します。`cascade` は削除し、`keep`
            は残します。ドキュメントファイルの削除では、この値は削除の対象範囲について何も示しません。
          nullable: true
          type: string
        progress:
          description: 複数アイテムの削除におけるアイテム数です。この API では設定されず、常に `null` です。
          nullable: true
          properties:
            completed_items:
              description: これまでに削除されたアイテム数です。
              type: integer
            current_item_kind:
              description: 削除中のアイテムの種類です。
              nullable: true
              type: string
            total_items:
              description: 削除対象のアイテム数です。
              nullable: true
              type: integer
          type: object
        retry_at:
          description: 次回の自動再試行の実行日時（ISO 8601）です。予定されていない場合は `null` です。
          nullable: true
          type: string
        run_state:
          description: |-
            スケジューラ上の状態です：

            - `dispatch_pending`（受け付け直後）、`queued`、`running`：処理中です。
            - `retry_wait`：`retry_at` に自動再試行が予定されています。
            - `completed`：すべて削除されました。
            - `failed`：クリーンアップが停止し、対象は非表示のままです。再試行はできません。
          type: string
        target_id:
          description: 対象の ID です。`document` ではドキュメントファイル ID、`source` ではソース ID です。
          type: string
        target_type:
          description: ジョブの削除対象です。ドキュメントファイルは `document`、ソースは `source` です。
          type: string
        updated_at:
          description: ジョブが最後に変更された日時（ISO 8601）です。
          type: string
      type: object
  securitySchemes:
    ApiKeyAuth:
      bearerFormat: API_KEY
      description: >-
        すべてのリクエストは API キーで認証します：`Authorization: Bearer
        {API_KEY}`。アプリのエンドポイントにはアプリの API キーを、ナレッジのエンドポイントにはナレッジベースの API
        キーを使用します（[Dify API クイックスタート](/ja/api-reference/guides/get-started)）。


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

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.