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

# Search for similar chunks

> Search for document chunks similar to the query.

This endpoint uses vector similarity search to find relevant chunks.
Results are returned without threshold filtering - apply similarity
thresholds at the application layer after optional reranking.

Access Control:
* Users can only search documents from their organization.



## OpenAPI

````yaml /api-reference/openapi.en.json post /api/v1/knowledge-base/search
openapi: 3.1.0
info:
  title: Brosbots API
  description: >
    The public Brosbots REST API. Build and manage voice agents, run outbound

    campaigns, read calls and usage, and manage phone numbers, tools,

    knowledge bases and integrations.


    ## Authentication


    Every request must include your organization's API key in the

    `X-API-Key` header:


    ```

    X-API-Key: bb_live_...

    ```


    You create and revoke keys in the dashboard:

    click your account in the bottom-left corner of the sidebar, then **Brosbots
    API**.


    ## Base URL


    ```

    https://app.brosbots.com/api/v1

    ```


    ## Conventions


    - Request and response bodies are JSON (`Content-Type: application/json`).

    - Timestamps are ISO 8601 with a timezone.

    - Lists are paginated with `page` / `limit` parameters; responses include
      `total_count` / `total_pages`.
    - Errors use standard HTTP status codes with a JSON body:
      `{"detail": "a human-readable reason"}`.
    - `{agent_id}` accepts the agent's public ID (`agent_...`) or its number.


    ## Limits


    There is no fixed per-key request-rate limit today. `429` comes from the

    calling endpoints (`POST /agents/{agent_id}/calls` and

    `POST /triggers/{trigger_id}/calls`) when every outbound channel is busy;
    its `Retry-After` header says how many seconds to wait. Handle `429`

    generally: wait as long as `Retry-After` says, or back off exponentially
    when

    it is absent. A request-rate limit may be introduced.
  version: 1.0.0
servers: []
security:
  - ApiKeyAuth: []
paths:
  /api/v1/knowledge-base/search:
    post:
      tags:
        - Knowledge Base
      summary: Search for similar chunks
      description: |-
        Search for document chunks similar to the query.

        This endpoint uses vector similarity search to find relevant chunks.
        Results are returned without threshold filtering - apply similarity
        thresholds at the application layer after optional reranking.

        Access Control:
        * Users can only search documents from their organization.
      operationId: post_knowledge_base_search
      parameters:
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
        - name: X-API-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChunkSearchRequestSchema'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChunkSearchResponseSchema'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ChunkSearchRequestSchema:
      properties:
        query:
          type: string
          description: Search query text
        limit:
          type: integer
          maximum: 50
          minimum: 1
          description: Maximum number of results
          default: 5
        document_uuids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: Filter by specific document UUIDs
        min_similarity:
          anyOf:
            - type: number
              maximum: 1
              minimum: 0
            - type: 'null'
          description: Minimum similarity threshold
      type: object
      required:
        - query
      title: ChunkSearchRequestSchema
      description: Request schema for searching similar chunks.
    ChunkSearchResponseSchema:
      properties:
        chunks:
          items:
            $ref: '#/components/schemas/ChunkResponseSchema'
          type: array
        query:
          type: string
        total_results:
          type: integer
      type: object
      required:
        - chunks
        - query
        - total_results
      title: ChunkSearchResponseSchema
      description: Response schema for chunk search results.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
      type: object
      title: HTTPValidationError
    ChunkResponseSchema:
      properties:
        id:
          type: integer
        document_id:
          type: integer
        chunk_text:
          type: string
        contextualized_text:
          anyOf:
            - type: string
            - type: 'null'
        chunk_index:
          type: integer
        chunk_metadata:
          additionalProperties: true
          type: object
        filename:
          type: string
        document_uuid:
          type: string
        similarity:
          type: number
      type: object
      required:
        - id
        - document_id
        - chunk_text
        - contextualized_text
        - chunk_index
        - chunk_metadata
        - filename
        - document_uuid
        - similarity
      title: ChunkResponseSchema
      description: Response schema for a document chunk.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
        msg:
          type: string
        type:
          type: string
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        Your organization's API key (account in the bottom-left of the dashboard
        → Brosbots API).

````

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