# Get a medication

Operation ID: `patient.getMedication`

Return a single medication by its resource id and `resource_type` (defaults to `MedicationRequest`). Requires a patient Bearer JWT.

## Public method

`getMedication`

Signature: `patient.getMedication(medicationId)`

Return type: `Promise<MedicationResponse>`

## Authentication

Classification: **AUTHENTICATED**

Schemes: `bearerAuth`

## Prerequisites

None documented.

## HTTP

`GET /patients/medications/{med_id}`

## Path parameters

| Name | Type | Required | Format | Allowed values | Default | Nullable | Description |
|---|---|---:|---|---|---|---:|---|
| `med_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` | [`GetMedicationResponse`](../models/GetMedicationResponse.md) | application/json | The requested medication |

## Success response examples

### 200

```json
{
  "authored_on": "2026-08-10",
  "brand_name": "Amoxil",
  "discontinued_reason": null,
  "dosage": {
    "duration_days": 10,
    "frequency": "once_daily",
    "frequency_details": "Every morning with food",
    "instructions": "Take one tablet by mouth each morning with food.",
    "max_daily_dose": 1,
    "max_daily_dose_unit": "tablet",
    "unit": "tablet",
    "value": 1
  },
  "encounter_id": "167dd34e-1833-4260-a8b1-ea0b38229a1b",
  "end_date": "2026-08-20",
  "fhir_id": "190e6baa-28c6-41f7-99b6-7107347478c2",
  "generic_name": "amoxicillin",
  "indication": "Acute bacterial sinusitis",
  "intent": "order",
  "medication_id": "1ce998b0-0530-470f-89bd-3f722fe9bc34",
  "name": "SDK Test Medication",
  "ndc_code": "00093-2264-01",
  "notes": "Complete the full prescribed course.",
  "pharmacy": "Example Community Pharmacy",
  "prescriber_id": "provider-example-001",
  "prescriber_name": "Dr. Alex Smith",
  "problem_reference": "condition-example-001",
  "refills_authorized": 1,
  "refills_remaining": 1,
  "resource_type": "MedicationRequest",
  "route": "oral",
  "rxnorm_code": "723",
  "start_date": "2026-08-10",
  "status": "active"
}
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `401` | [`patient.ErrorResponse`](../models/patient.ErrorResponse.md) | application/json | Authorization required — missing, invalid, expired, or non-patient Bearer JWT |
| `404` | [`patient.ErrorResponse`](../models/patient.ErrorResponse.md) | application/json | No medication exists with this id and resource_type |

## Error examples

### 401 — Missing or invalid access token

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

### 404 — The medication does not exist

```json
{
  "error": "Not Found"
}
```

## NodeJS / TypeScript implementation

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

```ts
const medicationId = "<MEDICATION_ID>";

const result = await patient.getMedication(medicationId);
```

## cURL

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

## Notes

- The `med_id` path parameter must be the medication's `fhir_id` from the create response, not its `medication_id`. Passing `medication_id` returns a 404. Confirmed live against DEV on 2026-08-10.

## 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.
