---
title: "Add a query to an order"
method: POST
path: "/orders/{order_id}/queries"
tags: ["Order Queries"]
---

# Add a query to an order

`POST /orders/{order_id}/queries`

Add a query to an existing order that has not yet been submitted.

## Path parameters

- `order_id` string, required

## Headers

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

## Request body

- CreateOrderQueryRequest — The fields that a customer must specify to define an OrderQuery.
  - `id` string, required — User-provided identifier for the object. * Must be between 4 and 32 characters * Must contain only upper or lower-case alphanumeric characters, numbers, hyphens and/or underscores.
  - `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
  - `encounters` Encounter[], required — List of search criteria to use to target specific encounters
    - `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

## Response `201`

Successful Response

- OrderQueryResponse — The representation of an OrderQuery as it is returned to an external customer.
  - `uuid` string, uuid4, required — Unique identifier for the object.
  - `id` string, required — User-provided identifier for the object. * Must be between 4 and 32 characters * Must contain only upper or lower-case alphanumeric characters, numbers, hyphens and/or underscores.
  - `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
  - `encounters` Encounter[], required — List of search criteria to use to target specific encounters
    - `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
  - `created_at` string, date-time, required — The ISO8601 formatted timestamp for when the object was created.
  - `updated_at` string, date-time — The ISO8601 formatted timestamp for when the object was last updated.

## Other responses

- `400` — Bad Request
- `404` — Order does not exist.
- `422` — Order is not in 'draft' status.

---

[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)
