The Medication resource represents a drug definition — what the medication is, not an order to give it to a patient. It stores the drug’s coded identity, form, active ingredients, and batch details. For prescribing a medication to a patient, use Prescriptions (MedicationRequest).
Create a medication
You can create a medication with a free-text name when no code is available, or with a fully coded identity (RxNorm, SNOMED CT) and ingredient details:
// Simple — free-text name
const { data: med } = await clinik.medications.create({
code: 'Amoxicillin 500mg Capsule',
status: 'active',
form: 'capsule',
});
// Coded — RxNorm with ingredients and batch info
const { data: coded } = await clinik.medications.create({
code: {
system: 'http://www.nlm.nih.gov/research/umls/rxnorm',
code: '308182',
display: 'Amoxicillin 500 MG Oral Capsule',
},
status: 'active',
form: 'capsule',
ingredient: [
{
item: {
system: 'http://www.nlm.nih.gov/research/umls/rxnorm',
code: '723',
display: 'Amoxicillin',
},
isActive: true,
strength: {
numerator: { value: 500, unit: 'mg' },
denominator: { value: 1, unit: 'capsule' },
},
},
],
batch: {
lotNumber: 'LOT-2025-A001',
expirationDate: '2026-12-31',
},
});
Coding systems
| System | Use case | Example |
|---|
| RxNorm | US drug codes | 197361 (Lisinopril 10mg) |
| SNOMED CT | Clinical terms | 387207008 (Ibuprofen) |
| Free text | When no code is available | "Custom compound cream" |
Read a medication
const { data: medication } = await clinik.medications.read('med_abc123');
Update a medication
await clinik.medications.update('med_abc123', {
status: 'inactive',
batch: { expirationDate: '2025-06-30' },
});
Delete a medication
await clinik.medications.delete('med_abc123');
Deleting a medication that is referenced by active prescriptions may break those records. Check for active MedicationRequest references before deleting.
Search medications
const { data } = await clinik.medications.search({
status: 'active',
count: 50,
});
Medications vs prescriptions
| Resource | FHIR type | Purpose |
|---|
Medication | Medication | Drug definition — what the drug is |
Prescription | MedicationRequest | Medication order — prescribing it to a patient |
You don’t need to create a Medication record before writing a prescription. You can pass an inline medication code directly in clinik.prescriptions.create. Creating a Medication record is useful when you want to maintain a reusable drug catalog, track batch and lot numbers, or store ingredient details.