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

# Search content

> <p> Searches through indexed content using query. </p> <p> Required roles: All, App </p>




## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/qaip/openapi.documented.yml post /search
openapi: 3.0.3
info:
  title: QAIP APIs
  version: 1.0.0
servers:
  - url: https://developer.qaip.com/api/v1
    description: API base path
security:
  - ApiKeyAuth: []
tags:
  - name: completions
    description: Generate completions
  - name: search
    description: Search content
  - name: extract
    description: Data extraction using LLM
  - name: tags
    description: List available tags
  - name: agent
    description: (Experimental) Agent operations
  - name: tag-source-groups
    description: Tag and source group associations
  - name: source-groups
    description: Source group (job) management and metadata
  - name: sources
    description: Sources management and metadata
  - name: local-file-groups
    description: Local file group management
  - name: secrets
    description: Secret management
  - name: google-drives
    description: Google Drive data source management
  - name: google-drive-settings
    description: Google Drive data source setting management
  - name: crawls
    description: Web crawl data source management
  - name: crawl-settings
    description: Web crawl setting management
  - name: githubs
    description: GitHub data source management
  - name: github-settings
    description: GitHub data source setting management
  - name: notions
    description: Notion data source management
  - name: notion-settings
    description: Notion data source setting management
  - name: authz-subject-attributes
    description: Authorization subject attribute management (admin only)
paths:
  /search:
    post:
      tags:
        - search
      summary: Search content
      description: >
        <p> Searches through indexed content using query. </p> <p> Required
        roles: All, App </p>
      operationId: search
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - query
              properties:
                query:
                  type: string
                  description: Search query string
                  example: machine learning and artificial intelligence
                tags:
                  type: array
                  description: target tag names to be obtained
                  items:
                    type: string
                tag_ids:
                  type: array
                  description: target tag IDs to be obtained
                  items:
                    type: string
                tag_filter_logic:
                  $ref: '#/components/schemas/LogicalOperator'
                source_types:
                  type: array
                  items:
                    $ref: '#/components/schemas/SourceType'
                file_types:
                  type: array
                  items:
                    $ref: '#/components/schemas/FileType'
                date_from:
                  type: integer
                  description: Start date for content search (Unix timestamp in seconds)
                  example: 1735639200
                  minimum: 1735639200
                date_to:
                  type: integer
                  description: End date for content search (Unix timestamp in seconds)
                  example: 1735639200
                  minimum: 1735639200
                domains:
                  type: array
                  description: >-
                    Array of domains to search within (supports partial
                    matching)
                  items:
                    type: string
                  example:
                    - example.com
                    - blog.example.com
                metadata:
                  $ref: '#/components/schemas/MetadataFilterGroup'
                source_metadata:
                  $ref: '#/components/schemas/MetadataFilterGroup'
                  description: >-
                    Filter by individual source/file metadata from
                    source_metadatas table
                chunk_metadata:
                  $ref: '#/components/schemas/MetadataFilterGroup'
                  description: Filter by chunk-level metadata from chunk_metadatas table
                metadata_filter:
                  $ref: '#/components/schemas/MetadataFilterGroup'
                  description: >
                    Filter by declared metadata columns (see /metadata_columns)
                    pushed down directly to LanceDB (no PostgreSQL round-trip).
                    Targets string/integer typed columns. Keys must be declared
                    via /metadata_columns or the request is rejected (400).
                limit:
                  type: integer
                  description: Maximum number of results to return
                  minimum: 1
                  maximum: 100
                  default: 10
                  example: 10
                offset:
                  type: integer
                  description: Number of results to skip
                  minimum: 0
                  default: 0
                  example: 0
                use_postfilter:
                  type: boolean
                  default: false
                  description: >
                    Whether to bypass LanceDB prefilter and apply WHERE after
                    the

                    vector search (IVF_PQ) returns top-K. Significantly faster
                    for

                    broad filters that cover most of the table, but may return

                    fewer than `limit` results when the hit rate is low.
                authz_policy:
                  type: string
                  description: >
                    (reserved for future use) Name of the registered authz
                    policy to

                    evaluate for this request. Defaults to the reserved
                    "default" policy

                    when omitted. Ignored when authz is disabled. An unknown or
                    malformed

                    name returns 400.
                  pattern: ^[a-z][a-z0-9_-]{0,63}$
                  example: external-chatbot
                principal_id:
                  type: string
                  description: >
                    Identifier of the end-user (principal) on whose behalf this
                    request is made. Used to look up the principal's authz
                    subject attributes for policy evaluation. When omitted,
                    subject attributes are empty (most restrictive). Ignored
                    when authz is disabled.
                  maxLength: 256
                  example: user-123
      responses:
        '200':
          description: Successful search results
          content:
            application/json:
              schema:
                type: object
                required:
                  - created
                  - results
                properties:
                  created:
                    type: integer
                    description: >-
                      The Unix timestamp (in seconds) of when the search was
                      performed
                    example: 1677649420
                  results:
                    type: array
                    description: Array of search results
                    items:
                      $ref: '#/components/schemas/Content'
        '400':
          description: Bad Request - The request was malformed or invalid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized - Authentication failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden - Insufficient permissions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Too Many Requests - Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from qaip import Qaip

            client = Qaip(
                api_key=os.environ.get("QAIP_API_KEY"),  # This is the default and can be omitted
            )
            response = client.search(
                query="machine learning and artificial intelligence",
            )
            print(response.created)
components:
  schemas:
    LogicalOperator:
      type: string
      enum:
        - AND
        - OR
      default: OR
      description: Logical operator for combining filter conditions
    SourceType:
      type: string
      description: The type of the source
      enum:
        - crawl
        - local_file
        - google_drive
        - github
        - notion
    FileType:
      type: string
      description: The type of the source file
      enum:
        - html
        - pdf
        - ppt
        - pptx
        - pptm
        - doc
        - docx
        - docm
        - xls
        - xlsx
        - xlsm
        - md
        - txt
        - jsonl
        - png
        - jpg
        - webp
        - heic
        - heif
        - wav
        - mp3
        - aiff
        - aac
        - m4a
        - ogg
        - flac
        - mp4
        - mpg
        - mov
        - avi
        - flv
        - webm
        - wmv
        - 3gp
        - notion_page
    MetadataFilterGroup:
      type: object
      description: >-
        (reserved for future use) Filter group with nested structure. Supports
        combining filters with AND/OR logic.
      properties:
        logic:
          $ref: '#/components/schemas/LogicalOperator'
        filters:
          type: array
          description: Filters within this group (combined using the logic operator)
          items:
            $ref: '#/components/schemas/MetadataFilter'
        groups:
          type: array
          description: Nested subgroups
          items:
            $ref: '#/components/schemas/MetadataFilterGroup'
          maxItems: 10
    Content:
      type: object
      required:
        - id
        - text
        - url
        - title
        - timestamp
        - file_type
        - page_number
        - source_type
      properties:
        id:
          type: string
          description: Content ID
        text:
          type: string
          description: Content chunk from the source
        url:
          type: string
          description: Source URL of the content
        title:
          type: string
          description: Title of the content or document
        timestamp:
          type: integer
          description: Unix timestamp when the content was indexed
        file_type:
          $ref: '#/components/schemas/FileType'
        page_number:
          type: integer
          description: >-
            Page number for paginated documents like PDFs. Set to 0 for sources
            without page numbers
          default: 0
        source_type:
          $ref: '#/components/schemas/SourceType'
        source_id:
          type: string
          description: >
            Optional source ID for the original source. For crawl content, use
            this value with GET /sources/{source_id}/raw to download the stored
            crawl file content. For local_file content, use GET
            /sources/{source_id} for source details.
        keywords:
          type: array
          items:
            type: string
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
            - type
          properties:
            message:
              type: string
              description: Human-readable error message
            type:
              type: string
              description: Machine-readable error code
    MetadataFilter:
      type: object
      description: Metadata filter for filtering search results by key/value pairs
      required:
        - key
        - type
        - operator
      properties:
        key:
          type: string
          description: Metadata key
        val:
          description: >-
            Metadata value (string or number). This is optional since min/max
            can be used for range queries.
        type:
          type: string
          enum:
            - string
            - integer
            - float
            - date
            - datetime
          description: Data type of the metadata value
        operator:
          type: string
          enum:
            - eq
            - ne
            - gt
            - gte
            - lt
            - lte
            - between
          default: eq
          description: Comparison operator
        min:
          description: Minimum value for range queries (string or number)
        max:
          description: Maximum value for range queries (string or number)
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication

````