# CDSHooks discovery-response

These API events help facilitate real-time, immediate clinical decision support (CDS). <u>CDS hooks</u> are events that are triggered during the provider's workflow, typically appearing as a popup modal or separate iFrame. The most common hooks are triggered upon: 

- opening a patient chart
- signing an order
- creating an order
- scheduling

We support these type of hooks that allow you to:

- request a list of supported CDS hooks within the EHR system; 
- return a list of supported CDS hooks within the EHR system;
- view context for a patient upon opening or interacting with their chart;
- view context when creating and selecting an order from a list of order types; and
- view order context and insights when signing an order.

Return a list of supported CDS hooks within the EHR system. 

This is a response to the `Discovery` event type.

Status: Beta

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `Meta` | object | Yes |  |
| `Meta.DataModel` | string | Yes | CDSHooks |
| `Meta.EventType` | string | Yes | discovery-response |
| `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.* |
| `services` | Array of object | Yes | Describes the CDS service, including its metadata and supported hooks. |
| `services[].hook` | string | Yes | Specifies the name of the hook that the CDS service supports, as well as the event in the clinician's workflow that triggers it. *e.g., patient-view, order-sign, etc.* |
| `services[].id` | string | Yes | Contains the unique identifier for the CDS service. This ID is used to reference the CDS service in the EHR system. |
| `services[].title` | string or null | No | Contains a human-readable name for the CDS service. This is displayed to the clinician in the EHR system. |
| `services[].description` | string or null | No | Describes what the CDS service does and how it can be used. |
| `services[].prefetch` | object | No | Defines the FHIR data (e.g., `Patient`, `Condition`) that the EHR system should retrieve in advance to include in the CDS service request when the event is triggered. This reduces latency by fetching required data ahead of time and ensures that the CDS service has the necessary context to make informed decisions. |
| `services[].prefetch.{{key}}` | string or null | No | Defines additional fields under the prefetch object, where each key represents a FHIR query defined by the EHR. These queries are used to retrieve data in advance to optimize CDS service performance. |
| `services[].usageDescription` | string or null | No | Describes how the CDS service should be used, including its intended use case. |

## Example

```json
{
  "Meta": {
    "Logs": [
      {
        "ID": "d9f5d293-7110-461e-a875-3beb089e79f3",
        "AttemptID": "925d1617-2fe0-468c-a14c-f8c04b572c54"
      }
    ],
    "Test": true,
    "EventDateTime": "2026-11-20T23:35:51.576Z",
    "Source": {
      "ID": "7ce6f387-c33c-417d-8682-81e83628cbd9",
      "Name": "Redox Dev Tools"
    },
    "Destinations": [
      {
        "ID": "af394f14-b34a-464f-8d24-895f370af4c9",
        "Name": "Redox EMR"
      }
    ],
    "DataModel": "CDSHooks",
    "EventType": "discovery-response",
    "FacilityCode": null
  },
  "services": [
    {
      "id": "check-patient-membership",
      "title": "Patient Population Health Study Membership",
      "description": "Display whether the patient is a member of the population health study",
      "hook": "patient-view",
      "prefetch": {
        "patient": "Patient/{{context.patientId}}"
      }
    }
  ]
}
```
