openapi: 3.1.0
info:
  title: Evolution Foundation - Knowledge Service - Knowledge
  description: Knowledge base and memory management
  version: 1.0.0
servers:
- url: https://api.evoai.app
  description: Production server
- url: http://localhost:3005
  description: Development server
  variables:
    port:
      default: '3005'
- url: '{customUrl}'
  description: Custom server
  variables:
    customUrl:
      default: https://your-instance.com
      description: Enter your server URL
paths:
  /api/v1/knowledge:
    post:
      summary: Create Knowledge
      description: 'Create a new knowledge entry


        If x-knowledge-base-config-id header is provided, uses that specific configuration.

        Otherwise, uses the account''s default active knowledge base configuration.'
      operationId: create_knowledge_api_v1_knowledge_post
      parameters:
      - name: x-knowledge-base-config-id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: X-Knowledge-Base-Config-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KnowledgeCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse_Knowledge_'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid input data
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge
                  method: POST
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge
                  method: POST
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge
                  method: POST
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Knowledge base configuration not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge
                  method: POST
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge
                  method: POST
    get:
      summary: List Knowledge
      description: 'List knowledge entries for a client


        If x-knowledge-base-config-id header is provided, uses that specific configuration.

        Otherwise, uses the account''s default active knowledge base configuration.'
      operationId: list_knowledge_api_v1_knowledge__get
      parameters:
      - name: skip
        in: query
        required: false
        schema:
          type: integer
          description: Number of records to skip
          default: 0
          title: Skip
        description: Number of records to skip
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          description: Maximum number of records to return
          default: 100
          title: Limit
        description: Maximum number of records to return
      - name: tags
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Filter by tags (comma-separated)
          title: Tags
        description: Filter by tags (comma-separated)
      - name: is_active
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          description: Filter by active status
          title: Is Active
        description: Filter by active status
      - name: x-client-id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: X-Client-Id
      - name: x-knowledge-base-config-id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: X-Knowledge-Base-Config-Id
      responses:
        '200':
          description: Knowledge entries retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse_List_Knowledge__'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request parameters
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/
                  method: GET
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/
                  method: GET
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/
                  method: GET
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Resource not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/
                  method: GET
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/
                  method: GET
  /api/v1/knowledge/health/status:
    get:
      summary: Get Knowledge Health
      description: Get the health status of the knowledge service
      operationId: get_knowledge_health_api_v1_knowledge_health_status_get
      parameters:
      - name: x-client-id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: X-Client-Id
      responses:
        '200':
          description: Health status retrieved successfully
          content:
            application/json:
              schema: {}
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request parameters
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/health/status
                  method: GET
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/health/status
                  method: GET
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/health/status
                  method: GET
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Resource not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/health/status
                  method: GET
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/health/status
                  method: GET
  /api/v1/knowledge/process-url:
    post:
      summary: Process Document From Url
      description: Process a document from URL to create knowledge entries using Docling
      operationId: process_document_from_url_api_v1_knowledge_process_url_post
      parameters:
      - name: x-knowledge-base-config-id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: X-Knowledge-Base-Config-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentUrlRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse_DocumentProcessResponse_'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid input data
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/process-url
                  method: POST
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/process-url
                  method: POST
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/process-url
                  method: POST
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Knowledge base configuration or document URL not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/process-url
                  method: POST
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/process-url
                  method: POST
  /api/v1/knowledge/search:
    post:
      summary: Search Knowledge
      description: 'Search knowledge entries


        If x-knowledge-base-config-id header is provided, uses that specific configuration.

        Otherwise, uses the default active configuration for the account.'
      operationId: search_knowledge_api_v1_knowledge_search_post
      parameters:
      - name: x-client-id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: X-Client-Id
      - name: x-knowledge-base-config-id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: X-Knowledge-Base-Config-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KnowledgeSearch'
      responses:
        '200':
          description: Knowledge search completed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse_KnowledgeSearchResponse_'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid input data
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/search
                  method: POST
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/search
                  method: POST
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/search
                  method: POST
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Knowledge base configuration not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/search
                  method: POST
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/search
                  method: POST
  /api/v1/knowledge/supported-formats:
    get:
      summary: Get Supported Formats
      description: Get list of supported document formats for Docling processing
      operationId: get_supported_formats_api_v1_knowledge_supported_formats_get
      responses:
        '200':
          description: Supported formats retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse_SupportedFormatsResponse_'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request parameters
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/supported-formats
                  method: GET
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/supported-formats
                  method: GET
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/supported-formats
                  method: GET
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Resource not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/supported-formats
                  method: GET
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/supported-formats
                  method: GET
  /api/v1/knowledge/upload-document:
    post:
      summary: Upload Document
      description: Upload and process a document to create knowledge entries using Docling
      operationId: upload_document_api_v1_knowledge_upload_document_post
      parameters:
      - name: x-knowledge-base-config-id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: X-Knowledge-Base-Config-Id
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_document_api_v1_knowledge_upload_document_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse_DocumentProcessResponse_'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid tags format, unsupported file format, or invalid account ID
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/upload-document
                  method: POST
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/upload-document
                  method: POST
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/upload-document
                  method: POST
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Knowledge base configuration not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/upload-document
                  method: POST
        '413':
          description: Request entity too large - file exceeds 50MB limit
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: PAYLOAD_TOO_LARGE
                  message: File exceeds 50MB limit
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/upload-document
                  method: POST
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/upload-document
                  method: POST
  /api/v1/knowledge/{knowledge_id}:
    get:
      summary: Get Knowledge
      description: Get details of a specific knowledge entry
      operationId: get_knowledge_api_v1_knowledge__knowledge_id__get
      parameters:
      - name: knowledge_id
        in: path
        required: true
        schema:
          type: string
          title: Knowledge Id
      - name: x-client-id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: X-Client-Id
      responses:
        '200':
          description: Knowledge entry retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse_Knowledge_'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request parameters
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/{knowledge_id}
                  method: GET
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/{knowledge_id}
                  method: GET
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/{knowledge_id}
                  method: GET
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Knowledge entry not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/{knowledge_id}
                  method: GET
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/{knowledge_id}
                  method: GET
    put:
      summary: Update Knowledge
      description: Update a knowledge entry
      operationId: update_knowledge_api_v1_knowledge__knowledge_id__put
      parameters:
      - name: knowledge_id
        in: path
        required: true
        schema:
          type: string
          title: Knowledge Id
      - name: x-client-id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: X-Client-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KnowledgeUpdate'
      responses:
        '200':
          description: Knowledge entry updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse_Knowledge_'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid input data
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/{knowledge_id}
                  method: PUT
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/{knowledge_id}
                  method: PUT
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/{knowledge_id}
                  method: PUT
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Knowledge entry not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/{knowledge_id}
                  method: PUT
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/{knowledge_id}
                  method: PUT
    delete:
      summary: Delete Knowledge
      description: Delete a knowledge entry
      operationId: delete_knowledge_api_v1_knowledge__knowledge_id__delete
      parameters:
      - name: knowledge_id
        in: path
        required: true
        schema:
          type: string
          title: Knowledge Id
      - name: x-client-id
        in: header
        required: false
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: X-Client-Id
      responses:
        '200':
          description: Knowledge entry deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Knowledge entry deleted successfully
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid request parameters
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/{knowledge_id}
                  method: DELETE
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/{knowledge_id}
                  method: DELETE
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/{knowledge_id}
                  method: DELETE
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Knowledge entry not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/{knowledge_id}
                  method: DELETE
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/knowledge/{knowledge_id}
                  method: DELETE
components:
  schemas:
    Body_upload_document_api_v1_knowledge_upload_document_post:
      properties:
        file:
          type: string
          format: binary
          title: File
          description: Document file to process
        client_id:
          type: string
          format: uuid
          title: Client Id
          description: Client ID that will own the knowledge
        title:
          anyOf:
          - type: string
          - type: 'null'
          title: Title
          description: Custom title for the document
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          description: Custom description for the document
        tags:
          anyOf:
          - type: string
          - type: 'null'
          title: Tags
          description: Custom tags for the document (JSON array)
        chunk_size:
          type: integer
          maximum: 10000
          minimum: 1000
          title: Chunk Size
          description: Size of text chunks for large documents
          default: 5000
        overlap_size:
          type: integer
          maximum: 1000
          minimum: 0
          title: Overlap Size
          description: Overlap between chunks
          default: 200
      type: object
      required:
      - file
      - client_id
      title: Body_upload_document_api_v1_knowledge_upload_document_post
    DocumentUrlRequest:
      properties:
        client_id:
          type: string
          format: uuid
          title: Client Id
          description: Client ID that will own the knowledge
        url:
          type: string
          maxLength: 2083
          minLength: 1
          format: uri
          title: Url
          description: URL of the document to process
        title:
          anyOf:
          - type: string
          - type: 'null'
          title: Title
          description: Custom title for the document
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          description: Custom description for the document
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
          description: Custom tags for the document
        include_sub_pages:
          type: boolean
          title: Include Sub Pages
          description: Whether to crawl and process sub-pages found in the main page
          default: false
        max_pages:
          type: integer
          maximum: 50
          minimum: 1
          title: Max Pages
          description: Maximum number of pages to process (including main page)
          default: 1
      type: object
      required:
      - client_id
      - url
      title: DocumentUrlRequest
      description: Schema for processing document from URL
    ErrorResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Success indicator
          default: false
        error:
          $ref: '#/components/schemas/ErrorInfo'
        meta:
          $ref: '#/components/schemas/MetaInfoError'
          description: Metadata
      type: object
      required:
      - error
      - meta
      title: ErrorResponse
      description: 'Standard error response schema matching error_response() return format.


        This schema matches the structure returned by error_response() function,

        which always uses ErrorInfo for the error field.'
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    KnowledgeCreate:
      properties:
        title:
          type: string
          title: Title
          description: Title of the knowledge entry
        content:
          type: string
          title: Content
          description: Content of the knowledge entry
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          description: Description of the knowledge entry
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
          description: Tags for categorization
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
          description: Additional metadata
        is_active:
          type: boolean
          title: Is Active
          description: Whether the knowledge entry is active
          default: true
        client_id:
          type: string
          format: uuid
          title: Client Id
          description: Client ID that owns this knowledge
      type: object
      required:
      - title
      - content
      - client_id
      title: KnowledgeCreate
      description: Schema for creating knowledge entries
    KnowledgeSearch:
      properties:
        query:
          type: string
          title: Query
          description: Search query
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
          description: Filter by tags
        max_results:
          type: integer
          title: Max Results
          description: Maximum number of results
          default: 10
      type: object
      required:
      - query
      title: KnowledgeSearch
      description: Schema for knowledge search requests
    KnowledgeUpdate:
      properties:
        title:
          anyOf:
          - type: string
          - type: 'null'
          title: Title
          description: Title of the knowledge entry
        content:
          anyOf:
          - type: string
          - type: 'null'
          title: Content
          description: Content of the knowledge entry
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          description: Description of the knowledge entry
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
          description: Tags for categorization
        metadata:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Metadata
          description: Additional metadata
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
          description: Whether the knowledge entry is active
      type: object
      title: KnowledgeUpdate
      description: Schema for updating knowledge entries
    SuccessResponse_DocumentProcessResponse_:
      properties:
        success:
          type: boolean
          title: Success
          description: Success indicator
          default: true
        data:
          $ref: '#/components/schemas/DocumentProcessResponse'
          description: Response payload
        meta:
          $ref: '#/components/schemas/MetaInfo'
          description: Metadata
        message:
          anyOf:
          - type: string
          - type: 'null'
          title: Message
          description: Optional success message
      type: object
      required:
      - data
      - meta
      title: SuccessResponse[DocumentProcessResponse]
    SuccessResponse_KnowledgeSearchResponse_:
      properties:
        success:
          type: boolean
          title: Success
          description: Success indicator
          default: true
        data:
          $ref: '#/components/schemas/KnowledgeSearchResponse'
          description: Response payload
        meta:
          $ref: '#/components/schemas/MetaInfo'
          description: Metadata
        message:
          anyOf:
          - type: string
          - type: 'null'
          title: Message
          description: Optional success message
      type: object
      required:
      - data
      - meta
      title: SuccessResponse[KnowledgeSearchResponse]
    SuccessResponse_Knowledge_:
      properties:
        success:
          type: boolean
          title: Success
          description: Success indicator
          default: true
        data:
          $ref: '#/components/schemas/Knowledge'
          description: Response payload
        meta:
          $ref: '#/components/schemas/MetaInfo'
          description: Metadata
        message:
          anyOf:
          - type: string
          - type: 'null'
          title: Message
          description: Optional success message
      type: object
      required:
      - data
      - meta
      title: SuccessResponse[Knowledge]
    SuccessResponse_List_Knowledge__:
      properties:
        success:
          type: boolean
          title: Success
          description: Success indicator
          default: true
        data:
          items:
            $ref: '#/components/schemas/Knowledge'
          type: array
          title: Data
          description: Response payload
        meta:
          $ref: '#/components/schemas/MetaInfo'
          description: Metadata
        message:
          anyOf:
          - type: string
          - type: 'null'
          title: Message
          description: Optional success message
      type: object
      required:
      - data
      - meta
      title: SuccessResponse[List[Knowledge]]
    SuccessResponse_SupportedFormatsResponse_:
      properties:
        success:
          type: boolean
          title: Success
          description: Success indicator
          default: true
        data:
          $ref: '#/components/schemas/SupportedFormatsResponse'
          description: Response payload
        meta:
          $ref: '#/components/schemas/MetaInfo'
          description: Metadata
        message:
          anyOf:
          - type: string
          - type: 'null'
          title: Message
          description: Optional success message
      type: object
      required:
      - data
      - meta
      title: SuccessResponse[SupportedFormatsResponse]
