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

# Search for materials



## OpenAPI

````yaml /openapi-components.json post /api/v1/materials/search
openapi: 3.0.0
info:
  title: StudyFetch API
  description: API documentation for StudyFetch
  version: '1.0'
  contact: {}
servers:
  - url: https://studyfetchapi.com
    description: Production API Server
security: []
tags: []
paths:
  /api/v1/materials/search:
    post:
      tags:
        - Materials
      summary: Search for materials
      operationId: searchMaterials
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchMaterialsDto'
      responses:
        '200':
          description: Search completed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponseDto'
        '400':
          description: Invalid query
        '404':
          description: Folder not found (if folder filter used)
      security:
        - x-api-key: []
components:
  schemas:
    SearchMaterialsDto:
      type: object
      properties:
        query:
          type: string
          example: What is photosynthesis?
          description: Search query
        topK:
          type: number
          default: 5
          description: Number of results to return
        materialIds:
          description: Limit search to specific material IDs
          type: array
          items:
            type: string
        folderIds:
          description: >-
            Limit search to materials within specific folders (includes
            subfolders)
          type: array
          items:
            type: string
      required:
        - query
    SearchResponseDto:
      type: object
      properties:
        query:
          type: string
          description: Original search query
        results:
          description: Search results
          type: array
          items:
            $ref: '#/components/schemas/SearchResultDto'
        totalResults:
          type: number
          description: Total number of results
        filtered:
          type: boolean
          description: Whether results were filtered by scope
        scope:
          type: object
          description: Search scope
          properties:
            materialIds:
              type: array
              items:
                type: string
            folderIds:
              type: array
              items:
                type: string
      required:
        - query
        - results
        - totalResults
        - filtered
        - scope
    SearchResultDto:
      type: object
      properties:
        score:
          type: number
          description: Relevance score (0-1)
        text:
          type: string
          description: Matched text chunk
        chunkIndex:
          type: number
          description: Chunk index within the material
        material:
          type: object
          description: Material information
          nullable: true
          properties:
            id:
              type: string
            name:
              type: string
            contentType:
              type: string
      required:
        - score
        - text
        - chunkIndex
        - material
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API Key for server-to-server authentication. Resolves to the owning
        organization.

````