> ## 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. Maximum 100 items per request.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/convai/knowledge-base/rag-index
openapi: 3.1.0
info:
  title: Threetone API Documentation
  description: >-
    This is the documentation for the Threetone API. You can use this API to use
    our service programmatically with API keys sent in the x-api-key header. You
    can create and manage API keys in the dashboard at
    https://threetone.in/app/developers/api-keys.
  version: '1.0'
servers:
  - url: https://api.threetone.in
    description: Production
security: []
paths:
  /v1/convai/knowledge-base/rag-index:
    post:
      tags:
        - Agents Platform
      summary: Compute Rag Indexes In Batch
      description: >-
        Retrieves and/or creates RAG indexes for multiple knowledge base
        documents in a single request. Maximum 100 items per request.
      operationId: get_or_create_rag_indexes
      parameters:
        - name: x-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Your API key for programmatic access. Send it in the x-api-key
              header; you can create and manage keys from the Developers page.
            title: X-Api-Key
          description: >-
            Your API key for programmatic access. Send it in the x-api-key
            header; you can create and manage keys from the Developers page.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_get_or_create_rag_indexes'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  oneOf:
                    - $ref: >-
                        #/components/schemas/RAGIndexBatchSuccessfulResponseModel
                    - $ref: '#/components/schemas/BatchFailureResponseModel'
                  discriminator:
                    propertyName: status
                    mapping:
                      success:
                        $ref: >-
                          #/components/schemas/RAGIndexBatchSuccessfulResponseModel
                      failure:
                        $ref: '#/components/schemas/BatchFailureResponseModel'
                title: Response Get Or Create Rag Indexes
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Body_get_or_create_rag_indexes:
      properties:
        items:
          items:
            $ref: '#/components/schemas/GetOrCreateRAGIndexRequestModel'
          type: array
          maxItems: 100
          minItems: 1
          title: Items
          description: List of requested RAG indexes. Minimum 1, maximum 100 items.
      type: object
      required:
        - items
      title: Body_get_or_create_rag_indexes
    RAGIndexBatchSuccessfulResponseModel:
      properties:
        status:
          type: string
          const: success
          title: Status
          default: success
        data:
          $ref: '#/components/schemas/RAGDocumentIndexResponseModel'
      type: object
      required:
        - status
        - data
      title: RAGIndexBatchSuccessfulResponseModel
    BatchFailureResponseModel:
      properties:
        status:
          type: string
          const: failure
          title: Status
          default: failure
        error_code:
          type: integer
          title: Error Code
        error_status:
          type: string
          title: Error Status
        error_message:
          type: string
          title: Error Message
      type: object
      required:
        - status
        - error_code
        - error_status
        - error_message
      title: BatchFailureResponseModel
    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/EmbeddingModelEnum'
          description: Embedding model to use for the RAG index
      type: object
      required:
        - document_id
        - create_if_missing
        - model
      title: GetOrCreateRAGIndexRequestModel
    RAGDocumentIndexResponseModel:
      properties:
        id:
          type: string
          title: Id
        model:
          $ref: '#/components/schemas/EmbeddingModelEnum'
        status:
          $ref: '#/components/schemas/RAGIndexStatus'
        progress_percentage:
          type: number
          title: Progress Percentage
        document_model_index_usage:
          $ref: '#/components/schemas/RAGDocumentIndexUsage'
      type: object
      required:
        - id
        - model
        - status
        - progress_percentage
        - document_model_index_usage
      title: RAGDocumentIndexResponseModel
    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
    EmbeddingModelEnum:
      type: string
      enum:
        - e5_mistral_7b_instruct
        - multilingual_e5_large_instruct
      title: EmbeddingModelEnum
      default: e5_mistral_7b_instruct
    RAGIndexStatus:
      type: string
      enum:
        - new
        - created
        - processing
        - failed
        - succeeded
        - rag_limit_exceeded
        - document_too_small
        - cannot_index_folder
      title: RAGIndexStatus
    RAGDocumentIndexUsage:
      properties:
        used_bytes:
          type: integer
          title: Used Bytes
      type: object
      required:
        - used_bytes
      title: RAGDocumentIndexUsage

````