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

# Update Chunk

> Edit a chunk's content, embedding, or page range.



## OpenAPI

````yaml PATCH /orgs/{org_id}/k2/{kb_id}/files/{file_id}/chunks/{chunk_uid}
openapi: 3.1.0
info:
  title: Timbal Platform API
  description: Public API documentation for the Timbal platform
  license:
    name: ''
  version: 2.0.0
servers:
  - url: https://api.timbal.ai
    description: Production
  - url: https://api.dev.timbal.ai
    description: Development
security: []
tags:
  - name: ace
    description: Action Control Engine (ACE) operations
  - name: alarms
    description: Metric series and threshold alarms
  - name: analytics
    description: Org and project analytics
  - name: billing
    description: Subscriptions, usage, and payment-related operations
  - name: channels
    description: Delivery channels alarms notify through
  - name: content
    description: Re-sign stored content URLs
  - name: files
    description: File operations
  - name: iam
    description: IAM — actions, roles, users, and authorization introspection
  - name: k2
    description: Knowledge Bases v2 operations
  - name: orgs
    description: Organization operations
  - name: projects
    description: Project operations
  - name: runs
    description: Execution operations
  - name: templates
    description: Public project template catalog
  - name: users
    description: Authenticated user profile
paths:
  /orgs/{org_id}/k2/{kb_id}/files/{file_id}/chunks/{chunk_uid}:
    patch:
      tags:
        - k2
      description: Edit a chunk's content, embedding, or page range.
      operationId: patch
      parameters:
        - name: org_id
          in: path
          required: true
          schema:
            type: string
        - name: kb_id
          in: path
          required: true
          schema:
            type: string
        - name: file_id
          in: path
          required: true
          schema:
            type: string
        - name: chunk_uid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchK2ChunkRequest'
        required: true
      responses:
        '200':
          description: Chunk updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/K2Chunk'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '412':
          description: Precondition failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - bearer_auth: []
components:
  schemas:
    PatchK2ChunkRequest:
      type: object
      properties:
        content:
          type:
            - string
            - 'null'
        embed:
          type:
            - string
            - 'null'
          description: |-
            Text used for vector / full-text indexing. When `content` is
            provided and `embed` is omitted, `embed` is auto-set to the new
            `content`. Send an explicit value to keep an indexing-optimized
            variant distinct from the user-visible text.
        page_end:
          type:
            - integer
            - 'null'
          format: int32
        page_start:
          type:
            - integer
            - 'null'
          format: int32
          description: |-
            Tri-state: omit to leave unchanged, send `null` to clear, send an
            integer to set.
    K2Chunk:
      type: object
      required:
        - uid
        - kb_file_id
        - ordinal
        - content
        - embed
        - blocks
        - index_status
        - revision
        - source
        - created_at
        - updated_at
      properties:
        blocks:
          type: object
          description: |-
            Source-document layout metadata (e.g. bounding boxes, page coords)
            when available. `null` for chunks created or edited by the user.
        content:
          type: string
        created_at:
          type: string
          format: date-time
        embed:
          type: string
        index_error:
          type:
            - string
            - 'null'
        index_status:
          type: string
          description: >-
            Indexing state for search (`pending`, `indexing`, `indexed`, or
            `failed`).
        indexed_at:
          type:
            - string
            - 'null'
          format: date-time
        kb_file_id:
          type: string
        ordinal:
          type: string
          description: Ordering key within the file.
        page_end:
          type:
            - integer
            - 'null'
          format: int32
        page_start:
          type:
            - integer
            - 'null'
          format: int32
        revision:
          type: string
          description: Revision token for optimistic concurrency on update and delete.
        source:
          type: string
          description: 'Origin of the chunk: `parser`, `user_edit`, or `insert`.'
        uid:
          type: string
          format: uuid
          description: Stable per-chunk identity.
        updated_at:
          type: string
          format: date-time
    ErrorMessage:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Machine-readable error code (e.g. `ALREADY_EXISTS`, `BAD_REQUEST`).
        message:
          type: string
          description: Human-readable description.
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      description: >-
        Timbal API key. Obtain your API key from the Timbal platform settings.
        See [Authentication](/api-reference/authentication) for more
        information.

````