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

# Train DOCX for RAG

> Upload a DOCX file to train and add content into a specific RAG configuration.



## OpenAPI

````yaml post /train/docx/
openapi: 3.0.3
info:
  title: Train DOCX for RAG
  version: 1.0.0
  description: Upload and train a DOCX document into a RAG configuration.
servers:
  - url: https://rag-prod.studio.lyzr.ai/v3
security: []
paths:
  /train/docx/:
    post:
      summary: Train DOCX for RAG
      description: >-
        Upload a DOCX file to train and add content into a specific RAG
        configuration.
      operationId: trainDocx
      parameters:
        - name: rag_id
          in: query
          required: true
          description: >-
            The ID of the RAG configuration to which this document will be
            added.
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                  description: The DOCX file to upload and train.
                data_parser:
                  type: string
                  description: Optional parser type. (e.g., "docx2txt")
                  default: docx2txt
                extra_info:
                  type: string
                  description: Optional additional metadata in stringified JSON.
                  default: '{}'
              required:
                - file
      responses:
        '200':
          description: DOCX trained successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: DOCX parsing and training completed successfully
                  rag_id:
                    type: string
                    example: 6848ff3c4c291b4bef798e0c
                  document_count:
                    type: integer
                    example: 1
        '403':
          description: Forbidden - Invalid API key or permission
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: Invalid permission
        '422':
          description: Validation Error - Missing fields or bad file format
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: array
                    items:
                      type: object
                      properties:
                        loc:
                          type: array
                          items:
                            oneOf:
                              - type: string
                              - type: integer
                        msg:
                          type: string
                        type:
                          type: string
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````