---
title: "Get all visits for a particular patient (identified by query.id) across all orders in the given project."
method: GET
path: "/projects/{project_id}/queries/{query_id}/visits"
tags: ["Visits"]
---

# Get all visits for a particular patient (identified by query.id) across all orders in the given project.

`GET /projects/{project_id}/queries/{query_id}/visits`

## Path parameters

- `project_id` string, required
- `query_id` string, required

## Query parameters

- `limit` integer
- `offset` integer

## Headers

- `version-datavant` string — Version of the Orders API to use with this call

## Response `200`

Successful Response

- JsonApiPageVisit — JSON:API 1.0 specification says that result key should be a `data`.
  - `data` Visit[], required
    - `uuid` string, required — Unique identifier for the visit.
    - `date_range` DateRange, required — A date range for a visit.
      - `start` string, date, required — Start of the date range.
      - `end` string, date — End of the date range. If not available, defaults to the day the order was submitted.
    - `status` 'pending' | 'processing' | 'under_investigation' | 'records_ready' | 'action_needed' | 'cancelled', required — Enum for visit statuses.
    - `status_details` VisitStatusDetail[], required — Further details about the current visit status.
    - `documents` VisitDocuments, required — Documents attached to a visit.
      - `provider_packet` string — Document UUID of the provider packet for the visit.
      - `medical_record` string — Document UUID of the medical record retrieved for the visit.
      - `patient_authorization` string — Document UUID of the HIPAA compliant patient authorization for the visit.
      - `letter_of_representation` string — Document UUID of the letter of representation for the visit.
      - `request_letter` string — Document UUID of the request letter for the visit.
    - `history` VisitHistoryEntry[], required — History of the visit.
      - `status` 'pending' | 'processing' | 'under_investigation' | 'records_ready' | 'action_needed' | 'cancelled', required — Enum for visit statuses.
      - `status_details` VisitStatusDetail[], required — Further details about the visit status at the time of the entry.
      - `created_at` string, date-time, required — Date and time when the entry was created.
    - `updated_at` string, date-time, required — Date and time when the visit was last updated.
    - `created_at` string, date-time, required — Date and time when the visit was created.
    - `patient` Patient, required — A custom BaseModel with the eventual goal of populating inheriting models with the value property of enums rather than the raw enum. For now this is set to False (default setting) and we only set enum values to true within the models that have enums we know we need to use the values for.
      - `phone_number` string — Phone number
      - `full_name` string — If entity is an organization or individual with only full name available include full_name
      - `first_name` string — If entity is an individual include first_name
      - `alternate_first_name` string — If entity is an individual and uses an alias or nickname include alternate_first_name
      - `middle_name` string — If entity is an individual include middle_name if applicable
      - `last_name` string — If entity is an individual include last_name
      - `prefix` string — If entity is an individual include name prefix if applicable
      - `suffix` string — If entity is an individual include name suffix if applicable
      - `address` Address — A custom BaseModel with the eventual goal of populating inheriting models with the value property of enums rather than the raw enum. For now this is set to False (default setting) and we only set enum values to true within the models that have enums we know we need to use the values for.
        - `normalizations` unknown[]
          - unknown
        - `line1` string — Street address
        - `line2` string — Building, Suite#, Unit#, etc..
        - `city` string — City
        - `country` string — Country Code, ISO 3166-1 alpha-2 code
        - `state` string — State/Province Abbreviation Code, 2 characters
        - `postal_code` string — Postal Code, US - 5 digits or 5+4, Other - Alphanumeric
      - `email` string, email — The patient's email address
      - `date_of_birth` BirthDate, required — A custom BaseModel with the eventual goal of populating inheriting models with the value property of enums rather than the raw enum. For now this is set to False (default setting) and we only set enum values to true within the models that have enums we know we need to use the values for.
        - `year` string, required — The 4-digit year of the individual's date of birth
        - `month` string, required — The month of the individual's date of birth
        - `day` string, required — The day of the individual's date of birth
      - `gender` 'M' | 'F' | 'O' | 'U' — An enumeration.
      - `ssn` string — The patient's social security number
      - `insurance` Insurance — A custom BaseModel with the eventual goal of populating inheriting models with the value property of enums rather than the raw enum. For now this is set to False (default setting) and we only set enum values to true within the models that have enums we know we need to use the values for.
        - `name` string — The name of the insurance provider
        - `plan` string — The name of the plan with the insurer
        - `group_id` string — The member's insurance group ID
        - `member_id` string — The member's individual ID
      - `user_defined_text` UserDefinedText — A custom BaseModel with the eventual goal of populating inheriting models with the value property of enums rather than the raw enum. For now this is set to False (default setting) and we only set enum values to true within the models that have enums we know we need to use the values for.
        - `text1` string
        - `text2` string
        - `text3` string
        - `text4` string
      - `customer_member_id` string — An identifier for this member in the customer's system
      - `member_id` string — An identifier for this member in the Ciox system
    - `encounter` Encounter, required — A custom BaseModel with the eventual goal of populating inheriting models with the value property of enums rather than the raw enum. For now this is set to False (default setting) and we only set enum values to true within the models that have enums we know we need to use the values for.
      - `practitioner` Practitioner — A custom BaseModel with the eventual goal of populating inheriting models with the value property of enums rather than the raw enum. For now this is set to False (default setting) and we only set enum values to true within the models that have enums we know we need to use the values for.
        - `fax_number` string — Fax number
        - `phone_number` string — Phone number
        - `full_name` string — The practitioner's name
        - `first_name` string — The practitioner's first name
        - `last_name` string — The practitioner's last name
        - `contact` string — The practitioner's contact
        - `identifier` object — The practitioner's identifiers (eg. NPI, TIN, etc.)
      - `facility` Facility — A custom BaseModel with the eventual goal of populating inheriting models with the value property of enums rather than the raw enum. For now this is set to False (default setting) and we only set enum values to true within the models that have enums we know we need to use the values for.
        - `fax_number` string — Fax number
        - `phone_number` string — Phone number
        - `name` string — The facility name
        - `address` Address — A custom BaseModel with the eventual goal of populating inheriting models with the value property of enums rather than the raw enum. For now this is set to False (default setting) and we only set enum values to true within the models that have enums we know we need to use the values for.
          - `normalizations` unknown[]
            - unknown
          - `line1` string — Street address
          - `line2` string — Building, Suite#, Unit#, etc..
          - `city` string — City
          - `country` string — Country Code, ISO 3166-1 alpha-2 code
          - `state` string — State/Province Abbreviation Code, 2 characters
          - `postal_code` string — Postal Code, US - 5 digits or 5+4, Other - Alphanumeric
        - `identifier` object — The facility identifiers (eg. NPI, TIN, etc.)
        - `roi_site_id` string — A 5 digit number referencing a Ciox-embedded site.
        - `group` string — The facility's medical group name
        - `type` 'INPATIENT' | 'OUTPATIENT' — An enumeration.
      - `additional_information` object — Any other additional information for this encounter search criteria (eg. provider instructions)
      - `service_date_range` union, required — The service date range(s) for this encounter search criteria
        - ServiceDates — A custom BaseModel with the eventual goal of populating inheriting models with the value property of enums rather than the raw enum. For now this is set to False (default setting) and we only set enum values to true within the models that have enums we know we need to use the values for.
          - `start` string, date-time, required — The start of the service date range
          - `end` string, date-time — The end of the service date range
        - ServiceDates[]
          - `start` string, date-time, required — The start of the service date range
          - `end` string, date-time — The end of the service date range
      - `chart_components` ChartComponent[] — The individual components of a chart that should be retrieved for this encounter search criteria
      - `chart_packages` ChartPackage[] — A pre-configured package of chart components that should be retrieved for this encounter search criteria
    - `retrieval_details` VisitRetrievalDetails, required — Details about the retrieval of a visit.
      - `type` 'in_network' | 'out_of_network', required — Enum for visit types.
      - `retrieval_id` string — Unique identifier for the visit retrieval, whether in/out of network
    - `order_id` string, required — Customer-facing identifier for the order.
  - `total` integer, required
  - `limit` integer
  - `offset` integer
  - `links` Links, required
    - `first` string
    - `last` string
    - `self` string
    - `next` string
    - `prev` string
  - `unfiltered_total` integer

## Other responses

- `400` — Bad Request
- `404` — Not Found
- `422` — Unprocessable Entity

---

[API](https://skmtc.net/datavant/apis/datavant-rest-api.md) · [All operations](https://skmtc.net/datavant/apis/datavant-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/datavant/datavant-rest-api/revisions/f39a4bfeca8e/schema)
