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

# Search Knowledge

> Search the knowledge base for relevant documents using query, filters and search type.



## OpenAPI

````yaml post /knowledge/search
openapi: 3.1.0
info:
  title: Agno API Reference
  description: The all-in-one, private, secure agent platform that runs in your cloud.
  version: 3.0.4
servers: []
security: []
paths:
  /knowledge/search:
    post:
      tags:
        - Knowledge
      summary: Search Knowledge
      description: >-
        Search the knowledge base for relevant documents using query, filters
        and search type.
      operationId: search_knowledge
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VectorSearchRequestSchema'
        required: true
      responses:
        '200':
          description: Search results retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedResponse_VectorSearchResult_'
              example:
                data:
                  - id: doc_123
                    content: >-
                      Jordan Mitchell - Software Engineer with skills in
                      JavaScript, React, Python
                    name: cv_1
                    meta_data:
                      page: 1
                      chunk: 1
                    usage:
                      total_tokens: 14
                    reranking_score: 0.95
                    content_id: content_456
                meta:
                  page: 1
                  limit: 20
                  total_pages: 2
                  total_count: 35
        '400':
          description: Invalid search parameters
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthenticatedResponse'
        '403':
          description: 'Insufficient permissions. Required scope(s): knowledge:read'
        '404':
          description: No documents found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
        '503':
          description: No knowledge base is configured on this AgentOS
      security:
        - {}
        - HTTPBearer: []
components:
  schemas:
    VectorSearchRequestSchema:
      properties:
        query:
          type: string
          title: Query
          description: The search query text
        db_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Db Id
          description: Database ID to search in
        knowledge_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Knowledge Id
          description: Knowledge base ID to search in
        vector_db_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Vector Db Ids
          description: List of vector database IDs to search in
        search_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Search Type
          description: The type of search to perform (vector, keyword, hybrid)
        max_results:
          anyOf:
            - type: integer
              maximum: 1000
              minimum: 1
            - type: 'null'
          title: Max Results
          description: The maximum number of results to return
        filters:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Filters
          description: Filters to apply to the search results
        meta:
          anyOf:
            - $ref: '#/components/schemas/Meta'
            - type: 'null'
          description: >-
            Pagination metadata. Limit and page number to return a subset of
            results.
      type: object
      required:
        - query
      title: VectorSearchRequestSchema
      description: Schema for vector search request.
    PaginatedResponse_VectorSearchResult_:
      properties:
        data:
          items:
            $ref: '#/components/schemas/VectorSearchResult'
          type: array
          title: Data
          description: List of items for the current page
        meta:
          $ref: '#/components/schemas/PaginationInfo'
          description: Pagination metadata
      type: object
      required:
        - data
        - meta
      title: PaginatedResponse[VectorSearchResult]
    UnauthenticatedResponse:
      properties:
        detail:
          type: string
          title: Detail
          description: Human-readable error message
        error_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Id
          description: >-
            Stable identifier for the specific error, present only when the
            error carries one
        error_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Type
          description: Category of the error, present only when the error carries one
      type: object
      required:
        - detail
      title: UnauthenticatedResponse
      example:
        detail: Unauthenticated access
    ValidationErrorResponse:
      properties:
        detail:
          anyOf:
            - type: string
            - items:
                $ref: '#/components/schemas/ValidationErrorDetail'
              type: array
          title: Detail
          description: >-
            A single message for an explicitly raised 422, or a list of
            field-level errors for a request-validation failure
      type: object
      required:
        - detail
      title: ValidationErrorResponse
      description: >-
        422 body. Two runtime shapes share this status code, and the same
        endpoint can

        return either, so ``detail`` is typed as their union:


        - FastAPI's request-validation handler emits a **list** of field-level
        errors (built-in
          coercion errors and custom-validator ``ValueError``s alike).
        - A route that raises ``HTTPException(status_code=422, detail="...")``
        for a semantic
          check (e.g. an invalid cron expression) emits a **string** through the HTTPException
          handler.
      example:
        detail:
          - loc:
              - body
              - endpoint
            msg: Value error, Endpoint must be a path, not a full URL
            type: value_error
    InternalServerErrorResponse:
      properties:
        detail:
          type: string
          title: Detail
          description: Human-readable error message
        error_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Id
          description: >-
            Stable identifier for the specific error, present only when the
            error carries one
        error_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Type
          description: Category of the error, present only when the error carries one
      type: object
      required:
        - detail
      title: InternalServerErrorResponse
      example:
        detail: Internal server error
    Meta:
      properties:
        limit:
          type: integer
          minimum: 1
          title: Limit
          description: Number of results per page
          default: 20
        page:
          type: integer
          minimum: 1
          title: Page
          description: Page number
          default: 1
      type: object
      title: Meta
      description: Inline metadata schema for pagination.
    VectorSearchResult:
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
          description: Unique identifier for the search result document
        content:
          type: string
          title: Content
          description: Content text of the document
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: Name of the document
        meta_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta Data
          description: Metadata associated with the document
        usage:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Usage
          description: Usage statistics (e.g., token counts)
        reranking_score:
          anyOf:
            - type: number
              maximum: 1
              minimum: 0
            - type: 'null'
          title: Reranking Score
          description: Reranking score for relevance
        content_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Content Id
          description: ID of the source content
        content_origin:
          anyOf:
            - type: string
            - type: 'null'
          title: Content Origin
          description: Origin URL or source of the content
        size:
          anyOf:
            - type: integer
              minimum: 0
            - type: 'null'
          title: Size
          description: Size of the content in bytes
      type: object
      required:
        - content
      title: VectorSearchResult
      description: Schema for search result documents.
    PaginationInfo:
      properties:
        page:
          type: integer
          minimum: 0
          title: Page
          description: Current page number
          default: 0
        limit:
          type: integer
          minimum: 1
          title: Limit
          description: Number of items per page
          default: 20
        total_pages:
          type: integer
          minimum: 0
          title: Total Pages
          description: Total number of pages
          default: 0
        total_count:
          type: integer
          minimum: 0
          title: Total Count
          description: Total count of items
          default: 0
        search_time_ms:
          type: number
          minimum: 0
          title: Search Time Ms
          description: Search execution time in milliseconds
          default: 0
      type: object
      title: PaginationInfo
    ValidationErrorDetail:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Loc
          description: Path to the offending field, e.g. ['body', 'endpoint']
        msg:
          type: string
          title: Msg
          description: Human-readable error message
        type:
          type: string
          title: Type
          description: Error type identifier, e.g. 'value_error' or 'missing'
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationErrorDetail
      description: >-
        One field-level error inside a 422 body, matching FastAPI's default
        shape.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.