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

# search knowledge group

> Search for similar content in a RAG group using vector similarity



## OpenAPI

````yaml https://api.anam.ai/swagger.json post /v1/knowledge/groups/{id}/search
openapi: 3.1.0
info:
  title: Anam AI API
  version: '1.0'
servers:
  - url: https://api.anam.ai
    description: Anam API
security:
  - BearerAuth: []
tags:
  - name: Sessions
  - name: Personas
  - name: Avatars
  - name: Voices
  - name: LLMs
  - name: Knowledge
  - name: Tools
  - name: Share Links
paths:
  /v1/knowledge/groups/{id}/search:
    post:
      tags:
        - Knowledge
      summary: search knowledge group
      description: Search for similar content in a RAG group using vector similarity
      operationId: searchKnowledgeGroup
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          description: Unique identifier of the knowledge group
      requestBody:
        description: >-
          Query string to search the group's documents, plus an optional cap on
          how many chunks to return. Only `READY` documents are included in the
          results.
        required: true
        content:
          application/json:
            examples:
              default:
                $ref: '#/components/examples/KnowledgeGroupSearch'
            schema:
              type: object
              required:
                - query
              properties:
                query:
                  type: string
                limit:
                  type: integer
                  minimum: 1
                  maximum: 20
                  default: 5
      responses:
        '200':
          description: Successfully retrieved search results
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/KnowledgeSearchResult'
              examples:
                default:
                  $ref: '#/components/examples/KnowledgeSearchArrayResponse'
        '400':
          description: Bad request - Invalid search query
        '401':
          description: Unauthorized - Invalid or missing API key
        '404':
          description: RAG group not found
        '500':
          description: Server error
components:
  examples:
    KnowledgeGroupSearch:
      summary: Find the top 5 chunks matching a query
      value:
        query: How do I reset my password?
        limit: 5
    KnowledgeSearchArrayResponse:
      summary: Search results (bare array, ranked by score)
      value:
        - documentId: 00000000-0000-0000-0000-000000000000
          filename: getting-started.pdf
          content: >-
            To reset your password, visit the account settings page and click
            "Reset password".
          score: 0.87
          chunkIndex: 3
          metadata:
            section: Account
  schemas:
    KnowledgeSearchResult:
      type: object
      description: One matching chunk returned by a knowledge-group search.
      properties:
        documentId:
          type: string
          format: uuid
          description: ID of the document the chunk was extracted from.
        filename:
          type: string
          description: Filename of the source document.
        content:
          type: string
          description: Text content of the matching chunk.
        score:
          type: number
          description: >-
            Similarity score for this chunk against the query, higher is more
            similar.
        chunkIndex:
          type: integer
          description: Zero-based index of the chunk within the source document.
        metadata:
          type: object
          description: Free-form metadata attached to the chunk at ingest time.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````