Skip to main content
The clinik.medications namespace manages FHIR Medication resources — entries in your drug catalog that describe a medication’s identity, form, and ingredients. This is distinct from clinik.prescriptions, which authorizes a medication for a patient. Think of medications as the catalog and prescriptions as the orders against it.

create

Create a new Medication. The code field is required.
const { data, meta } = await clinik.medications.create(request: MedicationCreateRequest): Promise<ApiResponse<Medication>>
code
string | { system?: string; code: string; display?: string }
required
The medication identity. Pass a free-text name string or a coded concept using RxNorm, SNOMED CT, or another terminology system.
status
'active' | 'inactive'
Whether the medication is available for use. Defaults to active.
form
string
Dosage form, for example tablet, capsule, injection, solution.
ingredient
Array
Active and inactive ingredients. Each entry contains an item (coded concept), an isActive flag, and an optional strength with numerator and denominator quantities.
batch
{ lotNumber?: string; expirationDate?: string }
Batch or lot information for inventory and traceability.

Examples

const { data } = await clinik.medications.create({
  code: 'Lisinopril 10mg Oral Tablet',
  status: 'active',
  form: 'tablet',
});

read

Fetch a single medication by ID.
const { data, meta } = await clinik.medications.read(id: string): Promise<ApiResponse<Medication>>

update

Partially update a medication record. Only the fields you include are changed.
const { data, meta } = await clinik.medications.update(id: string, request: MedicationUpdateRequest): Promise<ApiResponse<Medication>>

Example: mark a medication inactive

await clinik.medications.update('med_abc123', {
  status: 'inactive',
  batch: { expirationDate: '2025-06-30' },
});

delete

Permanently delete a medication from the catalog.
const { data, meta } = await clinik.medications.delete(id: string): Promise<ApiResponse<void>>
Deleting a medication does not affect existing prescriptions that reference it. Deactivate the medication with status: 'inactive' instead if you want to prevent future prescriptions without breaking historical records.
Search your medication catalog by status with cursor pagination.
const { data, meta } = await clinik.medications.search(params?: ResourceSearchParams): Promise<ApiResponse<PaginatedResponse<Medication>>>
status
string
Filter by active or inactive.
count
number
Results per page. Maximum is 100.
cursor
string
Pagination cursor from a previous response.

Example

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

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