> ## 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 Website

> Crawl websites, process the content, and use it to train the specified RAG system.



## OpenAPI

````yaml post /train/website/
openapi: 3.0.3
info:
  title: Lyzr Knowledge Base - Train Website
  version: 1.0.0
  description: Crawl and train a RAG system using content from specified website URLs.
servers:
  - url: https://rag-prod.studio.lyzr.ai/v3
security: []
paths:
  /train/website/:
    post:
      summary: Train Website
      description: >-
        Crawl websites, process the content, and use it to train the specified
        RAG system.
      operationId: trainWebsite
      parameters:
        - name: rag_id
          in: query
          required: true
          description: >-
            The ID of the RAG system to train (must be a 24-character hex
            string).
          schema:
            type: string
            example: 654c602a46c3b6d4e28741b0
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - urls
                - source
                - max_crawl_pages
                - max_crawl_depth
                - dynamic_content_wait_secs
                - actor
                - crawler_type
                - chunk_size
                - chunk_overlap
              properties:
                urls:
                  type: array
                  items:
                    type: string
                  description: List of website URLs to crawl
                  example:
                    - string
                source:
                  type: string
                  description: Data source identifier
                  example: website
                max_crawl_pages:
                  type: integer
                  description: Maximum number of pages to crawl
                  example: 1
                max_crawl_depth:
                  type: integer
                  description: Maximum crawl depth
                  example: 0
                dynamic_content_wait_secs:
                  type: integer
                  description: Time to wait for dynamic content to load (in seconds)
                  example: 5
                actor:
                  type: string
                  description: Apify actor used for crawling
                  example: apify/website-content-crawler
                crawler_type:
                  type: string
                  description: Type of crawler used
                  example: cheerio
                chunk_size:
                  type: integer
                  description: Size of the chunks for text splitting
                  example: 1000
                chunk_overlap:
                  type: integer
                  description: Overlap between consecutive text chunks
                  example: 100
      responses:
        '200':
          description: Website successfully crawled, processed, and RAG system trained.
          content:
            application/json:
              schema:
                type: string
                description: Placeholder for a success message or job ID.
        '422':
          description: Validation Error (e.g., missing required fields in request body).
          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
        '500':
          description: Internal Server Error or application-specific error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    example: >-
                      Training Error: '12332' is not a valid ObjectId, it must
                      be a 12-byte input or a 24-character hex string
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````