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

> Search across all training scenarios and knowledge base items using natural language.

# Semantic search across training and knowledge base



## OpenAPI

````yaml post /training/search
openapi: 3.1.0
info:
  title: OpenCX API
  description: >

    OpenCX is an AI-powered, all-in-one platform for customer support and
    outbound communications.


    Use this API to manage your OpenCX organization's AI agents, actions,
    conversations, contacts, and more.


    To get started, generate a new API key from the dashboard.


    ## Authentication

    All API endpoints require authentication using a Bearer token. You can
    generate an API key from your OpenCX dashboard.


    ## Rate Limiting

    API requests are rate limited to ensure fair usage. The current limits are:

    - 100 requests per minute for standard endpoints

    - 1000 requests per minute for streaming endpoints


    ## Error Handling

    The API uses standard HTTP status codes and returns detailed error messages
    in the response body.
  version: 1.0-beta
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://api.open.cx
    description: Production
security:
  - bearerAuth: []
paths:
  /training/search:
    post:
      summary: Semantic search across training and knowledge base
      description: >-
        Search across all training scenarios and knowledge base items using
        natural language. Returns results ranked by semantic relevance with a
        0-100 relevance score. Use this to find existing content before creating
        new training scenarios.
      operationId: searchTrainingKnowledge
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchTrainingKnowledgeInputDto'
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchTrainingKnowledgeResponseDto'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
components:
  schemas:
    SearchTrainingKnowledgeInputDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/SearchTrainingKnowledgeInputDtoInput'
      type: object
      properties:
        query:
          type: string
          minLength: 2
          maxLength: 500
        limit:
          default: 10
          type: number
          minimum: 1
          maximum: 50
        visibility:
          type: array
          items:
            type: string
            enum:
              - internal
              - public
        sourceTypes:
          type: array
          items:
            type: string
            enum:
              - custom_training
              - help_center
              - integration
              - website
        dataSources:
          type: array
          items:
            type: string
            enum:
              - confluence
              - notion
              - zendesk_support
              - shopify
              - gitbook
              - intercom
              - front
              - freshdesk
              - hubspot_kb
              - ai_instructions
              - custom_training
              - website
        sortBy:
          default: relevance
          type: string
          enum:
            - relevance
            - handoffs
            - citations
        dateFrom: {}
        dateTo: {}
        include_content:
          default: true
          description: >-
            Include the full content field in results. Set to false to reduce
            response size.
          type: boolean
      required:
        - query
    SearchTrainingKnowledgeResponseDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/SearchTrainingKnowledgeResponseDto'
      type: object
      properties:
        results:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              title:
                type: string
              visibility:
                type: string
                enum:
                  - internal
                  - public
              source_type:
                type: string
                enum:
                  - custom_training
                  - help_center
                  - integration
                  - website
              source_url:
                anyOf:
                  - type: string
                  - type: 'null'
              updated_at:
                type: string
                format: date-time
              content:
                type: string
              data_source:
                type: string
                enum:
                  - confluence
                  - notion
                  - zendesk_support
                  - shopify
                  - gitbook
                  - intercom
                  - front
                  - freshdesk
                  - hubspot_kb
                  - ai_instructions
                  - custom_training
                  - website
              stream:
                anyOf:
                  - type: string
                  - type: 'null'
              relevance_score:
                type: number
                minimum: 0
                maximum: 100
              directory_id:
                anyOf:
                  - type: string
                  - type: 'null'
              directory_name:
                anyOf:
                  - type: string
                  - type: 'null'
              is_draft:
                type: boolean
              usage_count:
                default: 0
                type: integer
                minimum: -9007199254740991
                maximum: 9007199254740991
              restricted_to_segments:
                type: array
                items:
                  type: string
              restricted_to_channels:
                type: array
                items:
                  type: string
              start_time:
                anyOf:
                  - type: string
                    format: date-time
                  - type: 'null'
              end_time:
                anyOf:
                  - type: string
                    format: date-time
                  - type: 'null'
              content_preview:
                type: string
                description: First 500 characters of content
            required:
              - id
              - title
              - visibility
              - source_type
              - source_url
              - updated_at
              - data_source
              - stream
              - relevance_score
              - directory_id
              - directory_name
              - usage_count
              - content_preview
            additionalProperties: false
        total_count:
          type: number
      required:
        - results
        - total_count
      additionalProperties: false
    ErrorDto:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        error:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````