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

# Index Knowledge Base Item

> Makes the item's current chunks searchable by your agents, including any edits. Only new and changed chunks are processed again. The item goes to `PROCESSING` until indexing finishes. When nothing changed since the last index and the item is `PROCESSED`, nothing is queued (`queued: false`).



## OpenAPI

````yaml /api-reference/openapi.json post /v1/voice-agents/knowledge-base/{id}/index
openapi: 3.0.1
info:
  title: Hamsa API
  description: >-
    The Hamsa API: voice agents and their calls, phone numbers, batch calls and
    knowledge bases; speech to text, text to speech, voices and AI content.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.tryhamsa.com
security: []
paths:
  /v1/voice-agents/knowledge-base/{id}/index:
    post:
      summary: Index a knowledge base item
      description: >-
        Makes the item's current chunks searchable by your agents, including any
        edits. Only new and changed chunks are processed again. The item goes to
        `PROCESSING` until indexing finishes. When nothing changed since the
        last index and the item is `PROCESSED`, nothing is queued (`queued:
        false`).
      parameters:
        - in: path
          name: id
          required: true
          description: ID of the knowledge base item.
          schema:
            type: string
            format: uuid
            example: d949f13f-40d2-4e48-ac86-b66633070603
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Chunks are being indexed...
                  messageKey:
                    type: string
                    example: ChunksIndexingStarted
                  data:
                    type: object
                    properties:
                      queued:
                        type: boolean
                        description: >-
                          `true` when indexing started. `false` when there was
                          nothing to index.
                        example: true
                      indexVersion:
                        type: integer
                        description: The item's index version after this call.
                        example: 3
                      chunksToEmbed:
                        type: integer
                        description: >-
                          Number of new or changed chunks to process. `0` when
                          nothing was queued.
                        example: 4
                    description: >-
                      When nothing is queued the message is `success` and there
                      is no `messageKey`.
        '400':
          description: The item has no chunks to index (`KnowledgeBaseItemHasNoChunks`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '401':
          description: 'Unauthorized: missing or invalid API key.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '403':
          description: >-
            Your API key or role does not have the `knowledge_base:update`
            permission.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '404':
          description: Knowledge base item not found in this project.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '422':
          description: >-
            The item is still processing (`KnowledgeBaseItemIsProcessing`): wait
            for it to finish before changing its chunks.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '500':
          description: Server Side Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '503':
          description: >-
            Hamsa couldn't process the item right now: it is marked
            `INGESTION_FAILURE`. Try again later.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    ErrorSchema:
      type: object
      properties:
        code:
          type: integer
          description: >-
            Service error code: the HTTP status with a service prefix (for
            example `8404`). Missing when the service has no code for that
            status.
          example: 8404
        message:
          type: string
          description: >-
            What went wrong. Some services (calls and recordings) put the error
            key here, for example `CallNotFoundOrUnavailable`, and send no
            `messageKey`.
          example: Policy not found!
        messageKey:
          type: string
          description: >-
            Stable key for the error, safe to match on in code. Not returned by
            every service.
          example: PolicyNotFound
        params:
          type: object
          additionalProperties: true
          description: >-
            Details for some errors (for example `reason`). Not returned by
            every service.
          example:
            reason: NO_DRAFT
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Pass the API key in the Authorization header, You need to put Token
        keyword before the API key. e.g. 'Authorization: Token <api-key>'

````

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