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

# Search files by meaning

> Finds the files that match your query and returns their content, best match first. Each result cites the file it came from. It also matches on meaning, which finds files that answer the query without using the same words. A result appears only if this API key can read the file. A new or changed file is not searchable straight away, so search again in a moment if you do not see it.



## OpenAPI

````yaml api-reference/public-api.json POST /v1/search/hybrid
openapi: 3.0.0
info:
  title: Qontext API
  description: Read and write the knowledge a workspace has ingested.
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.qontext.ai
    description: Production
security: []
tags:
  - name: Files
    description: >-
      Read and write the files in a workspace. What you read, and what an
      accepted change goes into, is the live files: the accepted state of the
      world. A change to a protected file goes to review instead of being
      accepted automatically, and stays in review until somebody accepts or
      rejects it.
  - name: Folders
    description: >-
      The tree the files sit in. A folder id survives a rename and a move, and
      so does every id below it, so ids a client holds stay valid while paths
      change.
  - name: Search
    description: >-
      Find files by meaning or by a regular expression. Both search the live
      files, both answer one page of the best matches, and both drop a file this
      key may not read.
paths:
  /v1/search/hybrid:
    post:
      tags:
        - Search
      summary: Search files by meaning
      description: >-
        Finds the files that match your query and returns their content, best
        match first. Each result cites the file it came from. It also matches on
        meaning, which finds files that answer the query without using the same
        words. A result appears only if this API key can read the file. A new or
        changed file is not searchable straight away, so search again in a
        moment if you do not see it.
      operationId: SearchController_searchHybrid
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequest'
      responses:
        '200':
          description: >-
            Matching files from the live files, best match first. One page;
            there is no next.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HybridSearchResult'
        '400':
          description: '`invalid_request`: unknown or malformed member, see `errors`'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                invalid_request:
                  summary: Invalid request
                  value:
                    type: https://docs.qontext.ai/errors/invalid-request
                    title: Invalid request
                    status: 400
                    code: invalid_request
                    detail: The request could not be accepted as sent.
                    requestId: 3f9c2b7e4d1a48c0b6e5f2a19d7c3e8b
                    errors:
                      - code: out_of_range
                        pointer: /limit
                        detail: limit must not be greater than 1000
        '401':
          description: '`unauthenticated`: missing or invalid API key'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                unauthenticated:
                  summary: Unauthenticated
                  value:
                    type: https://docs.qontext.ai/errors/unauthenticated
                    title: Unauthenticated
                    status: 401
                    code: unauthenticated
                    detail: The API key is missing or not valid.
                    requestId: 3f9c2b7e4d1a48c0b6e5f2a19d7c3e8b
        '500':
          description: '`internal_error`: unexpected failure, already reported'
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                internal_error:
                  summary: Internal error
                  value:
                    type: https://docs.qontext.ai/errors/internal-error
                    title: Internal error
                    status: 500
                    code: internal_error
                    detail: An unexpected error occurred.
                    requestId: 3f9c2b7e4d1a48c0b6e5f2a19d7c3e8b
        '503':
          description: >-
            `service_unavailable`: temporarily unreachable. Honour
            `Retry-After`.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
              examples:
                service_unavailable:
                  summary: Temporarily unavailable
                  value:
                    type: https://docs.qontext.ai/errors/service-unavailable
                    title: Temporarily unavailable
                    status: 503
                    code: service_unavailable
                    detail: This workspace is temporarily unavailable.
                    requestId: 3f9c2b7e4d1a48c0b6e5f2a19d7c3e8b
      security:
        - Authorization: []
        - X-API-Key: []
components:
  schemas:
    SearchRequest:
      type: object
      properties:
        query:
          type: string
          description: What you are looking for. A few words or a whole question both work.
          example: What is the refund policy?
        limit:
          type: integer
          description: Maximum results to return. Defaults to 10.
          minimum: 1
          maximum: 500
          default: 10
        includeSources:
          type: boolean
          description: Cite the file each result came from. Defaults to true.
          default: true
      additionalProperties: false
      required:
        - query
    HybridSearchResult:
      type: object
      properties:
        object:
          type: string
          enum:
            - list
          description: Type discriminator. Always `list`.
        url:
          type: string
          example: /v1/search/hybrid
          description: The search this page came from.
        hasMore:
          type: boolean
          description: >-
            Always false. A search answers the best matches in one page and has
            no next page.
          example: false
        nextCursor:
          type: string
          nullable: true
          example: null
          description: >-
            Always null. A search has no position to resume from, so there is no
            cursor to pass back.
        data:
          description: Matching files, best match first.
          type: array
          items:
            $ref: '#/components/schemas/HybridSearchResultItem'
      required:
        - object
        - url
        - hasMore
        - nextCursor
        - data
    Problem:
      type: object
      properties:
        type:
          type: string
          example: https://docs.qontext.ai/errors/file-not-found
          description: >-
            Stable URI for this kind of failure. Branch on this or on `code`,
            never on `title` or `detail`.
        title:
          type: string
          example: File not found
          description: Human label. Not for branching on.
        status:
          type: number
          example: 404
          description: Matches the HTTP status.
        code:
          type: string
          example: file_not_found
          description: Stable machine code. This is what a client branches on.
        detail:
          type: string
          description: >-
            Human explanation, safe to display. Never a stack trace or engine
            detail.
        requestId:
          type: string
          description: >-
            Echoes the `X-Request-Id` response header. One string locates the
            log line for this call.
        errors:
          description: Present when the failure is attributable to specific inputs.
          type: array
          items:
            $ref: '#/components/schemas/FieldError'
      required:
        - type
        - title
        - status
        - code
        - detail
        - requestId
    HybridSearchResultItem:
      type: object
      properties:
        text:
          type: string
          example: |-
            # Refunds
            Refunds are available within 30 days.
          description: The content of the matching file.
        source:
          description: >-
            Which file this result came from. Absent when `includeSources` is
            false.
          allOf:
            - $ref: '#/components/schemas/SearchSource'
      required:
        - text
    FieldError:
      type: object
      properties:
        code:
          type: string
          example: out_of_range
          description: Stable machine token for what was wrong with this field.
        pointer:
          type: string
          example: /limit
          description: JSON Pointer to the offending member.
        detail:
          type: string
          example: limit must not be greater than 1000
          description: >-
            Human explanation for this field alone. Branch on `code`, not on
            this.
      required:
        - code
        - pointer
        - detail
    SearchSource:
      type: object
      properties:
        fileId:
          type: string
          example: doc_9f2k1x8b3m7q0v
          description: Id of the file this result came from.
        path:
          type: string
          example: /support/policies/refunds.md
          description: Where the file sits in your context repository.
        object:
          type: string
          enum:
            - file
          description: Type discriminator. Always `file`.
        url:
          type: string
          example: /v1/files/doc_9f2k1x8b3m7q0v
          description: Where to read this file through the API.
      required:
        - fileId
        - path
        - object
        - url
  securitySchemes:
    Authorization:
      type: http
      scheme: bearer
      description: >-
        Workspace-scoped API key, sent as a bearer token. The recommended
        header. The workspace is implicit in the key and never appears in a URL.
    X-API-Key:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        The same workspace-scoped API key under its original header. Still
        supported, and still enough on its own. Prefer `Authorization: Bearer`
        for a new client.

````