Skip to main content
The clinik.prescriptions namespace manages FHIR MedicationRequest resources — electronic prescriptions that authorize a medication for a patient. Each prescription links a patient to a prescribing practitioner and a medication, and carries dosage instructions, refill counts, and dispensing rules. Use clinik.medications to manage the underlying medication catalog.

create

Create a new prescription. The patientId, prescriberId, and medication fields are required.
const { data, meta } = await clinik.prescriptions.create(request: PrescriptionCreateRequest): Promise<ApiResponse<MedicationRequest>>
patientId
string
required
ID of the patient receiving the prescription.
prescriberId
string
required
ID of the prescribing practitioner.
medication
string | { system?: string; code: string; display?: string }
required
The medication to prescribe. Pass an RxNorm code object or a plain-text drug name.
encounterId
string
Encounter during which the prescription was written.
intent
string
Prescription intent. Accepted values: proposal, plan, order (default), original-order.
status
string
Prescription status. Accepted values: active (default), on-hold, cancelled, completed, draft.
priority
string
Dispensing priority. Accepted values: routine, urgent, asap, stat.
dosageText
string
Human-readable dosage instructions for the patient and pharmacist.
dosage
object
Structured dosage object with dose, frequency, period, and route fields. Use this alongside dosageText for systems that need machine-readable dosing.
refills
number
Number of authorized refills. Accepted range: 099.
quantity
{ value: number; unit: string }
Quantity to dispense, for example { value: 30, unit: 'tablets' }.
supplyDays
number
Expected number of days the supply will last.
substitutionAllowed
boolean
Whether the pharmacist may substitute a generic equivalent. Defaults to true.
reason
string
Clinical indication or diagnosis code for prescribing this medication.
note
string
Notes to the pharmacist or care team.

Example

const { data: rx } = await clinik.prescriptions.create({
  patientId: 'pt_abc123',
  prescriberId: 'prac_def456',
  encounterId: 'enc_xyz789',
  medication: {
    system: 'http://www.nlm.nih.gov/research/umls/rxnorm',
    code: '197361',
    display: 'Lisinopril 10 MG Oral Tablet',
  },
  status: 'active',
  priority: 'routine',
  dosageText: 'Take one tablet by mouth once daily',
  refills: 5,
  quantity: { value: 30, unit: 'tablets' },
  supplyDays: 30,
  substitutionAllowed: true,
  reason: 'Essential hypertension (I10)',
});

console.log('Prescription ID:', rx.id);

read

Fetch a single prescription by ID.
const { data, meta } = await clinik.prescriptions.read(id: string, options?: ReadOptions): Promise<ApiResponse<MedicationRequest>>

update

Partially update a prescription. Only the fields you include are changed.
const { data, meta } = await clinik.prescriptions.update(id: string, request: PrescriptionUpdateRequest): Promise<ApiResponse<MedicationRequest>>

Example: put a prescription on hold

await clinik.prescriptions.update('rx_abc123', {
  status: 'on-hold',
  note: 'Hold pending specialist consultation.',
});

delete

Permanently delete a prescription record.
const { data, meta } = await clinik.prescriptions.delete(id: string): Promise<ApiResponse<void>>
Search prescriptions with filters on patient, prescriber, status, and medication.
const { data, meta } = await clinik.prescriptions.search(params?: ResourceSearchParams): Promise<ApiResponse<PaginatedResponse<MedicationRequest>>>
patientId
string
Filter by patient.
prescriberId
string
Filter by prescribing practitioner.
status
string
Filter by prescription status.
medication
string
Filter by medication name or code.
count
number
Results per page.
cursor
string
Pagination cursor from a previous response.

Example

const { data } = await clinik.prescriptions.search({
  patientId: 'pt_abc123',
  status: 'active',
  count: 50,
});

console.log('Active prescriptions:', data.data.length);