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

# Semantic search over knowledge entries

> Embeds the query with the same model used for the entries and returns the most similar knowledge entries within the current tenant. Filters can be combined with the semantic search.



## OpenAPI

````yaml /api-reference/openapi.json post /api/knowledge/knowledge-entries/search
openapi: 3.1.0
info:
  title: Big Panda — Public API
  description: >-
    Externe REST-API für Connector-Plugins (JTL, Shopware), n8n-Integrationen
    und Custom-Clients. Tenant-Routing über Subdomain, Auth über Bearer-Token.
  version: 0.1.0
servers:
  - url: https://{tenant}.app.big-panda.ai
    description: Big Panda — Tenant-Subdomain. Ersetze {tenant} durch deinen Tenant-Slug.
    variables:
      tenant:
        default: demo
        description: Dein Big-Panda-Tenant-Slug (z.B. 'acme').
security:
  - BearerAuth: []
tags:
  - name: Products
  - name: Knowledge Entries
  - name: Categories
  - name: Sites
  - name: Search
  - name: OAuth
    description: >-
      OAuth-2.1-Authentifizierung — Discovery, Dynamic Client Registration,
      Authorize, Token, Revoke.
paths:
  /api/knowledge/knowledge-entries/search:
    post:
      tags:
        - Knowledge Entries
      summary: Semantic search over knowledge entries
      description: >-
        Embeds the query with the same model used for the entries and returns
        the most similar knowledge entries within the current tenant. Filters
        can be combined with the semantic search.
      operationId: search_knowledge_entries_knowledge_entries_search_post
      parameters:
        - name: X-Scopes
          in: header
          required: false
          schema:
            type: string
            description: Space-separated scope set from the token (ADR-015)
            default: ''
            title: X-Scopes
          description: Space-separated scope set from the token (ADR-015)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KnowledgeEntrySearchRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/KnowledgeEntrySearchResult-Output'
                title: >-
                  Response Search Knowledge Entries Knowledge Entries Search
                  Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    KnowledgeEntrySearchRequest:
      properties:
        query:
          type: string
          maxLength: 2000
          minLength: 1
          title: Query
          description: >-
            Free-text query to search for. Will be embedded with the same model
            that was used for the knowledge entries.
        limit:
          type: integer
          maximum: 100
          minimum: 1
          title: Limit
          description: Maximum number of results to return
          default: 10
        min_similarity:
          anyOf:
            - type: number
              maximum: 1
              minimum: -1
            - type: 'null'
          title: Min Similarity
          description: >-
            If set, drop results with similarity below this threshold (1.0 =
            identical, 0.0 = unrelated)
        category_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Category Id
          description: Restrict results to a specific category
        type:
          anyOf:
            - $ref: '#/components/schemas/EntryType'
            - type: 'null'
          description: Restrict results to a specific entry type (knowledge, skill, ...)
        project_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Project Id
          description: >-
            Restrict results to entries linked to that project via
            project_members
        visibility:
          anyOf:
            - $ref: '#/components/schemas/Visibility'
            - type: 'null'
          description: Restrict results to a specific visibility level
        layer:
          anyOf:
            - type: string
            - type: 'null'
          title: Layer
          description: Restrict results to a specific knowledge layer
        tags:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Tags
          description: Restrict results to entries that have ANY of these tags
        language:
          anyOf:
            - type: string
            - type: 'null'
          title: Language
          description: >-
            Restrict results to a specific language (e.g. 'de', 'en'). If unset,
            searches all languages.
      type: object
      required:
        - query
      title: KnowledgeEntrySearchRequest
      description: Payload for the semantic search endpoint.
    KnowledgeEntrySearchResult-Output:
      properties:
        entry:
          $ref: '#/components/schemas/KnowledgeEntryResponse-Output'
        similarity:
          type: number
          title: Similarity
          description: >-
            Similarity score: 1.0 = identical, 0.0 = unrelated, -1.0 = opposite.
            Computed as 1 - cosine_distance.
      type: object
      required:
        - entry
        - similarity
      title: KnowledgeEntrySearchResult
      description: One hit in a semantic search response.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    EntryType:
      type: string
      enum:
        - knowledge
        - skill
        - process
        - glossary
        - memory
        - bootstrap
        - skill_index
      title: EntryType
      description: |-
        Allowed values for the `type` discriminator (ADR-020).

        Mirrors `ALLOWED_TYPES` in app/models/knowledge_entry.py and the
        DB CHECK constraint added in migration 0026. Each value selects a
        metadata-schema in app/schemas/entry_metadata.py.
    Visibility:
      type: string
      enum:
        - public
        - internal
        - personal
        - restricted
        - community
        - workspace
      title: Visibility
      description: |-
        Allowed values for the `visibility` field of a knowledge entry.

        'personal' is ownership-gated (ADR-015 §3a): it exists in the enum
        so responses carrying it validate correctly, but write-side routes
        block it on the main path — personal entries are created via
        POST /knowledge-entries/personal only.

        'workspace' (ROADMAP M.8) is the workspace-scoped visibility hook.
        Code accepts the value passively until `tenants.workspaces_enabled`
        is flipped on; today no read path filters by it.
    KnowledgeEntryResponse-Output:
      properties:
        title:
          type: string
          maxLength: 500
          minLength: 1
          title: Title
        content:
          type: string
          minLength: 1
          title: Content
        summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Summary
        category_id:
          type: string
          format: uuid
          title: Category Id
        layer:
          anyOf:
            - type: string
              maxLength: 50
            - type: 'null'
          title: Layer
        tags:
          items:
            type: string
          type: array
          title: Tags
        visibility:
          $ref: '#/components/schemas/Visibility'
        id:
          type: string
          format: uuid
          title: Id
        tenant_id:
          type: string
          title: Tenant Id
        type:
          $ref: '#/components/schemas/EntryType'
        version:
          type: integer
          title: Version
        workspace_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Workspace Id
        created_by_user_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Created By User Id
        language:
          type: string
          title: Language
        translation_group_id:
          type: string
          format: uuid
          title: Translation Group Id
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
        source:
          $ref: '#/components/schemas/KnowledgeSource'
        source_reference:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Reference
        embedding_model:
          anyOf:
            - type: string
            - type: 'null'
          title: Embedding Model
        search_keywords:
          items:
            type: string
          type: array
          title: Search Keywords
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - title
        - content
        - category_id
        - visibility
        - id
        - tenant_id
        - type
        - version
        - language
        - translation_group_id
        - source
        - source_reference
        - embedding_model
        - created_at
        - updated_at
      title: KnowledgeEntryResponse
      description: Knowledge entry data returned in HTTP responses.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    KnowledgeSource:
      type: string
      enum:
        - manual
        - import
        - conversational
        - learning_loop
        - system
      title: KnowledgeSource
      description: Where a knowledge entry originated from.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        API-Token aus dem Big-Panda-Admin-UI unter Einstellungen → API-Keys.
        Header: `Authorization: Bearer <token>`.

````