> ## 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.

# Create a new knowledge entry

> Create a new knowledge entry under the current tenant.



## OpenAPI

````yaml /api-reference/openapi.json post /api/knowledge/knowledge-entries
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:
    post:
      tags:
        - Knowledge Entries
      summary: Create a new knowledge entry
      description: Create a new knowledge entry under the current tenant.
      operationId: create_knowledge_entry_knowledge_entries_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)
        - name: X-Audit-Source
          in: header
          required: false
          schema:
            type: string
            description: Audit-channel from the gateway (M.5)
            default: api
            title: X-Audit-Source
          description: Audit-channel from the gateway (M.5)
        - name: X-Client-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: OAuth client_id; only set for MCP-channel calls
            title: X-Client-Id
          description: OAuth client_id; only set for MCP-channel calls
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KnowledgeEntryCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeEntryResponse-Output'
        '400':
          description: Invalid category_id (does not exist or belongs to another tenant)
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    KnowledgeEntryCreate:
      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'
        type:
          $ref: '#/components/schemas/EntryType'
          default: knowledge
        language:
          type: string
          maxLength: 5
          minLength: 2
          title: Language
          default: de
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
        source:
          $ref: '#/components/schemas/KnowledgeSource'
          default: manual
        source_reference:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Reference
        similarity_text:
          anyOf:
            - type: string
            - type: 'null'
          title: Similarity Text
          description: >-
            Anchor text for 'related themes'. Bewusst kurz/prägnant: Tags +
            Layer + Topic-Stichworte sind typisch.
        search_keywords:
          items:
            type: string
          type: array
          title: Search Keywords
          description: Alternative spellings/synonyms — boosts BM25 matches.
        project_ids:
          anyOf:
            - items:
                type: string
                format: uuid
              type: array
            - type: 'null'
          title: Project Ids
      type: object
      required:
        - title
        - content
        - category_id
        - visibility
      title: KnowledgeEntryCreate
      description: |-
        Payload for creating a new knowledge entry.

        `type` defaults to 'knowledge' so existing clients keep working.
        `metadata` is validated against the type-specific schema in
        `entry_metadata.py` — the validated/normalised dict overwrites
        the raw input so the route can persist it directly.
    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.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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.
    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.
    KnowledgeSource:
      type: string
      enum:
        - manual
        - import
        - conversational
        - learning_loop
        - system
      title: KnowledgeSource
      description: Where a knowledge entry originated from.
    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
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        API-Token aus dem Big-Panda-Admin-UI unter Einstellungen → API-Keys.
        Header: `Authorization: Bearer <token>`.

````