> ## 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 patch /datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}/child_chunks/{child_chunk_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}/segments/{segment_id}/child_chunks/{child_chunk_id}:
    patch:
      tags:
        - チャンク
      summary: 子チャンクを更新
      description: 既存の子チャンクのコンテンツを更新します。
      operationId: updateChildChunk
      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: segment_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Chunk ID.
        - name: child_chunk_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: 子チャンク ID です。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - content
              properties:
                content:
                  type: string
                  description: 子チャンクのテキスト内容です。
      responses:
        '200':
          description: 子チャンクが正常に更新されました。
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ChildChunk'
              examples:
                success:
                  summary: レスポンス例
                  value:
                    data:
                      id: d7e8f9a0-1b2c-3d4e-5f6a-7b8c9d0e1f2a
                      segment_id: f3d1c7be-9f3a-40d8-8eb8-3a1ef9c3f2c1
                      content: Dify is an open-source platform.
                      position: 1
                      word_count: 6
                      type: automatic
                      created_at: 1741267200
                      updated_at: 1741267200
        '400':
          description: '`invalid_param` : 子チャンクインデックスの更新に失敗しました。'
          content:
            application/json:
              examples:
                invalid_param:
                  summary: invalid_param
                  value:
                    status: 400
                    code: invalid_param
                    message: 'Create child chunk index failed: {error details}'
components:
  schemas:
    ChildChunk:
      type: object
      properties:
        id:
          type: string
          description: 子チャンクの一意識別子です。
        segment_id:
          type: string
          description: この子チャンクが属する親チャンクの ID です。
        content:
          type: string
          description: 子チャンクのテキスト内容です。
        position:
          type: integer
          description: 親チャンク内の子チャンクの位置です。
        word_count:
          type: integer
          description: 子チャンク内容の単語数です。
        type:
          type: string
          description: 子チャンクの作成方法です。システム生成の場合は `automatic`、手動作成の場合は `custom` です。
        created_at:
          type: number
          description: 作成タイムスタンプ（Unix エポック、秒単位）です。
        updated_at:
          type: number
          description: 最終更新タイムスタンプ（Unix エポック、秒単位）です。
  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
        の漏洩は深刻な結果につながる可能性があります。**

````