> ## Documentation Index
> Fetch the complete documentation index at: https://docs.clinikapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Encounters

> SDK reference for encounter operations.

# clinik.encounters

## create

```ts theme={null}
const { data, meta } = await clinik.encounters.create(request: EncounterCreateRequest): Promise<ApiResponse<Encounter>>
```

| Field             | Type                                | Required | Description                                                          |
| ----------------- | ----------------------------------- | -------- | -------------------------------------------------------------------- |
| `status`          | `string`                            | Yes      | planned, arrived, triaged, in-progress, onleave, finished, cancelled |
| `class`           | `string`                            | Yes      | AMB, IMP, EMER, HH, VR                                               |
| `patientId`       | `string`                            | Yes      | Patient reference                                                    |
| `practitionerId`  | `string`                            | No       | Primary practitioner reference                                       |
| `participants`    | `Array<{ practitionerId, role? }>`  | No       | Additional participants                                              |
| `type`            | `string`                            | No       | Encounter type                                                       |
| `serviceType`     | `string`                            | No       | Service type                                                         |
| `priority`        | `string`                            | No       | Priority                                                             |
| `reasonCode`      | `string`                            | No       | Reason for encounter                                                 |
| `period`          | `{ start?, end? }`                  | No       | Time period                                                          |
| `lengthMinutes`   | `number`                            | No       | Duration in minutes                                                  |
| `location`        | `string`                            | No       | Location name                                                        |
| `serviceProvider` | `string`                            | No       | Organization name                                                    |
| `diagnosis`       | `Array<{ condition, use?, rank? }>` | No       | Diagnoses                                                            |
| `appointmentId`   | `string`                            | No       | Appointment that scheduled this encounter                            |
| `basedOnId`       | `string`                            | No       | ServiceRequest that initiated this encounter                         |
| `partOfId`        | `string`                            | No       | Parent encounter (for sub-encounters)                                |
| `hospitalization` | `object`                            | No       | Inpatient details (admitSource, dischargeDisposition, etc.)          |

### Hospitalization

For inpatient encounters (`class: 'IMP'`), include hospitalization details:

| Field                  | Type       | Description                                            |
| ---------------------- | ---------- | ------------------------------------------------------ |
| `admitSource`          | `string`   | Where admitted from (physician referral, transfer, ER) |
| `dischargeDisposition` | `string`   | Discharge destination (home, SNF, expired)             |
| `reAdmission`          | `string`   | Re-admission type if applicable                        |
| `dietPreference`       | `string[]` | Diet preferences (vegetarian, kosher, etc.)            |
| `specialArrangement`   | `string[]` | Wheelchair, translator, stretcher, etc.                |
| `destination`          | `string`   | Discharge destination facility                         |
| `origin`               | `string`   | Originating facility                                   |

## read

```ts theme={null}
const { data, meta } = await clinik.encounters.read(id: string, options?: ReadOptions): Promise<ApiResponse<Encounter>>
```

## update

```ts theme={null}
const { data, meta } = await clinik.encounters.update(id: string, request: EncounterUpdateRequest): Promise<ApiResponse<Encounter>>
```

## delete

```ts theme={null}
const { data, meta } = await clinik.encounters.delete(id: string): Promise<ApiResponse<void>>
```

## search

```ts theme={null}
const { data, meta } = await clinik.encounters.search(params?: ResourceSearchParams): Promise<ApiResponse<PaginatedResponse<Encounter>>>
```

| Parameter   | Type     | Description                                 |
| ----------- | -------- | ------------------------------------------- |
| `patientId` | `string` | Filter by patient                           |
| `status`    | `string` | Filter by status                            |
| `dateFrom`  | `string` | Start date filter                           |
| `dateTo`    | `string` | End date filter                             |
| `sort`      | `string` | Sort field (prefix with `-` for descending) |
| `count`     | `number` | Results per page                            |
| `cursor`    | `string` | Pagination cursor                           |
