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

# Create Knowledge Base

> Creates a single-source knowledge base using either a URL (link) OR one uploaded file (file). Only one source is allowed per request.



## OpenAPI

````yaml /api-reference/openapi.json post /api/knowledge-base
openapi: 3.1.0
info:
  title: Ello.AI API
  description: API for managing agents and calls in Ello.AI
  version: 1.0.0
servers:
  - url: https://api.getello.ai/
security: []
paths:
  /api/knowledge-base:
    post:
      tags:
        - Knowledge Base
      summary: Create Knowledge Base
      description: >-
        Creates a single-source knowledge base using either a URL (link) OR one
        uploaded file (file). Only one source is allowed per request.
      operationId: createSingleSourceKnowledgeBase
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: URL-based single source knowledge base
              required:
                - baseUrl
              example: {}
              properties:
                urlName:
                  type: string
                  example: Ello.ai
                baseUrl:
                  type: string
                  format: uri
                  example: https://getello.ai
                subLinks:
                  type: array
                  items:
                    type: string
                    format: uri
                  example:
                    - https://getello.ai/pricing
                    - https://getello.ai/blog
                type:
                  type: string
                  enum:
                    - link
                  example: link
                  description: Optional. If provided should be 'link'.
                workspaceId:
                  type: string
                  description: >-
                    Optional. If not provided, workspace is taken from the
                    authenticated token.
                  example: 685d4b93fb5b2e221dc80ea9
          multipart/form-data:
            schema:
              type: object
              description: File-based single source knowledge base (only ONE file allowed)
              required:
                - type
                - file
              example: {}
              properties:
                type:
                  type: string
                  enum:
                    - file
                  description: Must be 'file' when uploading a document
                  example: file
                file:
                  type: string
                  format: binary
                  description: Single PDF/document file to upload
                urlName:
                  type: string
                  description: Optional display name for the KB (defaults to file name)
                  example: Invoice KB
                workspaceId:
                  type: string
                  description: >-
                    Optional. If not provided, workspace is taken from the
                    authenticated token.
                  example: 685d4b93fb5b2e221dc80ea9
      responses:
        '201':
          description: Knowledge base created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 201
                  message:
                    type: string
                    example: Single source knowledge base created successfully
                  data:
                    type: object
        '400':
          description: Bad Request / Validation Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 400
                  message:
                    type: string
                    example: 'Single source mode: Please provide either files or a URL'
                  errors:
                    type: array
                    description: Present for Joi validation errors
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                          example: body.baseUrl
                        message:
                          type: string
                          example: '"baseUrl" must be a valid uri'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 401
                  message:
                    type: string
                    example: Unauthorized access
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 409
                  message:
                    type: string
                    example: >-
                      Knowledge base name 'My KB' is already in use. Please
                      choose a different name.
                  error:
                    type: object
                    properties:
                      details:
                        type: string
                        example: Knowledge base name conflict
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 422
                  message:
                    type: string
                    example: >-
                      Content unavailable. This link might be private or
                      protected by a security firewall.
                  error:
                    type: object
                    properties:
                      details:
                        type: string
                        example: No content retrieved from provided URLs
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 500
                  message:
                    type: string
                    example: Create single knowledge base
                  error:
                    type: object
                    properties:
                      details:
                        type: string
                        example: Internal error message
      security:
        - apiKey: []
        - bearerAuth: []
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-Key
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````