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

# Search across documents

> Performs a search query across a specified set of documents and returns matching results.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/samplehc/openapi.documented.yml post /api/v2/documents/search
openapi: 3.0.3
info:
  title: Sample Healthcare API
  description: API for Sample Healthcare
  version: 1.0.0
servers: []
security: []
paths:
  /api/v2/documents/search:
    post:
      tags:
        - Document
      summary: Search across documents
      description: >-
        Performs a search query across a specified set of documents and returns
        matching results.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                query:
                  type: string
                  description: The search query string.
                documents:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                      fileName:
                        type: string
                    required:
                      - id
                      - fileName
                    additionalProperties: false
                  description: An array of document resources to search within.
              required:
                - query
                - documents
              additionalProperties: false
        required: true
      responses:
        '200':
          description: Successfully retrieved search results.
          content:
            application/json:
              schema:
                type: object
                properties:
                  results:
                    type: array
                    items: {}
                    description: >-
                      An array of search results. The structure of each result
                      may vary.
                required:
                  - results
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: The error message.
                  message:
                    type: string
                    description: The message.
                  statusCode:
                    type: number
                    description: The status code.
                  details:
                    type: object
                    additionalProperties: {}
                    description: The details of the error
                additionalProperties: true
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: >-
                      Not Found, one or more specified documents for search do
                      not exist.
                required:
                  - error
                additionalProperties: false
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Internal server error during the search operation.
                required:
                  - error
                additionalProperties: false
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from samplehc import SampleHealthcare

            client = SampleHealthcare(
                api_key=os.environ.get("SAMPLEHC_API_KEY"),  # This is the default and can be omitted
            )
            response = client.v2.documents.search(
                documents=[{
                    "id": "id",
                    "file_name": "fileName",
                }],
                query="query",
            )
            print(response.results)

````