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

# Add knowledge source

> Train from exactly one of: url (crawl a website from that page), urls (just these pages, up to 20), sitemapUrl (pages listed in a sitemap.xml), file (a base64 .pdf, .docx, .md, .txt or .csv up to 10 MB) or content (supplied text). maxPages caps url and sitemapUrl. Returns a durable job ID.



## OpenAPI

````yaml /api-reference/actions/openapi.json post /api/v1/agents/actions/sources_add
openapi: 3.1.0
info:
  title: CustomerGPT Agent API
  version: 1.0.0
servers:
  - url: https://api.customergpt.ai
security: []
tags:
  - name: Chatbots
  - name: Knowledge
  - name: Custom responses
  - name: Conversations
  - name: Analytics and account
  - name: API keys and team
  - name: Onboarding
paths:
  /api/v1/agents/actions/sources_add:
    post:
      tags:
        - Knowledge
      summary: Add knowledge source
      description: >-
        Train from exactly one of: url (crawl a website from that page), urls
        (just these pages, up to 20), sitemapUrl (pages listed in a
        sitemap.xml), file (a base64 .pdf, .docx, .md, .txt or .csv up to 10 MB)
        or content (supplied text). maxPages caps url and sitemapUrl. Returns a
        durable job ID.
      operationId: sources_add
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $schema: https://json-schema.org/draft/2020-12/schema
              type: object
              properties:
                chatbotId:
                  type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$
                name:
                  type: string
                  minLength: 1
                  maxLength: 100
                url:
                  type: string
                  maxLength: 2048
                  format: uri
                urls:
                  minItems: 1
                  maxItems: 20
                  type: array
                  items:
                    type: string
                    maxLength: 2048
                    format: uri
                sitemapUrl:
                  type: string
                  maxLength: 2048
                  format: uri
                file:
                  type: object
                  properties:
                    name:
                      type: string
                      minLength: 1
                      maxLength: 255
                    data:
                      type: string
                      minLength: 1
                      maxLength: 13981100
                      pattern: ^[A-Za-z0-9+/]+={0,2}$
                  required:
                    - name
                    - data
                  additionalProperties: false
                content:
                  type: string
                  minLength: 1
                  maxLength: 50000
                maxPages:
                  default: 5
                  type: integer
                  minimum: 1
                  maximum: 20
                dryRun:
                  default: false
                  type: boolean
                confirm:
                  default: false
                  type: boolean
              required:
                - chatbotId
                - name
              additionalProperties: false
      responses:
        '200':
          description: Result in {ok:true,data:...}
        '400':
          description: Invalid arguments
        '401':
          description: Authentication required
        '403':
          description: Confirmation required
      security:
        - apiKey: []
        - oauth:
            - agents:write
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-Api-Key
    oauth:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://api.customergpt.ai/authorize
          tokenUrl: https://api.customergpt.ai/token
          scopes:
            agents:read: Read workspace data
            agents:write: Change workspace data

````

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