# Media Query

This data model allows you to exchange files (e.g., JPEG, PDF, WAV) like photos, videos, and audio recordings, as well as imaging and documents to or from a patient's chart. 

​You can also send files or documents with the `Notes` and `Results` data models. [Learn how to send a file](https://docs.redoxengine.com/permalink/P64iPMZngDZE2ggTAL1kC) with different data models.

This data model has event types that allow you to:

- save, replace, or delete a media document; or
- query for and receive media documents. 

> **Not for DICOM files**
>
> Most EHR systems don't use this data model to receive diagnostic quality images like DICOM files. 

> **EHR support for Media**
>
> Most EHR systems require the patient identifier and basic patient demographics (e.g., name, date of birth) to save a document to a patient's chart. 
>
> The EHR system may also require provider information like who generated the document, the file type, the filename, document ID, and whether the document has been authenticated and authorized to be shared in the patient’s chart. Or a visit ID may be required if the document is associated with a specific visit. 

Query for media type of documents. Results are returned in `Media.QueryReponse`.

> **Data on demand enabled**
>
> This event type is available with data on demand. [Learn more about data on demand.](https://docs.redoxengine.com/permalink/4TD76U5kQESdKsZvzDHfx5)

Status: Beta, Data on demand

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `Meta` | object | Yes |  |
| `Meta.DataModel` | string | Yes | Media |
| `Meta.EventType` | string | Yes | Query |
| `Meta.EventDateTime` | string or null | No | Displays the UTC date and time that an outgoing request is delivered or an incoming request is received. *[ISO 8601 Format](http://en.wikipedia.org/wiki/ISO_8601)* |
| `Meta.Test` | boolean or null | No | Indicates whether the request is a test or not. |
| `Meta.Source` | object | No | Contains the information for the system initiating the message, including the source ID and name. *Included in messages from Redox* |
| `Meta.Source.ID` | string or null | No | Identifies the system initiating the message. If you have multiple OAuth API keys per environment type, this value is required. If you have only one OAuth API key per environment type, or you're using legacy API keys, this value is optional. *UUID* |
| `Meta.Source.Name` | string or null | No | Displays the name of the system initiating the message. |
| `Meta.Destinations` | Array of object | No | Contains the information for the endpoint(s) receiving the request. A request must contain at least one destination, but asynchronous requests can have more than one destination. Synchronous requests like queries can only support one destination. *Required when sending data to Redox.* |
| `Meta.Destinations[].ID` | string or null | No | Identifies the endpoint that the request is directed to. *UUID* |
| `Meta.Destinations[].Name` | string or null | No | Displays the name of the endpoint that the request is directed to. |
| `Meta.Logs` | Array of object | No | Contains the log identifier(s) for the request. |
| `Meta.Logs[].ID` | string or null | No | Identifies the request log(s) that correspond to this request. You can use this value to locate the relevant log in the Redox dashboard for support and reference. *UUID* |
| `Meta.Logs[].AttemptID` | string or null | No | Identifies the request log attempt value, which is useful when retries are possible. *UUID* |
| `Meta.FacilityCode` | string or null | No | Code for the facility related to the message. *Only use this field if a health system indicates you should. The code is specific to the health system's EHR and might not be unique across health systems. In general, the facility fields within the data models (e.g. OrderingFacility) are more reliable and informative.* |
| `Patients` | Array of object | No | Array of patients to filter results on. *If multiple patients are provided, media associated with any of the patients will be returned.* |
| `Patients[].Identifiers` | Array of object | No | List of IDs and ID types that identify the patient. *If multiple identifiers are provided, only patients with all identifiers will be considered.* |
| `Patients[].Identifiers[].ID` | string or null | No | ID of the Patient |
| `Patients[].Identifiers[].IDType` | string or null | No | ID Type for the corresponding ID of this patient (ie. MRN, EHRID) |
| `VisitNumbers` | Array of string | No | Array of patient visits to query on. *If multiple visits are provided, media associated with any of the patient visits will be returned.* |
| `DocumentTypes` | Array of string | No | Array of document types to query on. *The type of media to retrieve (E.g. Consent Form, Treatment Plan)* |
| `DocumentIDs` | Array of string | No | Array of document identifiers to query on. |

## Example

```json
{
  "Meta": {
    "DataModel": "Media",
    "EventType": "Query",
    "EventDateTime": "2026-11-16T23:16:06.930Z",
    "Test": true,
    "Source": {
      "ID": "7ce6f387-c33c-417d-8682-81e83628cbd9",
      "Name": "Redox Dev Tools"
    },
    "Destinations": [
      {
        "ID": "af394f14-b34a-464f-8d24-895f370af4c9",
        "Name": "Redox EMR"
      }
    ],
    "Logs": [
      {
        "ID": "d9f5d293-7110-461e-a875-3beb089e79f3",
        "AttemptID": "925d1617-2fe0-468c-a14c-f8c04b572c54"
      }
    ],
    "FacilityCode": null
  },
  "Patients": [
    {
      "Identifiers": [
        {
          "ID": "0000000001",
          "IDType": "MR"
        },
        {
          "ID": "e167267c-16c9-4fe3-96ae-9cff5703e90a",
          "IDType": "EHRID"
        },
        {
          "ID": "a1d4ee8aba494ca",
          "IDType": "NIST"
        }
      ]
    }
  ],
  "VisitNumbers": [
    "1234",
    "5678"
  ],
  "DocumentTypes": [
    "Sample Image",
    "Sample Image"
  ],
  "DocumentIDs": [
    "b169923c-42g9-4fe3-91hg-8ckf1094e90l"
  ]
}
```
