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

# Retrieve knowledge context

> Searches indexed chunks by semantic similarity. Requires L0 authorization.



## OpenAPI

````yaml POST /api/v1/knowledge/retrieve
openapi: 3.1.0
info:
  title: FamilyCo API
  description: Core and Knowledge endpoints from the FamilyCo Fastify server.
  version: 1.0.0
  license:
    name: MIT
servers:
  - url: http://127.0.0.1:4000
    description: Local development server
security:
  - bearerAuth: []
tags:
  - name: Core
    description: Infrastructure and runtime status endpoints.
  - name: Auth
    description: Token and API key related endpoints.
  - name: Knowledge
    description: Document upload, indexing, and retrieval endpoints.
paths:
  /api/v1/knowledge/retrieve:
    post:
      tags:
        - Knowledge
      summary: Retrieve knowledge context
      description: >-
        Searches indexed chunks by semantic similarity. Requires L0
        authorization.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KnowledgeRetrieveRequest'
      responses:
        '200':
          description: Retrieval result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeRetrieveResponse'
        '400':
          description: Validation or retrieval error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    KnowledgeRetrieveRequest:
      type: object
      required:
        - query
      properties:
        query:
          type: string
          minLength: 1
        topK:
          type: integer
          minimum: 1
          maximum: 50
        minScore:
          type: number
          minimum: -1
          maximum: 1
        projectId:
          type: string
          minLength: 1
        documentId:
          type: string
          minLength: 1
    KnowledgeRetrieveResponse:
      type: object
      required:
        - query
        - topK
        - items
      properties:
        query:
          type: string
        topK:
          type: integer
        items:
          type: array
          items:
            $ref: '#/components/schemas/KnowledgeRetrieveItem'
    ErrorResponse:
      type: object
      required:
        - statusCode
        - code
        - message
      properties:
        statusCode:
          type: integer
        code:
          type: string
        message:
          type: string
    KnowledgeRetrieveItem:
      type: object
      required:
        - id
        - score
        - model
        - documentId
        - documentName
        - projectId
        - source
        - chunkIndex
        - sectionPath
        - page
        - content
        - metadata
      properties:
        id:
          type: string
        score:
          type: number
        model:
          type: string
        documentId:
          type: string
        documentName:
          type: string
        projectId:
          type:
            - string
            - 'null'
        source:
          type: string
        chunkIndex:
          type: integer
        sectionPath:
          type:
            - string
            - 'null'
        page:
          type:
            - integer
            - 'null'
        content:
          type: string
        metadata:
          type:
            - object
            - 'null'
          additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````