> ## 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.

# Query patient documents

> Queries patient documents from the HIE network. Will reuse previously fetched data if a patient with the same external ID already exists in our records. Pass `future=true` to test the new Metriport Network Query flow.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/samplehc/openapi.documented.yml post /api/v2/hie/documents/query
openapi: 3.0.3
info:
  title: Sample Healthcare API
  description: API for Sample Healthcare
  version: 1.0.0
servers: []
security: []
paths:
  /api/v2/hie/documents/query:
    post:
      tags:
        - HIE
      summary: Query patient documents
      description: >-
        Queries patient documents from the HIE network. Will reuse previously
        fetched data if a patient with the same external ID already exists in
        our records. Pass `future=true` to test the new Metriport Network Query
        flow.
      parameters:
        - schema:
            type: string
            enum:
              - 'true'
              - 'false'
          in: query
          name: future
          required: false
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                firstName:
                  type: string
                  description: The Patient's first name(s).
                lastName:
                  type: string
                  description: The Patient's last name(s).
                dob:
                  type: string
                  description: >-
                    The Patient's date of birth (DOB), formatted `YYYY-MM-DD` as
                    per ISO 8601.
                genderAtBirth:
                  type: string
                  enum:
                    - M
                    - F
                    - O
                    - U
                  description: >-
                    The Patient's gender at birth, can be one of `M` or `F` or
                    `O` or `U`. Use `O` (other) when the patient's gender is
                    known but it is not `M` or `F`, i.e intersex or
                    hermaphroditic. Use `U` (unknown) when the patient's gender
                    is not known.
                personalIdentifiers:
                  type: array
                  items:
                    type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - driversLicense
                          - ssn
                        description: >-
                          The ID type - currently `driversLicense` or `ssn` is
                          supported.
                      state:
                        type: string
                        description: >-
                          The 2 letter state acronym where this ID was issued,
                          for example: `CA`. Only required for type
                          `driversLicense`.
                      value:
                        type: string
                        description: The ID number. For type `ssn`, should be 9 digits.
                    required:
                      - type
                      - value
                    additionalProperties: false
                  default: []
                  description: >-
                    An array of the Patient's personal IDs, such as a driver's
                    license or SSN. May be empty.
                address:
                  type: array
                  items:
                    type: object
                    properties:
                      addressLine1:
                        type: string
                        description: The address.
                      addressLine2:
                        type: string
                        nullable: true
                        description: 'The address details, for example: `#4451`.'
                      city:
                        type: string
                        description: The city.
                      state:
                        type: string
                        description: 'The 2 letter state acronym, for example: `CA`.'
                      zip:
                        type: string
                        description: 5 digit zip code.
                      country:
                        type: string
                        default: USA
                        description: >-
                          If specified, must be `USA`; otherwise will default to
                          `USA`.
                    required:
                      - addressLine1
                      - city
                      - state
                      - zip
                    additionalProperties: false
                  description: >-
                    An array of Address objects, representing the Patient's
                    current and/or previous addresses. May be empty.
                contact:
                  type: array
                  items:
                    type: object
                    properties:
                      phone:
                        type: string
                        description: >-
                          The Patient's 10 digit phone number, formatted
                          `1234567899`.
                      email:
                        type: string
                        description: The Patient's email address.
                    additionalProperties: false
                  default: []
                  description: >-
                    An array of Contact objects, representing the Patient's
                    current and/or previous contact information. May be empty.
                externalId:
                  type: string
                  description: >-
                    An external Patient ID that you store and can use to
                    reference this Patient.
              required:
                - firstName
                - lastName
                - dob
                - genderAtBirth
                - address
                - externalId
              additionalProperties: false
        required: true
      responses:
        '202':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  asyncResultId:
                    type: string
                    description: >-
                      The async result ID. When the async result completes, the
                      result will contain both FHIR bundle and document objects.
                required:
                  - asyncResultId
                additionalProperties: false

````