# List a patient's medications

Operation ID: `ehr.listMedications`

List medication resources for a patient. ?resource_type= selects the FHIR resource type queried (MedicationRequest, MedicationStatement, ...); defaults to MedicationRequest.

## Public method

`listMedications`

Signature: `ehr.listMedications(patientId, resourceType)`

Return type: `Promise<ListMedicationsResponse>`

## Authentication

Classification: **AUTHENTICATED**

Schemes: `bearerAuth`

## Prerequisites

None documented.

## HTTP

`GET /patients/{patient_id}/medications`

## Path parameters

| Name | Type | Required | Format | Allowed values | Default | Nullable | Description |
|---|---|---:|---|---|---|---:|---|
| `patient_id` | `string` | Yes |  |  |  | No |  |

## Query parameters

| Name | Type | Required | Format | Allowed values | Default | Nullable | Description |
|---|---|---:|---|---|---|---:|---|
| `resource_type` | `string` | No |  | MedicationRequest, MedicationStatement | `"MedicationRequest"` | No |  |

## Body parameters

None.

Request model: None.

## Request example

None declared in canonical OpenAPI.

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `200` | [`ehr.ListMedicationsResponse`](../models/ehr.ListMedicationsResponse.md) | application/json | Patient medications |

## Success response examples

### 200

```json
{
  "medications": [
    {
      "authored_on": "2026-01-15T10:00:00Z",
      "brand_name": "Ventolin HFA",
      "discontinued_reason": null,
      "dosage": {
        "duration_days": 30,
        "frequency": "as_needed",
        "frequency_details": "Every 4 to 6 hours as needed",
        "instructions": "Inhale two puffs for wheezing",
        "max_daily_dose": 8,
        "max_daily_dose_unit": "puffs",
        "unit": "puffs",
        "value": 2
      },
      "encounter_id": "encounter-example-001",
      "end_date": null,
      "fhir_id": "medication-example-001",
      "generic_name": "Albuterol",
      "indication": "Asthma",
      "intent": "order",
      "medication_id": "00000000-0000-4000-8000-000000000305",
      "name": "Albuterol 90 mcg inhaler",
      "ndc_code": "00173-0682-20",
      "notes": "Synthetic active medication",
      "pharmacy": "Example Community Pharmacy",
      "prescriber_id": "provider-example-001",
      "prescriber_name": "Dr. Alex Smith",
      "problem_reference": "condition-example-001",
      "refills_authorized": 3,
      "refills_remaining": 2,
      "resource_type": "MedicationRequest",
      "route": "inhaled",
      "rxnorm_code": "745752",
      "start_date": "2026-01-15",
      "status": "active"
    }
  ],
  "patient_id": "patient-example-001",
  "total": 1
}
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `401` | [`StandardErrorResponse`](../models/StandardErrorResponse.md) | application/json | Authorization required — missing or invalid Bearer JWT |
| `500` | [`StandardErrorResponse`](../models/StandardErrorResponse.md) | application/json | Internal server error |

## Error examples

### 401 — Missing or invalid access token

```json
{
  "error": "Authorization required"
}
```

### 500 — Unexpected service failure (sanitized example)

```json
{
  "error": "Internal server error"
}
```

## NodeJS / TypeScript implementation

```ts
import { HCSDK } from "@healthcloudai/hc-sdk";
```

```ts
const patientId = "<PATIENT_ID>";

const resourceType = "MedicationRequest";

const result = await ehr.listMedications(patientId, resourceType);
```

## cURL

```bash
curl -X GET \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  'https://dev-api-ehr.health.cloud/patients/%3CPATIENT_ID%3E/medications?resource_type=MedicationRequest'
```

## Notes

None.

## Prepared Test Console scenario

No canonical scenario is currently associated.

## Real response

No approved real integration response is currently published. Unapproved candidates are never rendered as examples.
