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

# Retrieve From Kb



## OpenAPI

````yaml /openapi.json post /api/knowledge-bases/{kb_id}/retrieve
openapi: 3.1.0
info:
  title: FIM One API
  description: >-
    All-in-one agent platform for Global × China enterprises — programmatic
    access to agents, conversations, knowledge bases, and more.
  version: 0.8.9
servers:
  - url: https://your-domain.com
    description: Your FIM One instance
security:
  - BearerAuth: []
paths:
  /api/knowledge-bases/{kb_id}/retrieve:
    post:
      tags:
        - knowledge-bases
      summary: Retrieve From Kb
      operationId: retrieve_from_kb_api_knowledge_bases__kb_id__retrieve_post
      parameters:
        - name: kb_id
          in: path
          required: true
          schema:
            type: string
            title: Kb Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KBRetrieveRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    KBRetrieveRequest:
      properties:
        query:
          type: string
          minLength: 1
          title: Query
        top_k:
          type: integer
          maximum: 50
          minimum: 1
          title: Top K
          default: 5
      type: object
      required:
        - query
      title: KBRetrieveRequest
    ApiResponse:
      properties:
        success:
          type: boolean
          title: Success
          default: true
        data:
          title: Data
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
      type: object
      title: ApiResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API Key (fim_xxx) or JWT token

````