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

# Update chunks

> This endpoint is used for updating chunks. If the document ID is unspecified, a new document will be created.

The user should have these permissions:
- Can upload document chunk for benchmarks
- Can create company collection
- Can add document chunks to company collection



## OpenAPI

````yaml /api-reference/openapi-v2.yaml post /api/v2/collection/update_chunks
openapi: 3.0.3
info:
  title: Paradigm API
  version: xenial-xerus (v2)
  description: >-
    A versatile and adaptable tool designed to integrate Generative AI into your
    applications
servers:
  - url: https://paradigm.lighton.ai
security: []
tags:
  - name: Models
    description: Operations about AI models
  - name: Files Search
    description: Operations about files search
  - name: Files
    description: Operations about files
  - name: Upload Sessions
    description: Operations about upload sessions
  - name: Workspaces
    description: Operations about workspaces
  - name: Users
    description: Operations about users
  - name: Companies
    description: Operations about companies
  - name: SCIM
    description: Operations about SCIM
  - name: Feedbacks
    description: Operations about feedbacks
  - name: Reporting
    description: Operations about reporting
  - name: Monitoring
    description: Operations about monitoring
  - name: Platform Status
    description: Operations about platform status
paths:
  /api/v2/collection/update_chunks:
    post:
      tags:
        - Monitoring
      summary: Update chunks
      description: >-
        This endpoint is used for updating chunks. If the document ID is
        unspecified, a new document will be created.


        The user should have these permissions:

        - Can upload document chunk for benchmarks

        - Can create company collection

        - Can add document chunks to company collection
      operationId: api_v2_collection_update_chunks_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateChunksRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/UpdateChunksRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/UpdateChunksRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateChunksResponse'
          description: ''
      security:
        - bearerAuth: []
components:
  schemas:
    UpdateChunksRequest:
      type: object
      description: Request serializer for updating document chunks.
      properties:
        chunks:
          type: array
          items:
            $ref: '#/components/schemas/ChunkItem'
          description: List of chunks to update or add to the document
        document_id:
          type: integer
          description: >-
            ID of existing document to update (optional, creates new document if
            not provided)
        document_name:
          type: string
          description: Name for new document (required when creating new document)
        collection:
          type: string
          description: Collection name (required when creating new document)
      required:
        - chunks
    UpdateChunksResponse:
      type: object
      description: Response serializer for chunk update results.
      properties:
        success:
          type: integer
          description: Number of chunks successfully processed
        document_id:
          type: integer
          description: ID of the document that was created or updated
      required:
        - document_id
        - success
    ChunkItem:
      type: object
      description: Serializer for individual chunk items in upload requests.
      properties:
        benchmark_id:
          type: string
          description: Optional benchmark identifier for the chunk
        text:
          type: string
          description: Text content of the chunk to be uploaded
      required:
        - text
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your auth token.

````