Skip to main content
The clinik.encounters namespace manages FHIR Encounter resources, which represent clinical interactions between a patient and a care provider — office visits, emergency admissions, telehealth sessions, and more. Every encounter links to a patient and optionally to a practitioner, location, and set of diagnoses.

create

Create a new Encounter. The status, class, and patientId fields are required.
const { data, meta } = await clinik.encounters.create(request: EncounterCreateRequest): Promise<ApiResponse<Encounter>>
status
string
required
Encounter status. Accepted values: planned, arrived, triaged, in-progress, onleave, finished, cancelled.
class
string
required
Encounter class code. Accepted values: AMB (ambulatory), IMP (inpatient), EMER (emergency), HH (home health), VR (virtual).
patientId
string
required
ID of the patient this encounter belongs to.
practitionerId
string
ID of the responsible practitioner.
type
string
Specific encounter type.
serviceType
string
The type of service provided.
priority
string
Clinical priority.
reasonCode
string
Coded reason for the encounter.
period
{ start?: string; end?: string }
Start and end times for the encounter in ISO 8601 format.
lengthMinutes
number
Duration of the encounter in minutes.
location
string
Name or identifier of the encounter location.
serviceProvider
string
Name of the providing organization.
diagnosis
Array<{ condition: string; use?: string; rank?: number }>
List of diagnoses associated with the encounter. Each entry includes a condition code, an optional use (e.g. AD for admission diagnosis), and an optional rank.

Example

const { data: encounter } = await clinik.encounters.create({
  status: 'in-progress',
  class: 'AMB',
  patientId: 'pt_abc123',
  practitionerId: 'prac_def456',
  type: 'routine-checkup',
  period: { start: '2025-06-01T09:00:00Z' },
  lengthMinutes: 30,
  location: 'Clinic A - Room 3',
  diagnosis: [
    { condition: 'I10', use: 'AD', rank: 1 },
  ],
});

read

Fetch a single encounter by ID.
const { data, meta } = await clinik.encounters.read(id: string, options?: ReadOptions): Promise<ApiResponse<Encounter>>
id
string
required
The encounter ID (e.g. enc_xyz789).

update

Partially update an encounter. Only the fields you include are changed.
const { data, meta } = await clinik.encounters.update(id: string, request: EncounterUpdateRequest): Promise<ApiResponse<Encounter>>

Example

await clinik.encounters.update('enc_xyz789', {
  status: 'finished',
  period: {
    start: '2025-06-01T09:00:00Z',
    end: '2025-06-01T09:30:00Z',
  },
});

delete

Permanently delete an encounter.
const { data, meta } = await clinik.encounters.delete(id: string): Promise<ApiResponse<void>>
Search encounters with optional filters. Results are cursor-paginated.
const { data, meta } = await clinik.encounters.search(params?: ResourceSearchParams): Promise<ApiResponse<PaginatedResponse<Encounter>>>
patientId
string
Return encounters for a specific patient.
status
string
Filter by encounter status.
dateFrom
string
Return encounters with a period start on or after this date (YYYY-MM-DD).
dateTo
string
Return encounters with a period start on or before this date (YYYY-MM-DD).
sort
string
Sort field. Prefix with - for descending order, for example -date.
count
number
Results per page.
cursor
string
Pagination cursor from a previous response.

Example

const { data } = await clinik.encounters.search({
  patientId: 'pt_abc123',
  status: 'finished',
  dateFrom: '2025-01-01',
  sort: '-date',
  count: 25,
});

console.log('Finished encounters:', data.data.length);