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

# Compute Rag Indexes In Batch

> Retrieves and/or creates RAG indexes for multiple knowledge base documents in a single request.



## OpenAPI

````yaml https://api.threetone.in/openapi.json post /v1/voiceai/knowledge-base/rag-index
openapi: 3.1.0
info:
  title: Threetone API Documentation
  version: 1.0.0
servers:
  - url: https://api.threetone.in
    description: Production
security: []
paths:
  /v1/voiceai/knowledge-base/rag-index:
    post:
      tags:
        - Knowledge Base
      summary: Compute Rag Indexes In Batch
      description: >-
        Retrieves and/or creates RAG indexes for multiple knowledge base
        documents in a single request.
      operationId: get_or_create_rag_indexes
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RAGIndexBatchRequestModel'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties:
                  anyOf:
                    - $ref: >-
                        #/components/schemas/RAGIndexBatchSuccessfulResponseModel
                    - $ref: '#/components/schemas/BatchFailureResponseModel'
                type: object
                title: Response Get Or Create Rag Indexes
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
        - HTTPBearer: []
components:
  schemas:
    RAGIndexBatchRequestModel:
      properties:
        items:
          items:
            $ref: '#/components/schemas/GetOrCreateRAGIndexRequestModel'
          type: array
          maxItems: 100
          minItems: 1
          title: Items
          description: List of requested RAG indexes.
      type: object
      required:
        - items
      title: >-
        Body_Compute_RAG_indexes_in_batch_v1_convai_knowledge_base_rag_index_post
      description: Request body for POST /rag-index batch endpoint
    RAGIndexBatchSuccessfulResponseModel:
      properties:
        status:
          type: string
          const: success
          title: Status
          description: Status indicator
          default: success
        data:
          $ref: '#/components/schemas/RAGDocumentIndexResponseModel'
          description: RAG index data
      type: object
      required:
        - data
      title: RAGIndexBatchSuccessfulResponseModel
      description: Successful response for a single batch item
    BatchFailureResponseModel:
      properties:
        status:
          type: string
          const: failure
          title: Status
          description: Status indicator
          default: failure
        error_code:
          type: integer
          title: Error Code
          description: HTTP error code
        error_status:
          type: string
          title: Error Status
          description: Error status string
        error_message:
          type: string
          title: Error Message
          description: Error message
      type: object
      required:
        - error_code
        - error_status
        - error_message
      title: BatchFailureResponseModel
      description: Failure response for a single batch item
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    GetOrCreateRAGIndexRequestModel:
      properties:
        document_id:
          type: string
          title: Document Id
          description: ID of the knowledgebase document for which to retrieve the index
        create_if_missing:
          type: boolean
          title: Create If Missing
          description: Whether to create the RAG index if it does not exist
        model:
          $ref: >-
            #/components/schemas/app__domains__knowledge_base__schemas__EmbeddingModelEnum
          description: Embedding model to use for the RAG index
      type: object
      required:
        - document_id
        - create_if_missing
        - model
      title: GetOrCreateRAGIndexRequestModel
      description: Request item for batch RAG index creation
    RAGDocumentIndexResponseModel:
      properties:
        id:
          type: string
          title: Id
          description: Index ID
        model:
          $ref: >-
            #/components/schemas/app__domains__knowledge_base__schemas__EmbeddingModelEnum
          description: Embedding model used
        status:
          $ref: '#/components/schemas/RAGIndexStatus'
          description: Index status
        progress_percentage:
          type: number
          title: Progress Percentage
          description: Indexing progress (0-100)
        document_model_index_usage:
          $ref: '#/components/schemas/RAGDocumentIndexUsage'
          description: Usage information
      type: object
      required:
        - id
        - model
        - status
        - progress_percentage
        - document_model_index_usage
      title: RAGDocumentIndexResponseModel
      description: Response model for a single RAG index
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    app__domains__knowledge_base__schemas__EmbeddingModelEnum:
      type: string
      enum:
        - e5_mistral_7b_instruct
        - multilingual_e5_large_instruct
        - gemini-embedding-001
      title: EmbeddingModelEnum
      description: Embedding model used for RAG indexing
    RAGIndexStatus:
      type: string
      enum:
        - created
        - processing
        - failed
        - succeeded
        - rag_limit_exceeded
        - document_too_small
        - cannot_index_folder
      title: RAGIndexStatus
      description: Status of a RAG index
    RAGDocumentIndexUsage:
      properties:
        used_bytes:
          type: integer
          title: Used Bytes
          description: Bytes used by this index
      type: object
      required:
        - used_bytes
      title: RAGDocumentIndexUsage
      description: Usage bytes for a RAG index
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      description: API key for programmatic access
      in: header
      name: x-api-key
    HTTPBearer:
      type: http
      description: JWT Bearer token for dashboard access
      scheme: bearer

````