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

# Update Chunk

> Update a chunk's content or metadata.

Args:
    chunk_id: ID of the chunk to update
    request: UpdateChunkRequest with fields to update

Returns:
    ChunkResponse with updated chunk

Examples:
    Update chunk content:
        PATCH /chunks/chunk_123
        {
            "content": "Updated chunk text"
        }
    
    Update chunk metadata:
        PATCH /chunks/chunk_123
        {
            "metadata": {
                "category": "important",
                "tags": ["updated"]
            }
        }
    
    Update both content and metadata:
        PATCH /chunks/chunk_123
        {
            "content": "Updated text",
            "metadata": {"status": "reviewed"}
        }

Note:
    Updating chunk content will regenerate the embedding vector.



## OpenAPI

````yaml api-reference/openapi.json patch /api/v1/chunks/{chunk_id}
openapi: 3.1.0
info:
  title: FastAPI app
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/chunks/{chunk_id}:
    patch:
      tags:
        - Chunks
      summary: Update Chunk
      description: |-
        Update a chunk's content or metadata.

        Args:
            chunk_id: ID of the chunk to update
            request: UpdateChunkRequest with fields to update

        Returns:
            ChunkResponse with updated chunk

        Examples:
            Update chunk content:
                PATCH /chunks/chunk_123
                {
                    "content": "Updated chunk text"
                }
            
            Update chunk metadata:
                PATCH /chunks/chunk_123
                {
                    "metadata": {
                        "category": "important",
                        "tags": ["updated"]
                    }
                }
            
            Update both content and metadata:
                PATCH /chunks/chunk_123
                {
                    "content": "Updated text",
                    "metadata": {"status": "reviewed"}
                }

        Note:
            Updating chunk content will regenerate the embedding vector.
      operationId: update_chunk_api_v1_chunks__chunk_id__patch
      parameters:
        - name: chunk_id
          in: path
          required: true
          schema:
            type: string
            description: Chunk ID
            title: Chunk Id
          description: Chunk ID
        - name: X-Workspace-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: The workspace ID
            title: X-Workspace-Id
          description: The workspace ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateChunkRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChunkResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - DualAuthScheme: []
components:
  schemas:
    UpdateChunkRequest:
      properties:
        content:
          anyOf:
            - type: string
            - type: 'null'
          title: Content
          description: Updated chunk content
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Updated metadata
      type: object
      title: UpdateChunkRequest
      description: Request to update a chunk.
    ChunkResponse:
      properties:
        id:
          type: string
          title: Id
          description: Unique chunk ID
        content_id:
          type: string
          title: Content Id
          description: Parent content ID
        collection_id:
          type: string
          title: Collection Id
          description: Collection ID
        content:
          type: string
          title: Content
          description: Chunk text content
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
          description: Chunk metadata
        chunk_index:
          anyOf:
            - type: integer
            - type: 'null'
          title: Chunk Index
          description: Index of this chunk within the document
        size:
          anyOf:
            - type: integer
            - type: 'null'
          title: Size
          description: Size of chunk in bytes
        created_at:
          anyOf:
            - type: integer
            - type: 'null'
          title: Created At
          description: Creation timestamp
      type: object
      required:
        - id
        - content_id
        - collection_id
        - content
      title: ChunkResponse
      description: Response model for a single chunk.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    DualAuthScheme:
      type: http
      scheme: bearer

````